ObjectsObjects*
*Contents  *Index  *Topic Contents
*Previous Topic: Reference
*Next Topic: Interfaces

Objects

The following list contains the objects associated with the XML object model.

arrowy.gifXML Document

arrowy.gifXML Element

arrowy.gifElement Collections

XML Document

The object model allows an application to load an XML document and manipulate it. The document can be loaded by specifying a URL moniker or by simply providing a stream. The application can then get several properties of the document, such as URL, mime type, and created/accessed/modified time. The entire XML document is navigated by starting at the root element. In addition, the object model provides for notifications on the addition of immediate children of any given node.

The XML object inherits from the following interfaces:
IUnknown
IDispatch
IXMLDocument
IXMLError
IPersistMoniker
IPersistStream
IPersistStreamInit

The application can use either IPersistMoniker::Load or IPersistStreamInit::Load to load an XML document. It can use IPersistStreamInit::Save to save the XML document to a stream. You can also use IXMLDocument::put_URL.

XML Element

Each XML tag is represented by an object. This object derives from the following interfaces:
IUnknown
IDispatch
IXMLElement

Element Collections

The children of an element are manipulated in this object model by using collections. It is possible to enumerate the members of a collection as well as to access them by index. It is also possible to create a specialized collection of all the elements that have a certain name. Such a specialized collection is then manipulated in an identical fashion.

The XML object derives from the following interfaces:
IDispatch
IXMLElementCollection

A collection of the children of an element's pElem is obtained by using the IXMLElement::get_children method as follows:

IXMLElement *pElem = NULL;
IXMLElementCollection *pChildren = NULL;
    .
    .
    .
hr = pElem->get_children(&pChildren);
if(SUCCEEDED(hr) && pChildren)
{

}

Between calls to IXMLElement::addChild, the client application must call IXMLElementCollection::get_length on the parent collection to ensure that the application has the correct length and can request the correct index to an element when needed.

When it is guaranteed that no further elements will be added as children to this parent node, this API is called with a NULL parameter. It is guaranteed that this sink will be called at least once with a NULL parameter. The sink should then disconnect itself from this connection point when it knows that no further children are being added.


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.