Francis

Francis

  • NA
  • 5
  • 0

XML Parsing (Avoiding Duplicate Tags)

Apr 29 2010 10:04 AM
Hello,

I am attempting to write some C# code that will parse an XML based on my conditions and certain tags. I have utilized XPATH to find the specific nodes and put them in a NodeList, however I will also have to create some code that will avoid copying down more than one element/tag for each entity. I will then takes this new Lists and create a new nodes/XML doc based on the values I've got.

Although the XML I am parsing is much more messy and larger than this, for Example, I would only want to find the 1st Year and 1st Brand of each cleat, thus making years captured: 2004 & 2010 and Brands: Adidas & Nike.

<Closet>
<Cleat>
<Year>2004</Year>
<Brand>Adidas</Brand>
</Cleat>

<Cleat>
<Year>2010</Year>
<Brand>Nike</Brand>
<Brand>NIGH-KEE</Brand>
</Cleat>
</Closet>

It is possible to achieve this?  I've read some references towards XSLT, but doesn't that only do html/website displays?

Thank You in advance


Answers (2)