epoc32/include/xml/dom/xmlengdeserializerdom.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
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
// XML Deserializer to DOM tree
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@4
    23
*/
williamr@4
    24
#ifndef XMLENGDESERIALIZERDOM_H
williamr@4
    25
#define XMLENGDESERIALIZERDOM_H
williamr@4
    26
williamr@4
    27
#include <xml/dom/xmlengdeserializer.h>
williamr@4
    28
williamr@4
    29
#include <e32std.h>
williamr@4
    30
#include <e32base.h>
williamr@4
    31
williamr@4
    32
williamr@4
    33
class RFs;
williamr@4
    34
class RXmlEngDOMImplementation;
williamr@4
    35
class RXmlEngDocument;
williamr@4
    36
williamr@4
    37
/**
williamr@4
    38
Deserializes a XML file to a DOM tree.
williamr@4
    39
williamr@4
    40
Sample code for deserialization to a DOM tree:
williamr@4
    41
@code
williamr@4
    42
     // create deserializer
williamr@4
    43
     CXmlEngDeserializerDOM* deserializer = CXmlEngDeserializerDOM::NewL();
williamr@4
    44
     CleanupStack::PushL(deserializer);
williamr@4
    45
     // configure deserializer
williamr@4
    46
     deserializer->SetInputFileL(KInputFile, EDeserializerGZip);
williamr@4
    47
     // Set the DOM Implementation
williamr@4
    48
     deserializer->UseDOMImplementationL(iDomImpl);
williamr@4
    49
     // deserialize
williamr@4
    50
     RXmlEngDocument doc = deserializer->DeserializeL();
williamr@4
    51
     CleanupStack::PopAndDestroy();// deserializer
williamr@4
    52
@endcode 
williamr@4
    53
*/
williamr@4
    54
class CXmlEngDeserializerDOM: public CBase
williamr@4
    55
{
williamr@4
    56
 public:
williamr@4
    57
    /**
williamr@4
    58
    Creates an instance of CXmlEngDeserializerDOM.
williamr@4
    59
    @return The DOM deserializer instance
williamr@4
    60
	@leave KErrNoMemory Memory allocation failure
williamr@4
    61
    */
williamr@4
    62
    IMPORT_C static CXmlEngDeserializerDOM* NewL();
williamr@4
    63
    												 
williamr@4
    64
    /**
williamr@4
    65
	Sets the input type to file and saves the file name for later
williamr@4
    66
	deserialization.
williamr@4
    67
	@param aFileName The file name of the file to deserialize
williamr@4
    68
	@param aType The deserialization format
williamr@4
    69
	@leave - One of the system-wide error codes
williamr@4
    70
    */
williamr@4
    71
	IMPORT_C void SetInputFileL(const TDesC& aFileName, TXmlEngDeserializerType aType = EDeserializerDefault);
williamr@4
    72
williamr@4
    73
    /**
williamr@4
    74
	Sets the input to to buffer and saves the buffer for later deserialization.
williamr@4
    75
	@param aBuffer The buffer to deserialize
williamr@4
    76
	@param aType The deserialization format
williamr@4
    77
    */
williamr@4
    78
	IMPORT_C void SetInputBuffer(const TDesC8& aBuffer, TXmlEngDeserializerType aType = EDeserializerDefault);
williamr@4
    79
williamr@4
    80
    /**
williamr@4
    81
	Sets a list of data containers and indicates that the XML to be
williamr@4
    82
	deserialized contains references (such as xop:include) to data stored
williamr@4
    83
	outside the DOM tree.	
williamr@4
    84
williamr@4
    85
	Upon deserialization, the references are substituted with the matching data
williamr@4
    86
	containers and returned via the content handler.
williamr@4
    87
williamr@4
    88
	This often occurs when a multipart MIME message is received.  The text XML
williamr@4
    89
	content may be in one part, while the binary content is in another part.
williamr@4
    90
	Each part containing binary content must be placed into a data container using
williamr@4
    91
	RXmlEngDocument::CreateBinaryContainerL() or similar.  When deserialization
williamr@4
    92
	of the XML occurs, the data containers are retrieved by content-id.
williamr@4
    93
williamr@4
    94
	Ownership is not transferred and the list must stay in scope for the
williamr@4
    95
	lifetime of the deserializer.
williamr@4
    96
	
williamr@4
    97
	@param aList The list of data containers
williamr@4
    98
	@leave - Any system-wide error code
williamr@4
    99
    */
williamr@4
   100
	IMPORT_C void UseExternalDataL(RArray<TXmlEngDataContainer>& aList);
williamr@4
   101
williamr@4
   102
    /**
williamr@4
   103
	Gets the list of external data containers.
williamr@4
   104
	@return The list of data containers or NULL if no external data is registered
williamr@4
   105
    */
williamr@4
   106
	IMPORT_C RArray<TXmlEngDataContainer>* ExternalData();  
williamr@4
   107
	
williamr@4
   108
	/**
williamr@4
   109
    Sets the DOM implementation that will be used to create the DOM tree
williamr@4
   110
	@param aImpl The DOM implementation
williamr@4
   111
	@leave - Does not leave
williamr@4
   112
    */
williamr@4
   113
	IMPORT_C void UseDOMImplementationL(RXmlEngDOMImplementation& aImpl);
williamr@4
   114
williamr@4
   115
    /**
williamr@4
   116
	Deserializes the file or buffer previously set by SetInputFileL() or
williamr@4
   117
	SetInputBuffer() and creates a new document that holds the DOM tree.
williamr@4
   118
williamr@4
   119
	@return The document that holds the DOM tree
williamr@4
   120
	@leave KXmlEngErrNoParameters No file or buffer has been previously set
williamr@4
   121
	@leave KXmlEngErrWrongUseOfAPI DOM Implementation not set
williamr@4
   122
	@leave - One of the system-wide error codes 
williamr@4
   123
    */
williamr@4
   124
	IMPORT_C RXmlEngDocument DeserializeL();     
williamr@4
   125
williamr@4
   126
	/**
williamr@4
   127
	Deserializes the given file and creates a new document that holds the DOM
williamr@4
   128
	tree.  Any filename previously set with SetInputFileL() is ignored.  
williamr@4
   129
williamr@4
   130
	@param aFileName The file to be deserialized
williamr@4
   131
	@param aType The deserialization format
williamr@4
   132
	@return The document that holds the DOM tree
williamr@4
   133
	@leave KXmlEngErrWrongUseOfAPI DOM Implementation not set
williamr@4
   134
	@leave - One of the system wide error codes
williamr@4
   135
    */
williamr@4
   136
	IMPORT_C RXmlEngDocument DeserializeL( const TDesC& aFileName, TXmlEngDeserializerType aType = EDeserializerDefault); 
williamr@4
   137
williamr@4
   138
    /**
williamr@4
   139
	Deserializes the given file and creates a new document that holds the DOM
williamr@4
   140
	tree.  Any filename previously set with SetInputFileL() is ignored.  
williamr@4
   141
williamr@4
   142
    @param aRFs File Server session
williamr@4
   143
	@param aFileName The file to be deserialized
williamr@4
   144
	@param aType The deserialization format
williamr@4
   145
	@return The document that holds the DOM tree
williamr@4
   146
	@leave KXmlEngErrWrongUseOfAPI DOM Implementation not set
williamr@4
   147
	@leave - One of the system wide error codes
williamr@4
   148
    */
williamr@4
   149
	IMPORT_C RXmlEngDocument DeserializeL( RFs& aRFs, const TDesC& aFileName, TXmlEngDeserializerType aType = EDeserializerDefault); 
williamr@4
   150
	
williamr@4
   151
    /**
williamr@4
   152
	Deserializes the given buffer and creates a new document that holds the DOM
williamr@4
   153
	tree.  Any buffer previously set with SetInputBuffer() is ignored.  
williamr@4
   154
williamr@4
   155
    @param aBuffer Buffer to be parsed  
williamr@4
   156
    @param aType Input type 
williamr@4
   157
	@return The document that holds the DOM tree
williamr@4
   158
	@leave KXmlEngErrWrongUseOfAPI DOM Implementation not set
williamr@4
   159
	@leave - One of the system wide error codes
williamr@4
   160
    */
williamr@4
   161
    IMPORT_C RXmlEngDocument DeserializeL( const TDesC8& aBuffer, TXmlEngDeserializerType aType = EDeserializerDefault); 
williamr@4
   162
williamr@4
   163
    /** Destructor. */
williamr@4
   164
    ~CXmlEngDeserializerDOM();
williamr@4
   165
williamr@4
   166
protected:
williamr@4
   167
    /** Default constructor. */
williamr@4
   168
    CXmlEngDeserializerDOM();
williamr@4
   169
  
williamr@4
   170
protected: 
williamr@4
   171
	/** File to be parsed */
williamr@4
   172
	HBufC* iInputFileName;	
williamr@4
   173
	/** Buffer to be parsed */
williamr@4
   174
	TPtrC8 iBuffer;
williamr@4
   175
	/** Array of external data */
williamr@4
   176
	RArray<TXmlEngDataContainer>* iDataList;
williamr@4
   177
	/** Deserializer type */
williamr@4
   178
	TXmlEngDeserializerType iType;
williamr@4
   179
	/** DOM implementation */
williamr@4
   180
	RXmlEngDOMImplementation* iImpl;
williamr@4
   181
williamr@4
   182
}; //class CXmlEngDeserializerDOM
williamr@4
   183
williamr@4
   184
#endif /* XMLENGDESERIALIZERDOM_H */
williamr@4
   185