0

I want to map two fairly large xml documents, one of them using the NIEM schema. I am most familiar with the System.Xml.Linq (XElement) class but have heard good things about using XPath and XNodes, contained in the System.Xml namespace.

Anyone have any pros and cons on the two in terms of mapping?

Meyer Denney
  • 796
  • 1
  • 11
  • 34
  • What exactly is 'mapping' in this context? – H H Sep 21 '11 at 19:33
  • Mapping would be grabbing one element from Document A, e.g. "FirstName" and extracting the value of that element as well as some attribute information, and then inserting the value and attribute(s) into Document B's "FirstName" element. – Meyer Denney Sep 21 '11 at 19:41
  • This can be done very easily with XSLT. Please. provide the DocumentA and DocumentB (but in as minimal form as possible), and I'll be glad to give my answer. – Dimitre Novatchev Sep 22 '11 at 01:37

1 Answers1

0

I think the main issue (as you have large XML documents) is whether you need write access or not. If you're mapping from one file to a new file you can use an XmlReader which gives only forward read only access to the xml document but it is really fast.

I would say however that using XPath is less intuitive than XElement as most programmers are familiar with Linq syntax but not everyone might be familiar with XPath queries.

thekip
  • 3,660
  • 2
  • 21
  • 41
  • I don't believe read/write issues will be too much of a problem. And you are right, I do find Linq easier to use and more intuitive. – Meyer Denney Sep 21 '11 at 23:07