Working with xml data

258 views
202 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
258
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Working with xml data

  1. 1.  Document Object Model (DOM) provide standards that define the structure and a standard programming interface that can be used in a wide variety of environments and applications for XML documents. Classes that support the DOM are typically capable of random access navigation and modification of the XML document. The XML classes are accessible by setting a reference to the System.Xml.dll file. The System.Data.dll file also extends the System.Xml namespace.
  2. 2.  XmlDocument XmlDataDocument XPathDocument XmlConvert XPathNavigator XmlNodeReader XmlTextReader XmlTextWriter XmlReader XslTransform
  3. 3.  The XML Classes Creating a New XmlDocument from Scratch Parsing XmlDocuments (using DOM and XPathNavigator) Searching the XmlDocument (using DOM and XPathNavigator) Writing an XML File Using the XmlTextWriter Reading an XML File Using the XmlTextReader Modifying an XML Document Validating XML Documents Using LINQ to XML
  4. 4.  LINQ to XML is a LINQ-enabled, in-memory XML programming interface that enables you to work with XML from within the .NET Framework programming languages. LINQ to XML is like the Document Object Model (DOM) in that it brings the XML document into memory. You can query and modify the document, and after you modify it you can save it to a file or serialize it and send it over the Internet. However, LINQ to XML differs from DOM: It provides a new object model that is lighter weight and easier to work with, and that takes advantage of language improvements in Visual C# 2008.
  5. 5.  The most important advantage of LINQ to XML is its integration with Language-Integrated Query (LINQ). This integration enables you to write queries on the in-memory XML document to retrieve collections of elements and attributes. The query capability of LINQ to XML is comparable in functionality (although not in syntax) to XPath and XQuery. The integration of LINQ in Visual C# 2008 provides stronger typing, compile-time checking, and improved debugger support. Another advantage of LINQ to XML is the ability to use query results as parameters to XElement and XAttribute object constructors enables a powerful approach to creating XML trees. This approach, called functional construction, enables developers to easily transform XML trees from one shape to another.
  6. 6. IEnumerable<XElement> partNos = from item inpurchaseOrder.Descendants("Item") where (int)item.Element("Quantity") * (decimal)item.Element("USPrice") > 100 orderby(string)item.Element("PartNumber") select item;

×