XPath & XML EDI B2B
- by PearlFactory
GoodToGo :)
Best XML Editor is Altova XMLSpy 2011
http://www.torrenthound.com/hash/bfdbf55baa4ca6f8e93464c9a42cbd66450bb950/torrent-info/Altova-XMLSpy-Enterprise-Edition-SP1-2011-v13-0-1-0-h33t-com-Full
For whatever reason Piratebay has trojans and other nasties..Search in torrent.eu for
Altova XMLSpy Enterprise Edition SP1 2011 v13.0.1.0 Also if you like the product purchase it in a Commercial Enviroment
Any well structured/complex XML can be parsed @ the speed of light using XPATH querys and not the C# objects
XPathNodeIterator and others etc ....Never do loops or Genirics or whatever highlevel language technology. Use the power of XPATH
i.e Will use a Simple (Do while) as an example. We could have many different techs all achieveing the same result
Instead of
xmlNI2 = xmlNav.Select("/p:BookShop")
if (xmlNI2.Count != 0)
{
while ((xmlNI2.MoveNext()))
string aNode =xmlNI2.SelectSingleNode('Book', nsmgr);
if (aNode =="The Book I am after")
Console.WriteLine("Found My Book);
This lengthy cumbersome task can be achieved with a simple XPATH query
Console.WriteLine((xmlNavg.SelectSingleNode("/p:BookShop/Book[.='The Book I am aFter ']", nsmgr)).Value.ToString());
Use the power of the parser and eliminate the middleman C#/MSIL/JIT etc etc
Get Started Fast and use the parser as Outlined
1) Open XML and goto Grid Mode
2) Select XPATH tab on the bottom viewer/window as shown
From here you get intellisense and can quickly learn how to navigate/find the data using XPATH
A key component to Navigation with XPATH is to use the "../ " command . This basically says from where I am now go up 1 level . With Xpath all commands are cumalative. i.e you can search for a book title @ the 2nd level of the XML and from there traverse 15 layers to paragraphs or words on a page with expression validation occuring throughout this process etc
(So in essence you may have arrived @ a node within the XML and have met 15 conditions along the way )
Given 1-2 days with XmlSpy and XPATH you unlock a technology that is super fast and simple to use.
XML is a core component to what lays under the hood of so many techs. So it is no wonder that you want to be able to goto the atomic level to achieve the result you want
Justin
P.S For a long time I saw XML as slow and a bit boring but now converted