Using XPath in an XML stream

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im trying to perform an XPath query on an XML stream. However, the query is not returning a result. Is this supported? The same query works fine on an XML document.
<div style="color:Black;background-color:White; <pre>
Stream inboundStream = pInMsg.BodyPart.GetOriginalDataStream();
VirtualStream virtualStream = <span style="color:Blue; new VirtualStream(bufferSize, thresholdSize);
ReadOnlySeekableStream readOnlySeekableStream = <span style="color:Blue; new ReadOnlySeekableStream(inboundStream, virtualStream, bufferSize);
XmlTextReader xmlTextReader = <span style="color:Blue; new XmlTextReader(readOnlySeekableStream);
XPathCollection xPathCollection = <span style="color:Blue; new XPathCollection();
XPathReader xPathReader = <span style="color:Blue; new XPathReader(xmlTextReader, xPathCollection);
xPathCollection.Add(<span style="color:#A31515; "//ns0:X12_00403_210/ns0:N1Loop1/ns0:N1[N103=25]/N104");
<span style="color:Blue; bool found = <span style="color:Blue; false;

<span style="color:Blue; while (xPathReader.Match(0) && !found)
{
...
[/code]
<div style="color:Black;background-color:White; <pre>
<ns0:X12_00403_210 xmlns:ns0=<span style="color:#A31515; " http:<span style="color:Green; //schemas.microsoft.com/BizTalk/EDI/X12/2006 http://schemas.microsoft.com/BizTalk/EDI/X12/2006 <br/><ST><br/><ST01>210</ST01><br/><ST02>000000269</ST02><br/></ST><br/>...<br/><ns0:N1Loop1><br/><ns0:N1><br/><N101>BT</N101><br/><N102>ABC</N102><br/></ns0:N1><br/><ns0:N3><br/><N301>345 INTERNATIONAL DR RM 400</N301><br/></ns0:N3><br/><ns0:N4><br/><N401>OAKVILLE</N401><br/><N402>NE</N402><br/><N403>12345</N403><br/><N404>US</N404><br/></ns0:N4><br/></ns0:N1Loop1><br/><ns0:N1Loop1><br/><ns0:N1><br/><N101>SH</N101><br/><N102>ABC</N102><br/><N103>25</N103><br/><N104>0000V301F1</N104><br/></ns0:N1><br/>...
[/code]


View the full article
 
Back
Top