Click here to Skip to main content
16,016,744 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
i ve a xml document which is not in correct order so cant able to use dataset.
i want to read a tag but the tag is repeating in 4 other places with diffrent values



say for eg:
<given name> is a tag and it occurs in 4 place the root tag for this given name is also different.but root tag has so many values in it. so help me out to read xml according to my wish.



kindly suggest me some readings might be basics to read xml. i hope that will be helpful for me

thanks in advance
regards
siv
Posted
Updated 16-Dec-11 1:27am
v2
Comments
Sergey Alexandrovich Kryukov 16-Dec-11 11:09am    
Why the order is important? Yes it might be, but why this is the problem in your case?
Also, why order is different? Was it wrong in first place, when XML was generated?
--SA
resonance_siv 16-Dec-11 11:17am    
the xml is not a well structured one so oly the issue arises and now i got some idea and working on it.

1 solution

The question is not quite clear right now. Please see my comment to the question.
Perhaps all you want is LINQ to XML programming? Then you can use System.Xml.Linq.XDocument; please see below. However, you can always work with any order in XML if this is really needed, no matter what approach you use. Please see my overview of the approaches based on standard .NET libraries:


  1. Use System.Xml.XmlDocument class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^].
  2. Use the class System.Xml.XmlTextReader; this is the fastest way of reading, especially is you need to skip some data.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx[^].
  3. Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^], http://msdn.microsoft.com/en-us/library/bb387063.aspx[^].


Good luck,
—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900