![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#11
| |||
| |||
|
|
These are the declarations at the top of the file: ?xml version="1.0" encoding="UTF-8"? soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" getOrdersForDateRangeResponse xmlns="http://obom/service/FormatB"><FilteredOrders href="#id0" xmlns=""/></getOrdersForDateRangeResponse multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns1829687187:FormatBFilter" xmlns:ns1829687187="http://obom/service/types" xmlns="" ns1829687187:filterId xsi:type="xsd:int">94</ns1829687187:filterId ns1829687187:Orders |
#12
| |||
| |||
|
|
Jonathan Attree wrote: These are the declarations at the top of the file: ?xml version="1.0" encoding="UTF-8"? soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" getOrdersForDateRangeResponse xmlns="http://obom/service/FormatB"><FilteredOrders href="#id0" xmlns=""/></getOrdersForDateRangeResponse multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns1829687187:FormatBFilter" xmlns:ns1829687187="http://obom/service/types" xmlns="" ns1829687187:filterId xsi:type="xsd:int">94</ns1829687187:filterId ns1829687187:Orders XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("file.xml"); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xmlDoc.NameTable); namespaceManager.AddNamespace("ns1829687187", "http://obom/service/types"); foreach (XmlElement part in xmlDoc.SelectNodes("//ns1829687187:Part", namespaceManager)) { Console.WriteLine("href is \"{0}\".", part.GetAttribute("href")); } If you only want to access the first Part element then use SelectSingleNode instead of SelectNodes. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ |
#13
| |||
| |||
|
|
Jonathan Attree wrote: These are the declarations at the top of the file: ?xml version="1.0" encoding="UTF-8"? soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" getOrdersForDateRangeResponse xmlns="http://obom/service/FormatB"><FilteredOrders href="#id0" xmlns=""/></getOrdersForDateRangeResponse multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns1829687187:FormatBFilter" xmlns:ns1829687187="http://obom/service/types" xmlns="" ns1829687187:filterId xsi:type="xsd:int">94</ns1829687187:filterId ns1829687187:Orders XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("file.xml"); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xmlDoc.NameTable); namespaceManager.AddNamespace("ns1829687187", "http://obom/service/types"); foreach (XmlElement part in xmlDoc.SelectNodes("//ns1829687187:Part", namespaceManager)) { Console.WriteLine("href is \"{0}\".", part.GetAttribute("href")); } If you only want to access the first Part element then use SelectSingleNode instead of SelectNodes. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ |
#14
| |||
| |||
|
| "Martin Honnen" wrote: Jonathan Attree wrote: These are the declarations at the top of the file: ?xml version="1.0" encoding="UTF-8"? soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" getOrdersForDateRangeResponse xmlns="http://obom/service/FormatB"><FilteredOrders href="#id0" xmlns=""/></getOrdersForDateRangeResponse multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns1829687187:FormatBFilter" xmlns:ns1829687187="http://obom/service/types" xmlns="" ns1829687187:filterId xsi:type="xsd:int">94</ns1829687187:filterId ns1829687187:Orders XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("file.xml"); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xmlDoc.NameTable); namespaceManager.AddNamespace("ns1829687187", "http://obom/service/types"); foreach (XmlElement part in xmlDoc.SelectNodes("//ns1829687187:Part", namespaceManager)) { Console.WriteLine("href is \"{0}\".", part.GetAttribute("href")); } If you only want to access the first Part element then use SelectSingleNode instead of SelectNodes. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ Hi again Thanks for this. I need to do this in VB and have got this far but am having trouble with For loop: Dim XMLResponseDoc As New XmlDocument Dim nsManager As New XmlNamespaceManager(XMLResponseDoc.NameTable) Dim element As New XmlElement XMLResponseDoc.Load(strXMLResponseFile) nsManager.AddNamespace("ns1829687187", "http://obom/service/types") For Each Next A VB version would be much appreciated. |
#15
| |||
| |||
|
| "Martin Honnen" wrote: Jonathan Attree wrote: These are the declarations at the top of the file: ?xml version="1.0" encoding="UTF-8"? soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" getOrdersForDateRangeResponse xmlns="http://obom/service/FormatB"><FilteredOrders href="#id0" xmlns=""/></getOrdersForDateRangeResponse multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns1829687187:FormatBFilter" xmlns:ns1829687187="http://obom/service/types" xmlns="" ns1829687187:filterId xsi:type="xsd:int">94</ns1829687187:filterId ns1829687187:Orders XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("file.xml"); XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xmlDoc.NameTable); namespaceManager.AddNamespace("ns1829687187", "http://obom/service/types"); foreach (XmlElement part in xmlDoc.SelectNodes("//ns1829687187:Part", namespaceManager)) { Console.WriteLine("href is \"{0}\".", part.GetAttribute("href")); } If you only want to access the first Part element then use SelectSingleNode instead of SelectNodes. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ Hi again Thanks for this. I need to do this in VB and have got this far but am having trouble with For loop: Dim XMLResponseDoc As New XmlDocument Dim nsManager As New XmlNamespaceManager(XMLResponseDoc.NameTable) Dim element As New XmlElement XMLResponseDoc.Load(strXMLResponseFile) nsManager.AddNamespace("ns1829687187", "http://obom/service/types") For Each Next A VB version would be much appreciated. |
#16
| |||
| |||
|
|
Hi again Thanks for this. I need to do this in VB and have got this far but am having trouble with For loop: Dim XMLResponseDoc As New XmlDocument Dim nsManager As New XmlNamespaceManager(XMLResponseDoc.NameTable) Dim element As New XmlElement XMLResponseDoc.Load(strXMLResponseFile) nsManager.AddNamespace("ns1829687187", "http://obom/service/types") For Each Next A VB version would be much appreciated. The syntax for the For loop would be: For Each part As XmlElement In xmlDoc.SelectNodes("//ns1829687187:Part", namespaceManager) Console.WriteLine("href is ""{0}"".", part.GetAttribute("href")) Next -- John Saunders [MVP] |
#17
| |||
| |||
|
|
Hi again Thanks for this. I need to do this in VB and have got this far but am having trouble with For loop: Dim XMLResponseDoc As New XmlDocument Dim nsManager As New XmlNamespaceManager(XMLResponseDoc.NameTable) Dim element As New XmlElement XMLResponseDoc.Load(strXMLResponseFile) nsManager.AddNamespace("ns1829687187", "http://obom/service/types") For Each Next A VB version would be much appreciated. The syntax for the For loop would be: For Each part As XmlElement In xmlDoc.SelectNodes("//ns1829687187:Part", namespaceManager) Console.WriteLine("href is ""{0}"".", part.GetAttribute("href")) Next -- John Saunders [MVP] |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |