epoc32/include/xml/dom/xmlengdocument.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     2
// All rights reserved.
williamr@4
     3
// This component and the accompanying materials are made available
williamr@4
     4
// under the terms of "Eclipse Public License v1.0"
williamr@4
     5
// which accompanies this distribution, and is available
williamr@4
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     7
//
williamr@4
     8
// Initial Contributors:
williamr@4
     9
// Nokia Corporation - initial contribution.
williamr@4
    10
//
williamr@4
    11
// Contributors:
williamr@4
    12
//
williamr@4
    13
// Description:
williamr@4
    14
// Document node functions
williamr@4
    15
//
williamr@4
    16
williamr@4
    17
williamr@4
    18
williamr@4
    19
/**
williamr@4
    20
 @file
williamr@4
    21
 @publishedAll
williamr@4
    22
 @released
williamr@2
    23
*/
williamr@4
    24
#ifndef XMLENGDOCUMENT_H
williamr@4
    25
#define XMLENGDOCUMENT_H
williamr@2
    26
williamr@2
    27
#include <f32file.h> 
williamr@2
    28
williamr@4
    29
#include <xml/dom/xmlengnode.h>
williamr@4
    30
#include <xml/dom/xmlengserializationoptions.h>
williamr@2
    31
williamr@2
    32
class RXmlEngDOMImplementation;
williamr@2
    33
williamr@2
    34
/**
williamr@4
    35
This class represents an XML document in the DOM tree.  It stores all nodes 
williamr@4
    36
and associated information about the XML document.  
williamr@4
    37
williamr@4
    38
This class implements the interface.  Another class, RXmlEngDOMImplementation,
williamr@4
    39
provides the implementation.  An instance of RXmlEngDOMImplementation must be
williamr@4
    40
constructed and opened first and passed to RXmlEngDocument::OpenL().
williamr@4
    41
*/
williamr@2
    42
