diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2005-02-21 16:15:57 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2005-02-21 16:15:57 +0300 |
commit | 75e1edb879991a5a246bf845fed715112ecf187d (patch) | |
tree | 5ee46ffdb320357d29cc31db09e1ac7aeaaab526 /mcs/class/System.XML/Mono.Xml.XPath | |
parent | 1c93b8f68506884c8e242978877a72dae30d0852 (diff) |
2004-02-21 Atsushi Enomoto <atsushi@ximian.com>
* DTMXPathDocumentBuilder2.cs : whitespace node values were not added
to Value.
svn path=/trunk/mcs/; revision=40986
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.XPath')
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.XPath/ChangeLog | 5 | ||||
-rwxr-xr-x | mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs | 34 |
2 files changed, 35 insertions, 4 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog index 46cac31b85a..4f3ecf0f717 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog @@ -1,3 +1,8 @@ +2004-02-21 Atsushi Enomoto <atsushi@ximian.com> + + * DTMXPathDocumentBuilder2.cs : whitespace node values were not added + to Value. + 2004-02-14 Atsushi Enomoto <atsushi@ximian.com> * DTMXPathDocumentBuilder2.cs : in some cases, significant whitespace diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs index 70822010bd3..b968829979b 100755 --- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs +++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs @@ -287,10 +287,36 @@ namespace Mono.Xml.XPath nsIndex, lineInfo != null ? lineInfo.LineNumber : 0, lineInfo != null ? lineInfo.LinePosition : 0); - // this code is tricky, but after ReadString() invokation, - // xmlReader is moved to next node!! - if (value == null) - nodes [nodeIndex].Value = NonAtomicIndex (xmlReader.ReadString ()); + // this code is tricky, but after sequential + // Read() invokation, xmlReader is moved to + // next node. + if (value == null) { + bool loop = true; + value = String.Empty; + XPathNodeType type = XPathNodeType.Whitespace; + do { + switch (xmlReader.NodeType) { + case XmlNodeType.Text: + case XmlNodeType.CDATA: + type = XPathNodeType.Text; + goto case XmlNodeType.Whitespace; + case XmlNodeType.SignificantWhitespace: + if (type == XPathNodeType.Whitespace) + type = XPathNodeType.SignificantWhitespace; + goto case XmlNodeType.Whitespace; + case XmlNodeType.Whitespace: + if (xmlReader.NodeType != XmlNodeType.Whitespace || xmlSpace == XmlSpace.Preserve) + value += xmlReader.Value; + xmlReader.Read (); + continue; + default: + loop = false; + break; + } + } while (loop && !xmlReader.EOF); + nodes [nodeIndex].Value = NonAtomicIndex (value); + nodes [nodeIndex].NodeType = type; + } break; case XmlNodeType.Comment: value = xmlReader.Value; |