Friday, August 31, 2007

XML


The XmlDocument class gives you the ability to load an Xml file. The class implements the DOM, which is an in-memory (cache) tree representation of an XML document, which allows you to navigate and edit the document.

The XmlDocument inherits from the XmlNode class, as seen in the class browser. The XmlNode class in reality provides much of the underlying functionality since it is the base class in the .NET implementation of the DOM.

So the XmlNode represents a single node in the Xml, while the XmlDocument extends the XmlNode class to represent an entire Xml Document (hence the name, XmlDocument).

Once the Xml file is loaded, you can also locate the root node of the document.

DOM

The W3C Document Object Model (DOM) is a platform and language neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."

The W3C DOM provides a standard set of objects for representing HTML and XML documents, and a standard interface for accessing and manipulating them.

The DOM is separated into different parts (Core, XML, and HTML) and different levels (DOM Level 1/2/3):

Core DOM - defines a standard set of objects for any structured document
XML DOM - defines a standard set of objects for XML documents
HTML DOM - defines a standard set of objects for HTML documents

What is the XML DOM?
The XML DOM is the Document Object Model for XML
The XML DOM is platform and language independent
The XML DOM defines a standard set of objects for XML, and a standard way to access and manipulate XML documents
The XML DOM is a W3C standard.
The XML DOM views XML documents as a tree structure of elements embedded within other elements. All elements, their containing text and their attributes, can be accessed through the DOM tree. Their contents can be modified or deleted, and new elements can be created by the DOM. The elements, their text, and their attributes are all known as nodes.

The Document Object Model (DOM) class is an in-memory representation of an XML document. The DOM allows you to programmatically read, manipulate, and modify an XML document. The XmlReader class also reads XML, however it provides non-cached, forward-only, read-only access. This means that there are no capabilities to edit the values of an attribute or content of an element, or the ability to insert and remove nodes with the XmlReader. Editing is the primary function of the DOM. It is the common and structured way that XML data is represented in memory, although the actual XML data is stored in a linear fashion when in a file or coming in from another object. The following is XML data.

The XmlNode object is the basic object in the DOM tree. The XmlDocument class, which extends XmlNode, supports methods for performing operations on the document as a whole, for instance, loading it into memory or saving the XML to a file. In addition, XmlDocument provides a means to view and manipulate the nodes in the entire XML document. Both XmlNode and XmlDocument have performance and usability enhancements, and have methods and properties to:

Access and modify nodes specific to DOM, such as element nodes, entity reference nodes, and so on.
Retrieve entire nodes, in addition to the information the node contains, such as the text in an element node.

0 comments;Click here for request info on this topic:

Post a Comment