class RXmlEngDocument : public TXmlEngNode
williamr@2
    43
{
williamr@2
    44
public:    
williamr@4
    45
    /** 
williamr@4
    46
	Default constructor.  An instance of RXmlEngDocument must be "opened" with
williamr@4
    47
	one of OpenL() overloads before methods are invoked on the object.
williamr@4
    48
	*/
williamr@2
    49
    IMPORT_C RXmlEngDocument();
williamr@2
    50
    
williamr@2
    51
    /** 
williamr@4
    52
    Opens the document.
williamr@4
    53
	@param aDOMImpl An opened DOM implementation object
williamr@4
    54
	@leave - One of the system-wide error codes
williamr@4
    55
    */
williamr@2
    56
    IMPORT_C void OpenL(RXmlEngDOMImplementation& aDOMImpl);
williamr@2
    57
	
williamr@2
    58
	/** 
williamr@4
    59
	Opens the document, initializing it with the internal state pointer from
williamr@4
    60
	another RXmlEngDocument.  This document becomes an alias for the document
williamr@4
    61
	whose state is represented by aInternal and a change in either document
williamr@4
    62
	will be reflected in the other.  Close() need only be called once, however,
williamr@4
    63
	it is not an error to call Close() on each RXmlEngDocument.
williamr@4
    64
williamr@4
    65
	@param aDOMImpl An opened DOM implementation object
williamr@4
    66
 	@param aInternal The internal document state to initialize this object with
williamr@4
    67
	@leave - One of the system-wide error codes
williamr@4
    68
    */
williamr@2
    69
    IMPORT_C void OpenL(RXmlEngDOMImplementation& aDOMImpl, void* aInternal);
williamr@2
    70
    
williamr@4
    71
	/** 
williamr@4
    72
	Opens the document and adds aRoot as the root of the DOM tree.  If aRoot is
williamr@4
    73
	currently part of another document, it will be unlinked.  Ownership is
williamr@4
    74
	transferred to this document.
williamr@4
    75
williamr@4
    76
	@param aDOMImpl An opened DOM implementation object
williamr@4
    77
 	@param aRoot The element that will be the root of the DOM tree
williamr@4
    78
	@leave - One of the system-wide error codes
williamr@4
    79
    */
williamr@2
    80
    IMPORT_C void OpenL(RXmlEngDOMImplementation& aDOMImpl, TXmlEngElement aRoot);
williamr@2
    81
    
williamr@4
    82
    /** 
williamr@4
    83
	Closes document:  All owned nodes, child nodes, and namespaces are freed.  All
williamr@4
    84
	data containers on the data container list are freed.
williamr@4
    85
	*/
williamr@2
    86
    IMPORT_C  void Close();
williamr@2
    87
williamr@4
    88
	/**
williamr@4
    89
	Serializes document tree into a file.  For nodes containing binary data in
williamr@4
    90
	the form of BinaryDataContainer, FileContainer or ChunkContainer, the
williamr@4
    91
	client can implement custom serialization by implementing the
williamr@4
    92
	MXmlEngDataSerializer interface and saving a pointer to the customer
williamr@4
    93
	serializer in the iDataSerializer member of the aSaveOptions parameter. If
williamr@4
    94
	no custom serialization is specified, the binary data container nodes are
williamr@4
    95
	serialized like text nodes.
williamr@4
    96
williamr@4
    97
	If no aRoot is provided, the entire DOM tree is serialized.  aRoot does not
williamr@4
    98
	need to be owned by this document.
williamr@4
    99
    
williamr@4
   100
	@param aFileName A file name (with path)
williamr@4
   101
 	@param aRoot Root node to be serialized	
williamr@4
   102
	@param aSaveOptions Options that control how serialization is performed 
williamr@4
   103
    @return Number of bytes written
williamr@4
   104
	@leave KXmlEngErrWrongEncoding Encoding not understood
williamr@4
   105
	@leave KXmlEngErrWrongUseOfAPI Document is NULL
williamr@4
   106
    @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size
williamr@4
   107
	@leave - One of the system-wide error codes
williamr@4
   108
	*/
williamr@2
   109
    IMPORT_C TInt SaveL( const TDesC& aFileName,
williamr@2
   110
    					 TXmlEngNode aRoot = TXmlEngNode(),
williamr@2
   111
    					 const TXmlEngSerializationOptions& aSaveOptions = TXmlEngSerializationOptions() ) const;
williamr@2
   112
   
williamr@2
   113
    /**
williamr@4
   114
	Serializes document tree into a file.  For nodes containing binary data in
williamr@4
   115
	the form of BinaryDataContainer, FileContainer or ChunkContainer, the
williamr@4
   116
	client can implement custom serialization by implementing the
williamr@4
   117
	MXmlEngDataSerializer interface and saving a pointer to the customer
williamr@4
   118
	serializer in the iDataSerializer member of the aSaveOptions parameter. If
williamr@4
   119
	no custom serialization is specified, the binary data container nodes are
williamr@4
   120
	serialized like text nodes.
williamr@4
   121
    
williamr@4
   122
	If no aRoot is provided, the entire DOM tree is serialized.  aRoot does not
williamr@4
   123
	need to be owned by this document.
williamr@4
   124
    
williamr@4
   125
	@param aRFs An open file Server session
williamr@4
   126
	@param aFileName A file name (with path)
williamr@4
   127
 	@param aRoot Root node to be serialized	
williamr@4
   128
	@param aSaveOptions Options that control how serialization is performed 
williamr@4
   129
    @return Number of bytes written
williamr@4
   130
	@leave KXmlEngErrWrongEncoding Encoding not understood
williamr@4
   131
	@leave KXmlEngErrWrongUseOfAPI Document is NULL
williamr@4
   132
    @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size
williamr@4
   133
	@leave - One of the system-wide error codes
williamr@4
   134
    */                        
williamr@2
   135
    IMPORT_C TInt SaveL( RFs& aRFs,
williamr@2
   136
                         const TDesC& aFileName,
williamr@2
   137
                         TXmlEngNode aRoot = TXmlEngNode(),
williamr@2
   138
                         const TXmlEngSerializationOptions& aSaveOptions = TXmlEngSerializationOptions() ) const;
williamr@2
   139
    
williamr@4
   140
	/**
williamr@4
   141
	Serializes document tree into provided output stream, which supports
williamr@4
   142
	progressive writing of data.  For nodes containing binary data in the form
williamr@4
   143
	of BinaryDataContainer, FileContainer or ChunkContainer, the client can
williamr@4
   144
	implement custom serialization by implementing the MXmlEngDataSerializer
williamr@4
   145
	interface and saving a pointer to the customer serializer in the
williamr@4
   146
	iDataSerializer member of the aSaveOptions parameter. If no custom
williamr@4
   147
	serialization is specified, the binary data container nodes are serialized
williamr@4
   148
	like text nodes.
williamr@4
   149
williamr@4
   150
	If no aRoot is provided, the entire DOM tree is serialized.  aRoot does not
williamr@4
   151
	need to be owned by this document.
williamr@4
   152
    
williamr@4
   153
	@param aStream  An output stream to write the serialized DOM tree
williamr@4
   154
 	@param aRoot Root node to be serialized	
williamr@4
   155
	@param aSaveOptions Options that control how serialization is performed 
williamr@4
   156
    @return Number of bytes written
williamr@4
   157
	@leave KXmlEngErrWrongEncoding Encoding not understood
williamr@4
   158
	@leave KXmlEngErrWrongUseOfAPI Document is NULL
williamr@4
   159
    @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size
williamr@4
   160
	@leave - One of the system-wide error codes
williamr@4
   161
    */
williamr@2
   162
    IMPORT_C TInt SaveL( MXmlEngOutputStream& aStream,
williamr@2
   163
						 TXmlEngNode aRoot = TXmlEngNode(),
williamr@2
   164
						 const TXmlEngSerializationOptions& aSaveOptions = TXmlEngSerializationOptions() ) const;
williamr@2
   165
williamr@2
   166
    /**
williamr@4
   167
    Saves document tree into memory buffer.
williamr@4
   168
williamr@4
   169
	Any existing contents in aBuffer will be deleted.  The memory required for
williamr@4
   170
	aBuffer will be allocated by this method.  The method caller must Close()
williamr@4
   171
	aBuffer.
williamr@4
   172
williamr@4
   173
	If no aRoot is provided, the entire DOM tree is serialized.  aRoot does not
williamr@4
   174
	need to be owned by this document.
williamr@4
   175
    
williamr@4
   176
	@param aBuffer Resulting buffer
williamr@4
   177
    @param aRoot The root of the subtree to serialize
williamr@4
   178
    @param aSaveOptions Options that control how serialization is performed
williamr@4
   179
    @return Size of buffer 
williamr@4
   180
	@leave KXmlEngErrWrongEncoding Encoding not understood
williamr@4
   181
	@leave KXmlEngErrWrongUseOfAPI Document is NULL
williamr@4
   182
    @leave KXmlEngErrNegativeOutputSize The data to be serialized has a negative size
williamr@4
   183
	@leave - One of the system-wide error codes
williamr@4
   184
    */
williamr@2
   185
    IMPORT_C TInt SaveL(RBuf8& aBuffer, 
williamr@2
   186
    					TXmlEngNode aRoot = TXmlEngNode(), 
williamr@2
   187
                        const TXmlEngSerializationOptions& aSaveOptions = TXmlEngSerializationOptions()) const;
williamr@2
   188
   
williamr@4
   189
	/**
williamr@4
   190
	Creates a complete copy of the document and transfers ownership to the
williamr@4
   191
	caller.  The caller is required to call Close() on the new document.  The
williamr@4
   192
	new document is independant from this document and this document may be
williamr@4
   193
	changed or closed without affecting the new document.
williamr@4
   194
williamr@4
   195
	@return Complete copy of the document 
williamr@4
   196
	@leave - One of the system-wide error codes
williamr@4
   197
    */
williamr@2
   198
	IMPORT_C RXmlEngDocument CloneDocumentL() const;
williamr@2
   199
williamr@4
   200
	/**
williamr@4
   201
	Creates a new element from a specific namespace to be the root of the
williamr@4
   202
	document tree.  Any existing document element of the document is destroyed.
williamr@4
   203
    
williamr@4
   204
	@param aName Element name
williamr@4
   205
    @param aNamespaceUri Element namespace URI
williamr@4
   206
    @param aPrefix Element namemespace prefix
williamr@4
   207
    @return The new root element
williamr@4
   208
	@leave KXmlEngErrWrongUseOfAPI No name has been specified
williamr@4
   209
	@leave - One of the system-wide error codes
williamr@4
   210
    */
williamr@2
   211
    IMPORT_C TXmlEngElement CreateDocumentElementL(const TDesC8& aName, 
williamr@2
   212
                                             const TDesC8& aNamespaceUri = KNullDesC8, 
williamr@2
   213
                                             const TDesC8& aPrefix = KNullDesC8);
williamr@2
   214
williamr@4
   215
	/**
williamr@4
   216
	Replaces (and destroys) the document element.  
williamr@4
   217
williamr@4
   218
	Note:  Use TXmlEngElement::ReconcileNamespacesL() on the new document
williamr@4
   219
	element if it or its descendants can contain references to namespace
williamr@4
   220
	declarations outside of the element.
williamr@4
   221
    
williamr@4
   222
	@param aNewDocElement New document element
williamr@4
   223
    @see TXmlEngElement::ReconcileNamespacesL()
williamr@4
   224
    */
williamr@2
   225
    IMPORT_C void SetDocumentElement(TXmlEngElement aNewDocElement);
williamr@2
   226
williamr@2
   227
    /**
williamr@4
   228
    Get document encoding.
williamr@4
   229
	@return Encoding of the source XML data or TPtrC8("") if none.
williamr@4
   230
    */
williamr@2
   231
    IMPORT_C TPtrC8 XmlEncoding() const;
williamr@2
   232
williamr@2
   233
    /**
williamr@4
   234
    Get xml version
williamr@4
   235
	@return Version number reported by the XML declaration or TPtrC8("") if none.
williamr@4
   236
    */
williamr@2
   237
    IMPORT_C TPtrC8 XmlVersion() const;
williamr@2
   238
  
williamr@2
   239
    /**
williamr@4
   240
    Retrieves base URI (if defined) of the document
williamr@4
   241
	@return Document URI or TPtrC8("") if none.
williamr@4
   242
    */
williamr@2
   243
    IMPORT_C TPtrC8 DocumentUri() const;
williamr@2
   244
williamr@2
   245
    /**
williamr@4
   246
    Check if document is standalone
williamr@4
   247
	@return ETrue if standalone="true" was specified in the XML declaration in
williamr@4
   248
	the source XML file.
williamr@4
   249
    */
williamr@4
   250
	IMPORT_C TBool IsStandalone() const;
williamr@2
   251
williamr@2
   252
    /**
williamr@4
   253
    Sets XML version number to be shown in XML declaration when document is serialized.
williamr@4
   254
	@param aVersion Version string
williamr@4
   255
	@leave - One of the system-wide error codes
williamr@4
   256
    */
williamr@2
   257
    IMPORT_C void  SetXmlVersionL(const TDesC8& aVersion);
williamr@2
   258
williamr@4
   259
	/**
williamr@4
   260
	Sets the location of the document.  The document's URI is used as the
williamr@4
   261
	top-level base URI definition.
williamr@4
   262
	@param aUri Document URI
williamr@4
   263
	@leave - One of the system-wide error codes
williamr@4
   264
    */
williamr@2
   265
    IMPORT_C void  SetDocumentUriL(const TDesC8& aUri);
williamr@2
   266
williamr@4
   267
    /** 
williamr@4
   268
	Sets "standalone" attribute of XML declaration for the document
williamr@4
   269
	@param aStandalone Is the document standalone
williamr@4
   270
    */
williamr@2
   271
    IMPORT_C void  SetStandalone(TBool aStandalone);
williamr@2
   272
williamr@4
   273
    /** 
williamr@4
   274
	Get the DOM implementation.  Ownership is not transferred.  Any operation
williamr@4
   275
	on the returned object will affect this document directly, in particular, 
williamr@4
   276
	a call to RXmlEngDOMImplementation::Close() will cause further operations
williamr@4
   277
	on this document to fail.
williamr@4
   278
williamr@4
   279
	@return Object that represents current DOM implementation
williamr@4
   280
    */
williamr@2
   281
    IMPORT_C RXmlEngDOMImplementation Implementation() const;
williamr@2
   282
    
williamr@2
   283
    /**
williamr@4
   284
    Get the document element
williamr@4
   285
	@return The document element -- the top-most element in the document tree
williamr@4
   286
    */
williamr@2
   287
    IMPORT_C TXmlEngElement DocumentElement() const;
williamr@2
   288
williamr@4
   289
	/**
williamr@4
   290
	Sets the "document" property on the node and all its descendants to be this
williamr@4
   291
	RXmlEngDocument node 
williamr@4
   292
	@param aSource Node that should be added.
williamr@4
   293
    @return Adopted node
williamr@4
   294
	@leave KXmlEngErrWrongUseOfAPI The node has a parent node, the node is
williamr@4
   295
	already owned by this document, or the node is a document.
williamr@4
   296
	@leave - One of the system-wide error codes
williamr@4
   297
    */
williamr@2
   298
    IMPORT_C TXmlEngNode AdoptNodeL(TXmlEngNode aSource);
williamr@2
   299
williamr@2
   300
    /**
williamr@4
   301
    Creates a new attribute.
williamr@4
   302
williamr@4
   303
	aValue should represent the correct value of an attribute if it is put
williamr@4
   304
	as-is into an XML file (with all characters correctly escaped with entity
williamr@4
   305
	references when XML spec requires)
williamr@4
   306
    
williamr@4
   307
	The TXmlEngElement class provides a rich set of attribute creation methods,
williamr@4
   308
	which not only create attributes but also link them into elements.
williamr@4
   309
    
williamr@4
   310
	@see TXmlEngElement
williamr@4
   311
    
williamr@4
   312
    There is no way to create attributes with namespaces (despite the DOM spec); 
williamr@4
   313
    you have to use one of the TXmlEngElement::AddNewAttributeL(..) methods instead
williamr@4
   314
williamr@4
   315
	The returned attribute is the only reference to the allocated memory until
williamr@4
   316
	you have attached the attribute to some element node.
williamr@4
   317
williamr@4
   318
	@param aName Name of the atribute; no prefix allowed
williamr@4
   319
    @param aValue Value of the attribute (optional)
williamr@4
   320
    @return The newly created attribute 
williamr@4
   321
	@leave KXmlEngErrWrongUseOfAPI No name specified
williamr@4
   322
	@leave - One of the system-wide error codes
williamr@4
   323
    */
williamr@2
   324
    IMPORT_C TXmlEngAttr CreateAttributeL(const TDesC8& aName,
williamr@2
   325
                                    const TDesC8& aValue = KNullDesC8);
williamr@2
   326
williamr@2
   327
    /**
williamr@4
   328
    Creates a new text node and copies the content string into it.
williamr@4
   329
	@param aCharacters Text node content
williamr@4
   330
    @return The created node
williamr@4
   331
	@leave - One of the system-wide error codes
williamr@4
   332
    */
williamr@2
   333
    IMPORT_C TXmlEngTextNode CreateTextNodeL(const TDesC8& aCharacters = KNullDesC8);
williamr@2
   334
williamr@4
   335
	/**
williamr@4
   336
	Creates a new binary container and copies the specified cid and data into
williamr@4
   337
	it.  A pointer to the container is stored in the document's data container
williamr@4
   338
	list that can be fetched using GetDataContainerList().
williamr@4
   339
williamr@4
   340
    @see GetDataContainerList( RArray<TXmlEngDataContainer>& aList )
williamr@4
   341
	@param aCid Content identifier     
williamr@4
   342
	@param aData Binary octets
williamr@4
   343
    @return The new binary container
williamr@4
   344
	@leave - One of the system-wide error codes
williamr@4
   345
    */
williamr@2
   346
    IMPORT_C TXmlEngBinaryContainer CreateBinaryContainerL( const TDesC8& aCid,
williamr@2
   347
    												  const TDesC8& aData );
williamr@2
   348
williamr@4
   349
	/**
williamr@4
   350
	Creates a new chunk container and copies the specified cid into it.  A
williamr@4
   351
	reference to a memory chunk is stored in the container.  The memory chunk
williamr@4
   352
	must stay in scope for the lifetime of the container.  A pointer to the
williamr@4
   353
	container is stored in the document's data container list that can be
williamr@4
   354
	fetched using GetDataContainerList().
williamr@4
   355
williamr@4
   356
    @see GetDataContainerList( RArray<TXmlEngDataContainer>& aList )     
williamr@4
   357
	@param aCid Content identifier 
williamr@4
   358
	@param aChunk RChunk reference
williamr@4
   359
	@param aChunkOffset Offset to the binary data in aChunk
williamr@4
   360
	@param aDataSize Size of binary data in aChunk
williamr@4
   361
    @return The new chunk container
williamr@4
   362
	@leave - One of the system-wide error codes
williamr@4
   363
    */
williamr@2
   364
    IMPORT_C TXmlEngChunkContainer CreateChunkContainerL( const TDesC8& aCid, 
williamr@2
   365
    												const RChunk& aChunk,
williamr@2
   366
					                                const TInt aChunkOffset,
williamr@2
   367
					                                const TInt aDataSize );
williamr@2
   368
williamr@4
   369
	/**
williamr@4
   370
	Creates a new file container and copies the specified cid into it.  A
williamr@4
   371
	reference to a file is stored in the container.  aFile must stay in scope
williamr@4
   372
	of the lifetime of the container.  A pointer to the container is stored in
williamr@4
   373
	the document's data container list that can be fetched using
williamr@4
   374
	GetDataContainerList().
williamr@4
   375
williamr@4
   376
    @see GetDataContainerList( RArray<TXmlEngDataContainer>& aList )     
williamr@4
   377
	@param aCid Content identifier
williamr@4
   378
	@param aFile The file to reference
williamr@4
   379
    @return The new file container
williamr@4
   380
	@leave - One of the system-wide error codes
williamr@4
   381
    */
williamr@2
   382
    IMPORT_C TXmlEngFileContainer CreateFileContainerL( const TDesC8& aCid, 
williamr@2
   383
    											  const RFile& aFile );
williamr@2
   384
williamr@4
   385
	/**
williamr@4
   386
	Creates a new element node that belongs to the specific namespace.  A
williamr@4
   387
	namespace declaration node is created on the element.
williamr@4
   388
williamr@4
   389
	If the provided namespace uri is NULL, the element will be created without
williamr@4
   390
	namespace.
williamr@4
   391
williamr@4
   392
	@param aNamespaceUri Namespace of new element
williamr@4
   393
    @param aPrefix Prefix to use for the namespace binding and the QName of the element
williamr@4
   394
    @param aLocalName Local name of the element 
williamr@4
   395
    @return The created element
williamr@4
   396
	@leave KXmlEngErrWrongUseOfAPI No name specified
williamr@4
   397
	@leave - One of the system-wide error codes
williamr@4
   398
    */  
williamr@2
   399
    IMPORT_C TXmlEngElement CreateElementL(const TDesC8& aLocalName, 
williamr@2
   400
                                     const TDesC8& aNamespaceUri = KNullDesC8, 
williamr@2
   401
                                     const TDesC8& aPrefix = KNullDesC8);
williamr@2
   402
williamr@2
   403
    /**
williamr@4
   404
	Creates a new comment node and copies the specified string into it.
williamr@4
   405
	@param aText New comment
williamr@4
   406
    @return The created node
williamr@4
   407
	@leave - One of the system-wide error codes
williamr@4
   408
    */
williamr@2
   409
    IMPORT_C TXmlEngComment CreateCommentL(const TDesC8& aText = KNullDesC8);
williamr@2
   410
williamr@2
   411
    /**
williamr@4
   412
	Creates a new CDATA section node and copies the specified string into it.
williamr@4
   413
	@param aContents CDATASection content
williamr@4
   414
    @return The created node
williamr@4
   415
	@leave - One of the system-wide error codes
williamr@4
   416
    */
williamr@2
   417
    IMPORT_C TXmlEngCDATASection CreateCDATASectionL(const TDesC8& aContents = KNullDesC8);
williamr@2
   418
williamr@2
   419
    /**
williamr@4
   420
	Creates a new entity reference node and copies the specified string into
williamr@4
   421
	it.
williamr@4
   422
williamr@4
   423
	Note:  &lt; , &gt; , &apos; , &quot; and other predefined entity references
williamr@4
   424
	should not be created with this method. These entity references are rather
williamr@4
   425
	"character references" and are encoded/decoded automatically.
williamr@4
   426
williamr@4
   427
	@param aEntityRef is a string in one of these forms:
williamr@4
   428
        -  name
williamr@4
   429
        -  &name
williamr@4
   430
        -  &name;
williamr@4
   431
    where name is the name of the entity
williamr@4
   432
    @return The new entity reference
williamr@4
   433
	@leave KXmlEngErrWrongUseOfAPI No entity specified
williamr@4
   434
	@leave - One of the system-wide error codes
williamr@4
   435
    */
williamr@2
   436
    IMPORT_C TXmlEngEntityReference CreateEntityReferenceL(const TDesC8& aEntityRef);
williamr@2
   437
williamr@2
   438
    /**
williamr@4
   439
    Creates a new empty Document Fragment node.  The document fragment is owned by
williamr@4
   440
	this document.
williamr@4
   441
	@return The created document fragment
williamr@4
   442
	@leave - One of the system-wide error codes
williamr@4
   443
    */
williamr@4
   444
    IMPORT_C TXmlEngDocumentFragment CreateDocumentFragmentL();
williamr@4
   445
williamr@4
   446
	/**
williamr@4
   447
	Creates a new processing instruction node and copies "target" and "data"
williamr@4
   448
	into it.
williamr@4
   449
	
williamr@4
   450
	@param aTarget Target
williamr@4
   451
    @param aData Data
williamr@4
   452
    @return The created processing instruction
williamr@4
   453
	@leave KXmlEngErrWrongUseOfAPI No target specified
williamr@4
   454
	@leave - One of the system-wide error codes
williamr@4
   455
    */
williamr@2
   456
    IMPORT_C TXmlEngProcessingInstruction CreateProcessingInstructionL(const TDesC8& aTarget, 
williamr@2
   457
                                                                 const TDesC8& aData = KNullDesC8);
williamr@2
   458
                                                                 
williamr@4
   459
	/**
williamr@4
   460
	Sets the specified attribute as a xml:id attribute, starting at
williamr@4
   461
	aStartElement and recursing through the subtree.  To set the specified
williamr@4
   462
	attribute as a xml:id attribute for the entire DOM tree, see
williamr@4
   463
	RegisterXmlId(const TDesC8&,const TDesC8&).
williamr@4
   464
williamr@4
   465
    @param aStartElement Root of the subtree to recurse
williamr@4
   466
    @param aLocalName Name of the attribute
williamr@4
   467
	@param aNamespaceUri Namespace of the new element (default empty)
williamr@4
   468
	@leave KXmlEngErrWrongUseOfAPI The starting element is NULL, the attribute
williamr@4
   469
	name is not specified, the starting element is the document, or the
williamr@4
   470
	starting element does not belong to a document.
williamr@4
   471
	@leave KErrAlreadyExists The attribute is already set to be xml:id
williamr@4
   472
	@leave - One of the system-wide error codes
williamr@4
   473
    */
williamr@2
   474
    IMPORT_C void RegisterXmlIdL(TXmlEngElement aStartElement,
williamr@2
   475
                                 const TDesC8& aLocalName, 
williamr@2
   476
                                 const TDesC8& aNamespaceUri = KNullDesC8);
williamr@2
   477
williamr@4
   478
	/**
williamr@4
   479
	Sets the specified attribute as a xml:id attribute, recursing through the
williamr@4
   480
	entire DOM tree.  In order to specify a subtree only, see
williamr@4
   481
	RegisterXmlId(TXmlEngElement,const TDesC8,const TDesC8).
williamr@4
   482
williamr@4
   483
    @param aLocalName Name of attribute
williamr@4
   484
	@param aNamespaceUri Namespace of new element (default empty)
williamr@4
   485
	@leave KXmlEngErrWrongUseOfAPI The document is NULL
williamr@4
   486
	@leave KErrAlreadyExists The attribute is already set to be xml:id
williamr@4
   487
	@leave - One of the system-wide error codes
williamr@4
   488
    */
williamr@2
   489
    IMPORT_C void RegisterXmlIdL(const TDesC8& aLocalName, 
williamr@2
   490
                                 const TDesC8& aNamespaceUri = KNullDesC8);
williamr@2
   491
       
williamr@2
   492
    /**
williamr@4
   493
    Looks for an element with the specified xml:id attribute
williamr@4
   494
	@param aValue Name of attribute
williamr@4
   495
    @return The found element or a NULL element if not found
williamr@4
   496
	@leave - One of the system-wide error codes
williamr@4
   497
    */
williamr@2
   498
    IMPORT_C TXmlEngElement FindElementByXmlIdL(const TDesC8& aValue ) const;  
williamr@2
   499
williamr@2
   500
    /**
williamr@4
   501
    Retrieves an array of data containers owned by this document.
williamr@4
   502
williamr@4
   503
	Note: The document ceases to be the owner of a data container when the data
williamr@4
   504
	container (or one of its predecessors) is removed from the document or
williamr@4
   505
	becomes part of another document.  Unlinking a data container (or one of its
williamr@4
   506
	predecessors) doesn't remove ownership of the data container from this
williamr@4
   507
	document so the list might contain containers that are not linked to this
williamr@4
   508
	document anymore.    
williamr@4
   509
williamr@4
   510
	@param aList Array of data containers
williamr@4
   511
	@return KErrNone if successful or one of the system wide error codes otherwise
williamr@4
   512
    */
williamr@4
   513
    IMPORT_C TInt GetDataContainerList( RArray<TXmlEngDataContainer>& aList );
williamr@2
   514
                                                                 
williamr@2
   515
protected:
williamr@2
   516
    friend class RXmlEngDOMParser;
williamr@2
   517
    friend class TXmlEngNode;
williamr@2
   518
    friend class TXmlEngAttr;
williamr@2
   519
    friend class TXmlEngElement;
williamr@2
   520
    friend class RXmlEngDOMImplementation;
williamr@2
   521
williamr@2
   522
protected:
williamr@2
   523
    /**
williamr@4
   524
    Constructor
williamr@4
   525
	@param aInternal Document pointer
williamr@4
   526
	*/
williamr@2
   527
    inline RXmlEngDocument(void* aInternal);
williamr@2
   528
williamr@2
   529
    /**
williamr@4
   530
    DISABLED for document; CloneDocumentL() must be used
williamr@4
   531
	*/
williamr@2
   532
    inline TXmlEngNode CopyL() const; 
williamr@2
   533
williamr@2
   534
    /**
williamr@4
   535
    DISABLED for document; Close() must be used
williamr@4
   536
	*/    
williamr@2
   537
    inline void Remove();
williamr@2
   538
williamr@2
   539
    /**
williamr@4
   540
    DISABLED for document; Close() must be used
williamr@4
   541
	*/ 
williamr@4
   542
    inline void ReplaceWith(TXmlEngNode aNode);
williamr@4
   543
    inline void ReplaceWithL(TXmlEngNode aNode);
williamr@4
   544
    
williamr@4
   545
    /**
williamr@4
   546
    DISABLED for document; Close() must be used
williamr@2
   547
	 */ 
williamr@4
   548
    inline TXmlEngNode SubstituteForL(TXmlEngNode aNode);
williamr@4
   549
williamr@2
   550
private:
williamr@2
   551
	TInt SaveNodeL( TXmlEngNode aNode,
williamr@2
   552
					RBuf8& aBuffer,
williamr@2
   553
               	    MXmlEngOutputStream* aOutputStream = NULL,
williamr@2
   554
               	    TXmlEngSerializationOptions aOpt = TXmlEngSerializationOptions()) const;	
williamr@2
   555
williamr@2
   556
    void InitOwnedNodeListL();
williamr@2
   557
    void TakeOwnership(TXmlEngNode aNode);
williamr@2
   558
    void RemoveOwnership(TXmlEngNode aNode);
williamr@2
   559
williamr@2
   560
protected:
williamr@2
   561
    /**  Pointer to DOM implementation object */
williamr@2
   562
    RXmlEngDOMImplementation* iImpl;
williamr@2
   563
williamr@2
   564
};// class RXmlEngDocument
williamr@2
   565
williamr@2
   566
williamr@2
   567
williamr@4
   568
#include <xml/dom/xmlengdocument.inl>
williamr@2
   569
williamr@4
   570
#endif /* XMLENGDOCUMENT_H */