Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs')
-rwxr-xr-xmcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocumentBuilder2.cs34
1 files changed, 30 insertions, 4 deletions
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;