HighTechTalks DotNet Forums  

Extracting hyperlink data from XML file

Dotnet XML microsoft.public.dotnet.xml


Discuss Extracting hyperlink data from XML file in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old   
Martin Honnen
 
Posts: n/a

Default Re: Extracting hyperlink data from XML file - 07-30-2007 , 10:31 AM






Jonathan Attree wrote:

Quote:
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/


Reply With Quote
  #12  
Old   
=?Utf-8?B?Sm9uYXRoYW4gQXR0cmVl?=
 
Posts: n/a

Default Re: Extracting hyperlink data from XML file - 08-17-2007 , 07:30 AM








"Martin Honnen" wrote:

Quote:
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.

Thanks
Jonathan Attree


Reply With Quote
  #13  
Old   
=?Utf-8?B?Sm9uYXRoYW4gQXR0cmVl?=
 
Posts: n/a

Default Re: Extracting hyperlink data from XML file - 08-17-2007 , 07:30 AM





"Martin Honnen" wrote:

Quote:
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.

Thanks
Jonathan Attree


Reply With Quote
  #14  
Old   
John Saunders [MVP]
 
Posts: n/a

Default Re: Extracting hyperlink data from XML file - 08-17-2007 , 09:40 PM



"Jonathan Attree" <JonathanAttree (AT) discussions (DOT) microsoft.com> wrote in
message news:9A5801CD-A42E-4369-A2EC-F01435CB9534 (AT) microsoft (DOT) com...
Quote:

"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.
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]



Reply With Quote
  #15  
Old   
John Saunders [MVP]
 
Posts: n/a

Default Re: Extracting hyperlink data from XML file - 08-17-2007 , 09:40 PM



"Jonathan Attree" <JonathanAttree (AT) discussions (DOT) microsoft.com> wrote in
message news:9A5801CD-A42E-4369-A2EC-F01435CB9534 (AT) microsoft (DOT) com...
Quote:

"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.
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]



Reply With Quote
  #16  
Old   
=?Utf-8?B?Sm9uYXRoYW4gQXR0cmVl?=
 
Posts: n/a

Default Re: Extracting hyperlink data from XML file - 08-20-2007 , 10:32 AM



Quote:
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]


Thanks very much.

JOnathan Attree


Reply With Quote
  #17  
Old   
=?Utf-8?B?Sm9uYXRoYW4gQXR0cmVl?=
 
Posts: n/a

Default Re: Extracting hyperlink data from XML file - 08-20-2007 , 10:32 AM



Quote:
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]


Thanks very much.

JOnathan Attree


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.