#include <xml/dom/xmlengdocument.h>
Link against: xmlenginedom.lib
class RXmlEngDocument : public TXmlEngNode |
Protected Attributes | |
---|---|
RXmlEngDOMImplementation * | iImpl |
Protected Member Functions | |
---|---|
RXmlEngDocument(void *) | |
TXmlEngNode | CopyL() |
void | Remove() |
void | ReplaceWith(TXmlEngNode) |
void | ReplaceWithL(TXmlEngNode) |
TXmlEngNode | SubstituteForL(TXmlEngNode) |
Inherited Attributes | |
---|---|
TXmlEngNode::iInternal |
Inherited Enumerations | |
---|---|
TXmlEngNode:TXmlEngDOMNodeType |
This class represents an XML document in the DOM tree. It stores all nodes and associated information about the XML document.
This class implements the interface. Another class, RXmlEngDOMImplementation, provides the implementation. An instance of RXmlEngDOMImplementation must be constructed and opened first and passed to RXmlEngDocument::OpenL().
IMPORT_C | RXmlEngDocument | ( | ) |
Default constructor. An instance of RXmlEngDocument must be "opened" with one of OpenL() overloads before methods are invoked on the object.
RXmlEngDocument | ( | void * | aInternal | ) | [protected, inline] |
Constructor
Parameters | |
---|---|
aInternal | Document pointer |
IMPORT_C TXmlEngNode | AdoptNodeL | ( | TXmlEngNode | aSource | ) |
Parameters | |
---|---|
aSource | Node that should be added. |
Leave Codes | |
---|---|
KXmlEngErrWrongUseOfAPI | The node has a parent node, the node is already owned by this document, or the node is a document. |
IMPORT_C RXmlEngDocument | CloneDocumentL | ( | ) | const |
Creates a complete copy of the document and transfers ownership to the caller. The caller is required to call Close() on the new document. The new document is independant from this document and this document may be changed or closed without affecting the new document.
Leave Codes | |
---|---|
IMPORT_C void | Close | ( | ) |
Closes document: All owned nodes, child nodes, and namespaces are freed. All data containers on the data container list are freed.
TXmlEngNode | CopyL | ( | ) | const [protected, inline] |
Reimplemented from TXmlEngNode::CopyL()const
DISABLED for document; CloneDocumentL() must be used
IMPORT_C TXmlEngAttr | CreateAttributeL | ( | const TDesC8 & | aName, |
const TDesC8 & | aValue = KNullDesC8 | |||
) |
Creates a new attribute.
aValue should represent the correct value of an attribute if it is put as-is into an XML file (with all characters correctly escaped with entity references when XML spec requires)
The TXmlEngElement class provides a rich set of attribute creation methods, which not only create attributes but also link them into elements.
See also: TXmlEngElement
There is no way to create attributes with namespaces (despite the DOM spec); you have to use one of the TXmlEngElement::AddNewAttributeL(..) methods instead
The returned attribute is the only reference to the allocated memory until you have attached the attribute to some element node.
Parameters | |
---|---|
aName | Name of the atribute; no prefix allowed |
aValue | Value of the attribute (optional) |
Leave Codes | |
---|---|
KXmlEngErrWrongUseOfAPI | No name specified |
IMPORT_C TXmlEngBinaryContainer | CreateBinaryContainerL | ( | const TDesC8 & | aCid, |
const TDesC8 & | aData | |||
) |
Creates a new binary container and copies the specified cid and data into it. A pointer to the container is stored in the document's data container list that can be fetched using GetDataContainerList().
See also: GetDataContainerList( RArray<TXmlEngDataContainer>& aList )
Parameters | |
---|---|
aCid | Content identifier |
aData | Binary octets |
Leave Codes | |
---|---|
IMPORT_C TXmlEngCDATASection | CreateCDATASectionL | ( | const TDesC8 & | aContents = KNullDesC8 | ) |
Parameters | |
---|---|
aContents | CDATASection content |
Leave Codes | |
---|---|
IMPORT_C TXmlEngChunkContainer | CreateChunkContainerL | ( | const TDesC8 & | aCid, |
const RChunk & | aChunk, | |||
const TInt | aChunkOffset, | |||
const TInt | aDataSize | |||
) |
Creates a new chunk container and copies the specified cid into it. A reference to a memory chunk is stored in the container. The memory chunk must stay in scope for the lifetime of the container. A pointer to the container is stored in the document's data container list that can be fetched using GetDataContainerList().
See also: GetDataContainerList( RArray<TXmlEngDataContainer>& aList )
Parameters | |
---|---|
aCid | Content identifier |
aChunk | RChunk reference |
aChunkOffset | Offset to the binary data in aChunk |
aDataSize | Size of binary data in aChunk |
Leave Codes | |
---|---|
IMPORT_C TXmlEngComment | CreateCommentL | ( | const TDesC8 & | aText = KNullDesC8 | ) |
Parameters | |
---|---|
aText | New comment |
Leave Codes | |
---|---|
IMPORT_C TXmlEngElement | CreateDocumentElementL | ( | const TDesC8 & | aName, |
const TDesC8 & | aNamespaceUri = KNullDesC8, | |||
const TDesC8 & | aPrefix = KNullDesC8 | |||
) |
Creates a new element from a specific namespace to be the root of the document tree. Any existing document element of the document is destroyed.
Parameters | |
---|---|
aName | Element name |
aNamespaceUri | Element namespace URI |
aPrefix | Element namemespace prefix |
Leave Codes | |
---|---|
KXmlEngErrWrongUseOfAPI | No name has been specified |
IMPORT_C TXmlEngDocumentFragment | CreateDocumentFragmentL | ( | ) |
Leave Codes | |
---|---|
IMPORT_C TXmlEngElement | CreateElementL | ( | const TDesC8 & | aLocalName, |
const TDesC8 & | aNamespaceUri = KNullDesC8, | |||
const TDesC8 & | aPrefix = KNullDesC8 | |||
) |
Creates a new element node that belongs to the specific namespace. A namespace declaration node is created on the element.
If the provided namespace uri is NULL, the element will be created without namespace.
Parameters | |
---|---|
aLocalName | Local name of the element |
aNamespaceUri | Namespace of new element |
aPrefix | Prefix to use for the namespace binding and the QName of the element |
Leave Codes | |
---|---|
KXmlEngErrWrongUseOfAPI | No name specified |
IMPORT_C TXmlEngEntityReference | CreateEntityReferenceL | ( | const TDesC8 & | aEntityRef | ) |
Creates a new entity reference node and copies the specified string into it.
Note: < , > , ' , " and other predefined entity references should not be created with this method. These entity references are rather "character references" and are encoded/decoded automatically.
Parameters | |
---|---|
aEntityRef | is a string in one of these forms:name&namewhere name is the name of the entity |
Leave Codes | |
---|---|
KXmlEngErrWrongUseOfAPI | No entity specified |
IMPORT_C TXmlEngFileContainer | CreateFileContainerL | ( | const TDesC8 & | aCid, |
const RFile & | aFile | |||
) |
Creates a new file container and copies the specified cid into it. A reference to a file is stored in the container. aFile must stay in scope of the lifetime of the container. A pointer to the container is stored in the document's data container list that can be fetched using GetDataContainerList().
See also: GetDataContainerList( RArray<TXmlEngDataContainer>& aList )
Parameters | |
---|---|
aCid | Content identifier |
aFile | The file to reference |
Leave Codes | |
---|---|
IMPORT_C TXmlEngProcessingInstruction | CreateProcessingInstructionL | ( | const TDesC8 & | aTarget, |
const TDesC8 & | aData = KNullDesC8 | |||
) |
Creates a new processing instruction node and copies "target" and "data" into it.
Parameters | |
---|---|
aTarget | Target |
aData | Data |
Leave Codes | |
---|---|
KXmlEngErrWrongUseOfAPI | No target specified |
IMPORT_C TXmlEngTextNode | CreateTextNodeL | ( | const TDesC8 & | aCharacters = KNullDesC8 | ) |
Parameters | |
---|---|
aCharacters | Text node content |
Leave Codes | |
---|---|
IMPORT_C TXmlEngElement | DocumentElement | ( | ) | const |
Get the document element
IMPORT_C TPtrC8 | DocumentUri | ( | ) | const |
Retrieves base URI (if defined) of the document
IMPORT_C TXmlEngElement | FindElementByXmlIdL | ( | const TDesC8 & | aValue | ) | const |
Parameters | |
---|---|
aValue | Name of attribute |
Leave Codes | |
---|---|
IMPORT_C TInt | GetDataContainerList | ( | RArray< TXmlEngDataContainer > & | aList | ) |
Retrieves an array of data containers owned by this document.
Note: The document ceases to be the owner of a data container when the data container (or one of its predecessors) is removed from the document or becomes part of another document. Unlinking a data container (or one of its predecessors) doesn't remove ownership of the data container from this document so the list might contain containers that are not linked to this document anymore.
Parameters | |
---|---|
aList | Array of data containers |
IMPORT_C RXmlEngDOMImplementation | Implementation | ( | ) | const |
Get the DOM implementation. Ownership is not transferred. Any operation on the returned object will affect this document directly, in particular, a call to RXmlEngDOMImplementation::Close() will cause further operations on this document to fail.
IMPORT_C TBool | IsStandalone | ( | ) | const |
Check if document is standalone
IMPORT_C void | OpenL | ( | RXmlEngDOMImplementation & | aDOMImpl | ) |
Parameters | |
---|---|
aDOMImpl | An opened DOM implementation object |
Leave Codes | |
---|---|
IMPORT_C void | OpenL | ( | RXmlEngDOMImplementation & | aDOMImpl, |
void * | aInternal | |||
) |
Opens the document, initializing it with the internal state pointer from another RXmlEngDocument. This document becomes an alias for the document whose state is represented by aInternal and a change in either document will be reflected in the other. Close() need only be called once, however, it is not an error to call Close() on each RXmlEngDocument.
Parameters | |
---|---|
aDOMImpl | An opened DOM implementation object |
aInternal | The internal document state to initialize this object with |
Leave Codes | |
---|---|
IMPORT_C void | OpenL | ( | RXmlEngDOMImplementation & | aDOMImpl, |
TXmlEngElement | aRoot | |||
) |
Opens the document and adds aRoot as the root of the DOM tree. If aRoot is currently part of another document, it will be unlinked. Ownership is transferred to this document.
Parameters | |
---|---|
aDOMImpl | An opened DOM implementation object |
aRoot | The element that will be the root of the DOM tree |
Leave Codes | |
---|---|
IMPORT_C void | RegisterXmlIdL | ( | TXmlEngElement | aStartElement, |
const TDesC8 & | aLocalName, | |||
const TDesC8 & | aNamespaceUri = KNullDesC8 | |||
) |
Sets the specified attribute as a xml:id attribute, starting at aStartElement and recursing through the subtree. To set the specified attribute as a xml:id attribute for the entire DOM tree, see RegisterXmlId(const TDesC8&,const TDesC8&).
Parameters | |
---|---|
aStartElement | Root of the subtree to recurse |
aLocalName | Name of the attribute |
aNamespaceUri | Namespace of the new element (default empty) |
Leave Codes | |
---|---|
KXmlEngErrWrongUseOfAPI | The starting element is NULL, the attribute name is not specified, the starting element is the document, or the starting element does not belong to a document. |
KErrAlreadyExists | The attribute is already set to be xml:id |
Sets the specified attribute as a xml:id attribute, recursing through the entire DOM tree. In order to specify a subtree only, see RegisterXmlId(TXmlEngElement,const TDesC8,const TDesC8).
Parameters | |
---|---|
aLocalName | Name of attribute |
aNamespaceUri | Namespace of new element (default empty) |
Leave Codes | |
---|---|
KXmlEngErrWrongUseOfAPI | The document is NULL |
KErrAlreadyExists | The attribute is already set to be xml:id |
void | Remove | ( | ) | [protected, inline] |
Reimplemented from TXmlEngNode::Remove()
DISABLED for document; Close() must be used
void | ReplaceWith | ( | TXmlEngNode | aNode | ) | [protected, inline] |
Reimplemented from TXmlEngNode::ReplaceWith(TXmlEngNode)
DISABLED for document; Close() must be used
void | ReplaceWithL | ( | TXmlEngNode | aNode | ) | [protected, inline] |
Reimplemented from TXmlEngNode::ReplaceWithL(TXmlEngNode)
This node is replaced with another node (or subtree). The replacement node is linked into the document tree instead of this node. The replaced node is destroyed. Replacement of a node with a NULL TXmlEngNode is legal and equivalent to removing the node.
aNode is unlinked from its previous location, which can be none (i.e. not linked), within the same document tree, or within another document tree.
Note: Not applicable to document nodes.
See also: SubstituteForL(TXmlEngNode)
Parameters | |
---|---|
aNode | Node that replaces this node |
Leave Codes | |
---|---|
KXmlEngErrNullNode | Node is NULL |
KXmlEngErrWrongUseOfAPI | Node is a document node |
IMPORT_C TInt | SaveL | ( | const TDesC & | aFileName, |
TXmlEngNode | aRoot = TXmlEngNode(), | |||
const TXmlEngSerializationOptions & | aSaveOptions = TXmlEngSerializationOptions() | |||
) | const |
Serializes document tree into a file. For nodes containing binary data in the form of BinaryDataContainer, FileContainer or ChunkContainer, the client can implement custom serialization by implementing the MXmlEngDataSerializer interface and saving a pointer to the customer serializer in the iDataSerializer member of the aSaveOptions parameter. If no custom serialization is specified, the binary data container nodes are serialized like text nodes.
If no aRoot is provided, the entire DOM tree is serialized. aRoot does not need to be owned by this document.
Parameters | |
---|---|
aFileName | A file name (with path) |
aRoot | Root node to be serialized |
aSaveOptions | Options that control how serialization is performed |
Leave Codes | |
---|---|
KXmlEngErrWrongEncoding | Encoding not understood |
KXmlEngErrWrongUseOfAPI | Document is NULL |
KXmlEngErrNegativeOutputSize | The data to be serialized has a negative size |
IMPORT_C TInt | SaveL | ( | RFs & | aRFs, |
const TDesC & | aFileName, | |||
TXmlEngNode | aRoot = TXmlEngNode(), | |||
const TXmlEngSerializationOptions & | aSaveOptions = TXmlEngSerializationOptions() | |||
) | const |
Serializes document tree into a file. For nodes containing binary data in the form of BinaryDataContainer, FileContainer or ChunkContainer, the client can implement custom serialization by implementing the MXmlEngDataSerializer interface and saving a pointer to the customer serializer in the iDataSerializer member of the aSaveOptions parameter. If no custom serialization is specified, the binary data container nodes are serialized like text nodes.
If no aRoot is provided, the entire DOM tree is serialized. aRoot does not need to be owned by this document.
Parameters | |
---|---|
aRFs | An open file Server session |
aFileName | A file name (with path) |
aRoot | Root node to be serialized |
aSaveOptions | Options that control how serialization is performed |
Leave Codes | |
---|---|
KXmlEngErrWrongEncoding | Encoding not understood |
KXmlEngErrWrongUseOfAPI | Document is NULL |
KXmlEngErrNegativeOutputSize | The data to be serialized has a negative size |
IMPORT_C TInt | SaveL | ( | MXmlEngOutputStream & | aStream, |
TXmlEngNode | aRoot = TXmlEngNode(), | |||
const TXmlEngSerializationOptions & | aSaveOptions = TXmlEngSerializationOptions() | |||
) | const |
Serializes document tree into provided output stream, which supports progressive writing of data. For nodes containing binary data in the form of BinaryDataContainer, FileContainer or ChunkContainer, the client can implement custom serialization by implementing the MXmlEngDataSerializer interface and saving a pointer to the customer serializer in the iDataSerializer member of the aSaveOptions parameter. If no custom serialization is specified, the binary data container nodes are serialized like text nodes.
If no aRoot is provided, the entire DOM tree is serialized. aRoot does not need to be owned by this document.
Parameters | |
---|---|
aStream | An output stream to write the serialized DOM tree |
aRoot | Root node to be serialized |
aSaveOptions | Options that control how serialization is performed |
Leave Codes | |
---|---|
KXmlEngErrWrongEncoding | Encoding not understood |
KXmlEngErrWrongUseOfAPI | Document is NULL |
KXmlEngErrNegativeOutputSize | The data to be serialized has a negative size |
IMPORT_C TInt | SaveL | ( | RBuf8 & | aBuffer, |
TXmlEngNode | aRoot = TXmlEngNode(), | |||
const TXmlEngSerializationOptions & | aSaveOptions = TXmlEngSerializationOptions() | |||
) | const |
Saves document tree into memory buffer.
Any existing contents in aBuffer will be deleted. The memory required for aBuffer will be allocated by this method. The method caller must Close() aBuffer.
If no aRoot is provided, the entire DOM tree is serialized. aRoot does not need to be owned by this document.
Parameters | |
---|---|
aBuffer | Resulting buffer |
aRoot | The root of the subtree to serialize |
aSaveOptions | Options that control how serialization is performed |
Leave Codes | |
---|---|
KXmlEngErrWrongEncoding | Encoding not understood |
KXmlEngErrWrongUseOfAPI | Document is NULL |
KXmlEngErrNegativeOutputSize | The data to be serialized has a negative size |
IMPORT_C void | SetDocumentElement | ( | TXmlEngElement | aNewDocElement | ) |
Replaces (and destroys) the document element.
Note: Use TXmlEngElement::ReconcileNamespacesL() on the new document element if it or its descendants can contain references to namespace declarations outside of the element.
See also: TXmlEngElement::ReconcileNamespacesL()
Parameters | |
---|---|
aNewDocElement | New document element |
IMPORT_C void | SetDocumentUriL | ( | const TDesC8 & | aUri | ) |
Parameters | |
---|---|
aUri | Document URI |
Leave Codes | |
---|---|
IMPORT_C void | SetStandalone | ( | TBool | aStandalone | ) |
Sets "standalone" attribute of XML declaration for the document
Parameters | |
---|---|
aStandalone | Is the document standalone |
IMPORT_C void | SetXmlVersionL | ( | const TDesC8 & | aVersion | ) |
Parameters | |
---|---|
aVersion | Version string |
Leave Codes | |
---|---|
TXmlEngNode | SubstituteForL | ( | TXmlEngNode | aNode | ) | [protected, inline] |
Reimplemented from TXmlEngNode::SubstituteForL(TXmlEngNode)
DISABLED for document; Close() must be used
IMPORT_C TPtrC8 | XmlEncoding | ( | ) | const |
Get document encoding.
IMPORT_C TPtrC8 | XmlVersion | ( | ) | const |
Get xml version