Unicorn XML Toolkit
Version 1.00.00

Namespace Dom
Class IDocument

class IDocument: virtual public INode {
public:
    IDocument();
    virtual ~IDocument();
public:
    virtual XDocumentType GetDoctype() = 0;
    virtual XDomImplementation GetImplementation() = 0;
    virtual XElement GetDocumentElement() = 0;
public:
    virtual XElement CreateElement(const CString &strTagName) = 0;
    virtual XDocumentFragment CreateDocumentFragment() = 0;
    virtual XText CreateTextNode(const CString &strData) = 0;
    virtual XComment CreateComment(const CString &strData) = 0;
    virtual XCdataSection CreateCdataSection(
        const CString &strData) = 0;
    virtual XProcessingInstruction CreateProcessingInstruction(
        const CString &strTarget, 
        const CString &strData) = 0;
    virtual XAttr CreateAttribute(const CString &strName) = 0;
    virtual XEntityReference CreateEntityReference(
        const CString &strName) = 0;
    virtual XNodeList GetElementsByTagName(
        const CString &strTagName) = 0;
    virtual XNamespace CreateNamespace(const CString &strName) = 0;
    };

The entire XML document.

This class implements the C++ binding for the Document interface specified by DOM.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
INodeList, IDomImplementation, IDocumentFragment, IAttr, IElement, IText, IComment, IDoctype, INode, IEntityReference, IProcessingInstruction, INamespace
Constructor/Destructor Summary
IDocument ();
����������Constructs the document.
~IDocument ();
����������Destroys the document.

Function Summary
XDocumentType GetDoctype ();
����������Returns the document type object associated with this document.
XDomImplementation GetImplementation ();
����������Returns the DOM implementation object associated with this document.
XElement GetDocumentElement ();
����������Returns the document element of this document.
XElement CreateElement (const CString &strTagName);
����������Creates a new element with the tag name specified by strTagName .
XDocumentFragment CreateDocumentFragment ();
����������Creates a document fragment.
XText CreateTextNode (const CString &strData);
����������Creates a new text node with the content specified by strData .
XComment CreateComment (const CString &strData);
����������Creates a new comment with the content specified by strData .
XCdataSection CreateCdataSection (const CString &strData);
����������Creates a new CDATA section with the content specified by strData .
XProcessingInstruction CreateProcessingInstruction (const CString &strTarget, const CString &strData);
����������Creates a new processing instruction with the target specified by strTarget and the data specified by strData .
XAttr CreateAttribute (const CString &strName);
����������Creates a new attribute with the name specified by strName .
XEntityReference CreateEntityReference (const CString &strName);
����������Creates a new entity reference with the name specified by strName .
XNodeList GetElementsByTagName (const CString &strTagName);
����������Returns the list of all elements having the tag name specified by strTagName .
XNamespace CreateNamespace (const CString &strName);
����������Creates a new namespace node with the namespace prefix specified by strName .

Constructor/Destructor Detail

IDocument

IDocument();

Constructs the document.

~IDocument

virtual ~IDocument();

Destroys the document.

Function Detail

GetDoctype

virtual XDocumentType GetDoctype() = 0;

Returns the document type object associated with this document.

This method implements the C++ binding for the doctype attribute specified by DOM.

Returns:
the document type object associated with this document, or NULL if the document type is not available

GetImplementation

virtual XDomImplementation GetImplementation() = 0;

Returns the DOM implementation object associated with this document.

This method implements the C++ binding for the implementation attribute specified by DOM.

Returns:
the DOM implementation object associated with this document

GetDocumentElement

virtual XElement GetDocumentElement() = 0;

Returns the document element of this document.

This method implements the C++ binding for the documentElement attribute specified by DOM.

Returns:
the document element of this document, or NULL if the document element is not yet available (for example, when the document is under construction)

CreateElement

virtual XElement CreateElement(const CString &strTagName) = 0;

Creates a new element with the tag name specified by strTagName .

This method implements the C++ binding for the createElement operation specified by DOM.

Parameters:
strTagName - the element tag name
Returns:
the newly created element

CreateDocumentFragment

virtual XDocumentFragment CreateDocumentFragment() = 0;

Creates a document fragment.

This method implements the C++ binding for the createDocumentFragment operation specified by DOM.

Returns:
the newly created document fragment

CreateTextNode

virtual XText CreateTextNode(const CString &strData) = 0;

Creates a new text node with the content specified by strData .

This method implements the C++ binding for the createTextNode operation specified by DOM.

Parameters:
strData - the content of the text node
Returns:
the newly created text node

CreateComment

virtual XComment CreateComment(const CString &strData) = 0;

Creates a new comment with the content specified by strData .

This method implements the C++ binding for the createComment operation specified by DOM.

Parameters:
strData - the content of the comment
Returns:
the newly created comment

CreateCdataSection

virtual XCdataSection CreateCdataSection(
    const CString &strData) = 0;

Creates a new CDATA section with the content specified by strData .

This method implements the C++ binding for the createCDATASection operation specified by DOM.

Parameters:
strData - the content of the CDATA section
Returns:
the newly created CDATA section

CreateProcessingInstruction

virtual XProcessingInstruction CreateProcessingInstruction(
    const CString &strTarget, 
    const CString &strData) = 0;

Creates a new processing instruction with the target specified by strTarget and the data specified by strData .

This method implements the C++ binding for the createProcessingInstruction operation specified by DOM.

Parameters:
strTarget - the processing instruction target
strData - the processing instruction data (empty string if no data required)
Returns:
the newly created processing instruction

CreateAttribute

virtual XAttr CreateAttribute(const CString &strName) = 0;

Creates a new attribute with the name specified by strName .

This method implements the C++ binding for the createAttribute operation specified by DOM.

Parameters:
strName - the attribute name
Returns:
the newly created attribute

CreateEntityReference

virtual XEntityReference CreateEntityReference(
    const CString &strName) = 0;

Creates a new entity reference with the name specified by strName .

This method implements the C++ binding for the createEntityReference operation specified by DOM.

Parameters:
strName - the entity reference name
Returns:
the newly created entity reference

GetElementsByTagName

virtual XNodeList GetElementsByTagName(
    const CString &strTagName) = 0;

Returns the list of all elements having the tag name specified by strTagName .

This method implements the C++ binding for the getElementsByTagName operation specified by DOM.

Parameters:
strTagName - the element tag name, or the special value of "*" to select all document elements
Returns:
the list of selected elements, in order established by the preorder traversal of the document tree

CreateNamespace

virtual XNamespace CreateNamespace(const CString &strName) = 0;

Creates a new namespace node with the namespace prefix specified by strName .

This extension XDM method has no direct equivalent in DOM. It is applicable only if this document supports XDM extensions.

strName - the namespace prefix
the newly created namespace node

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.