* Makefile : now we can depend on Alejandro's System.Query.dll.
* XElementSequence.cs : implemented (not sure if it works).
* XName.cs : strict null comparison.
* XIterators.cs : (XFilterIterator) check attribute XName as well.
* System.Xml.XLinq.cs : solved FIXMEs.
svn path=/trunk/mcs/; revision=56806
+2006-02-11 Atsushi Enomoto <atsushi@ximian.com>
+
+ * Makefile : now we can depend on Alejandro's System.Query.dll.
+
2005-09-20 Atsushi Enomoto <atsushi@ximian.com>
* Makefile,
LIBRARY = System.Xml.XLinq.dll
LIB_MCS_FLAGS = \
/r:System.dll \
+ /r:System.Query.dll \
/r:System.Xml.dll \
/d:LIST_BASED
EXTRA_DISTFILES =
+# This is a .NET 2.0 only assembly
+VALID_PROFILE := $(filter net_2_0_bootstrap net_2_0, $(PROFILE))
+ifndef VALID_PROFILE
+LIBRARY_NAME = dummy-System.Xml.XLinq.dll
+NO_INSTALL = yes
+NO_SIGN_ASSEMBLY = yes
+NO_TEST = yes
+endif
+
include ../../build/library.make
+2006-02-11 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XElementSequence.cs : implemented (not sure if it works).
+ * XName.cs : strict null comparison.
+ * XIterators.cs : (XFilterIterator) check attribute XName as well.
+ * System.Xml.XLinq.cs : solved FIXMEs.
+
2005-09-20 Atsushi Enomoto <atsushi@ximian.com>
* XAttribute.cs, XIterators.cs, XName.cs, XElementSequence.cs,
public static XDocument Load (string uri, bool preserveWhitespaces)
{
XmlReaderSettings s = new XmlReaderSettings ();
- // FIXME: finish System.Xml 2.0
-// s.IgnoreWhitespaces = !preserveWhitespaces;
+ s.IgnoreWhitespace = !preserveWhitespaces;
using (XmlReader r = XmlReader.Create (uri, s)) {
return Load (r);
}
public static XDocument Load (TextReader reader, bool preserveWhitespaces)
{
XmlReaderSettings s = new XmlReaderSettings ();
- // FIXME: finish System.Xml 2.0
-// s.IgnoreWhitespaces = !preserveWhitespaces;
-// using (XmlReader r = XmlReader.Create (reader, s)) {
- using (XmlReader r = XmlReader.Create (reader)) {
+ s.IgnoreWhitespace = !preserveWhitespaces;
+ using (XmlReader r = XmlReader.Create (reader, s)) {
return Load (r);
}
}
public static XElement Load (string uri, bool preserveWhitespaces)
{
XmlReaderSettings s = new XmlReaderSettings ();
- // FIXME: finish System.Xml 2.0
-// s.IgnoreWhitespaces = !preserveWhitespaces;
+ s.IgnoreWhitespace = !preserveWhitespaces;
using (XmlReader r = XmlReader.Create (uri, s)) {
return Load (r);
}
public static XElement Load (TextReader tr, bool preserveWhitespaces)
{
XmlReaderSettings s = new XmlReaderSettings ();
- // FIXME: finish System.Xml 2.0
-// s.IgnoreWhitespaces = !preserveWhitespaces;
-// using (XmlReader r = XmlReader.Create (tr, s)) {
- using (XmlReader r = XmlReader.Create (tr)) {
+ s.IgnoreWhitespace = !preserveWhitespaces;
+ using (XmlReader r = XmlReader.Create (tr, s)) {
return Load (r);
}
}
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Runtime.CompilerServices;
namespace System.Xml.XLinq
{
- // [ExtensionAttribute]
+ [ExtensionAttribute]
public static class XElementSequence
{
- // [ExtensionAttribute]
+ [ExtensionAttribute]
public static IEnumerable <XElement> Ancestors (IEnumerable <XElement> source)
{
- throw new NotImplementedException ();
+ foreach (XElement item in source)
+ foreach (XElement elem in item.Ancestors ())
+ yield return elem;
}
- // [ExtensionAttribute]
+ [ExtensionAttribute]
public static IEnumerable <XElement> Ancestors (IEnumerable <XElement> source, XName name)
{
- throw new NotImplementedException ();
+ foreach (XElement item in source)
+ foreach (XElement elem in item.Ancestors (name))
+ yield return elem;
}
- // [ExtensionAttribute]
- public static IEnumerable <XAttribute> Attributes (IEnumerable <XAttribute> source)
+ [ExtensionAttribute]
+ public static IEnumerable <XAttribute> Attributes (IEnumerable <XElement> source)
{
- throw new NotImplementedException ();
+ foreach (XElement item in source)
+ foreach (XAttribute attr in item.Attributes ())
+ yield return attr;
}
- // [ExtensionAttribute]
- public static IEnumerable <XAttribute> Attributes (IEnumerable <XAttribute> source, XName name)
+ [ExtensionAttribute]
+ public static IEnumerable <XAttribute> Attributes (IEnumerable <XElement> source, XName name)
{
- throw new NotImplementedException ();
+ foreach (XElement item in source)
+ foreach (XAttribute attr in item.Attributes (name))
+ yield return attr;
}
}
}
foreach (object o in source) {
if (! (o is T))
continue;
- if (name != null && (! (o is XElement) || ((XElement) o).Name != name))
- continue;
- yield return o as T;
+ if (name != null) {
+ if (o is XElement) {
+ if (((XElement) o).Name != name)
+ continue;
+ }
+ else if (o is XAttribute) {
+ if (((XAttribute) o).Name != name)
+ continue;
+ }
+ }
+ yield return (T) o;
}
}
public static bool operator == (XName n1, XName n2)
{
- return (object) n1 == null && (object) n2 == null ||
- object.ReferenceEquals (n1, n2) ||
+ if ((object) n1 == null)
+ return (object) n2 == null;
+ else if ((object) n2 == null)
+ return false;
+ return object.ReferenceEquals (n1, n2) ||
n1.local == n2.local && n1.ns == n2.ns;
}
public static implicit operator XName (string s)
{
- return Get (s);
+ return s == null ? null : Get (s);
}
public static bool operator != (XName n1, XName n2)