Please see the code and input file first :
In the following code, output i get is "<header href="#ref-3"/>"
but i didn't get what #ref-3 means. Actually I also wanted the content
"<Header id="ref-3" >
<title id="34">Exam title</title>
<description id="67">Exam description</description>
</Header>"
as it is part of "Exam" Node.
I wanted to use this information in different method.
File soap.txt:
<Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Body>
<Exam id="ref-1" >
<header href="#ref-3"/>
</Exam>
<Header id="ref-3" >
<title id="34">Exam title</title>
<description id="67">Exam description</description>
</Header>
</Body>
</Envelope>
Code :
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.ToString();
doc.Load("C:\\soap.txt");
//Display all the book titles.
XmlNodeList elemList = doc.GetElementsByTagName("Exam");
for (int i=0; i < elemList.Count; i++)
{
Console.WriteLine(elemList[i].InnerXml);
}
"Jon Skeet [C# MVP]" wrote:
<"=?Utf-8?B?T21rYXIgU2luZ2g=?=" <Omkar
Si***@discussions.microsoft.com>> wrote: I try to parse a XML document containg some references using XmlDocument
Class' method GetElementbyTagName. It just give the content between starting
tagName and ending tagName but not all refernces used between starting
tagName and ending tagName. Is there any way to achive this?
It's not clear exactly what you mean. Could you give more information,
perhaps with an example XML file and preferrably a short but complete
piece of code too?
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too