class CXdmDocument : public CActive |
Protected Member Functions | |
---|---|
CXdmDocument ( CXdmEngine &) | |
void | AppendPathPartL (const TDesC &) |
IMPORT_C void | BaseConstructL ( TInt , const TDesC &) |
IMPORT_C void | BaseConstructL ( TInt , const TDesC8 &) |
Private Member Functions | |
---|---|
void | CancelUpdate () |
TInt | DoFindAttributes ( CXdmDocumentNode *, const TDesC &, RPointerArray < CXdmNodeAttribute > &) |
void | EmptyOperationQueue () |
void | SaveClientStatus ( TRequestStatus &) |
void | StartUpdateL () |
Inherited Enumerations | |
---|---|
CActive:TPriority |
Protected Attributes | |
---|---|
RPointerArray < MXdmOperation > | iChangeRequests |
TRequestStatus * | iClientStatus |
TBool | iDocSubset |
HBufC * | iDocumentName |
CXdmOperationFactory * | iOperationFactory |
TTime | iTimeStamp |
CXdmEngine & | iXdmEngine |
Inherited Attributes | |
---|---|
CActive::iStatus |
IMPORT_C | CXdmDocument | ( | CXdmEngine & | aXdmEngine | ) | [protected] |
C++ constructor is private.
CXdmEngine & aXdmEngine |
IMPORT_C void | AppendL | ( | CXdmDocumentNode * | aDocNode = NULL | ) |
Append data to the document this object models beginning from the element the parameter points to. If the parameter is not specified, the operation applies to the whole of the document.
NOTE: This is a "blind insert"; no guarantees can be given as to the success or failure of the operation, since it includes no checking for existence of the resource that is to be appended/inserted. It is also worth noticing that this method may effectively turn into a replace operation in case the method is invoked on a document that already exists in the storage endpoint.
CXdmDocumentNode * aDocNode = NULL |
void | AppendPathPartL | ( | const TDesC & | aString | ) | [protected, pure virtual] |
Append an element to the path identifying the the current document subset
const TDesC & aString |
IMPORT_C void | AppendToModelL | ( | CXdmDocumentNode * | aNewNode, |
CXdmDocumentNode * | aParentNode | |||
) |
Append an element to the document model
NOTE: This method cannot be used with document models that only target a fragment of the document; in practise this means that if the client has constructed a node using DocumentSubsetL() , this method leaves with KErrGeneral. A document subset cannot be treated as an actual document since only a fraction of the elements and their dependencies in the document is known. The client must have the whole document at its disposal in order to be properly able to make use of this method.
CXdmDocumentNode * aNewNode | |
CXdmDocumentNode * aParentNode |
IMPORT_C void | BaseConstructL | ( | TInt | aOperationFactoryUid, |
const TDesC & | aDocumentName | |||
) | [protected] |
By default Symbian OS constructor is private.
IMPORT_C void | BaseConstructL | ( | TInt | aOperationFactoryUid, |
const TDesC8 & | aDocumentName | |||
) | [protected] |
By default Symbian OS constructor is private.
CXdmDocumentNode * | CreateRootL | ( | ) | [pure virtual] |
Construct an "anonymous" entry point for this document. This node effectively becomes the root of this document.
CXdmDocumentNode * | CurrentExtent | ( | ) | const [pure virtual] |
Return the currently last node in the path. NOTE: Only works with document subsets!
IMPORT_C void | DeleteDataL | ( | CXdmDocumentNode * | aDocNode = NULL | ) |
Delete data from the document this object models beginning from the element the parameter points to. If the parameter is not specified, the operation applies to the whole of the document.
CXdmDocumentNode * aDocNode = NULL |
TInt | DoFindAttributes | ( | CXdmDocumentNode * | aNode, |
const TDesC & | aAttributeName, | |||
RPointerArray < CXdmNodeAttribute > & | aResultArray | |||
) | const [private] |
Find attributes by name
CXdmDocumentNode * aNode | |
const TDesC & aAttributeName | |
RPointerArray < CXdmNodeAttribute > & aResultArray |
CXdmDocumentNode * | DocumentRoot | ( | ) | const [pure virtual] |
Return the root element of this document
NOTE: The returning node may or may not contain any data, since, in the case that this document model does not have content yet, the element is a simple "entry point" to the whole document. Thus, for instance, if the client application requests the XDM Engine to fetch a particular document, the root element points to nothing until the request has been completed.
Also note that in case the client has created a document subset using the DocumentSubsetL() method, this method will return NULL, since the document is not traversable from the root; it, by definition, represents only a subset of this document. In case of a document subset, the path from the root node to the target node should be considered a simple linked list that does not necessarily contain all children for any of the nodes in between.
IMPORT_C CXdmDocumentNode * | DocumentSubsetL | ( | const TDesC & | aNodePath | ) |
Return a subset of the document this object models. For instance, if the whole (physical) document is the following:
<root> <element1> <child1> <leaf1>Foo</leaf1> </child1> </element1> </root>
calling this method with the parameter "root/element1/child1" would make this document model model the subset
<child1> <leaf1>Foo</leaf1> </child1>
It is important to understand that, after calling this method, the document model only models the document starting from the node the method returns. The client may traverse the document all the way to the root node and back, but the way from the root node to the node this method returns should be regarded merely as a "path" of elements that has no real content.
A prime use case for this method is one in which the structure of the document the client application wants to operate on is well-known; a typical example would be an XDM directory document. The schema for this application usage is very simple: the root element is <xcap-directory> that has a collection of <folder> elements as its children. Each <folder> element has a mandatory "auid" parameter that identifies the type of documents that particular folder contains. Therefore, a client application has all the necessary information it needs to have in order to be able to carry out a fetch for a document subset (one folder):
_LIT( KNodePath, "xcap-directory/folder" ); CXdmDocumentNode* node = iDirectoryDoc->DocumentSubsetL( KNodePath ); CleanupStack::PushL( node ); CXdmNodeAttribute* auid = node->CreateAttributeL( _L( "auid" ) ); CleanupStack::PushL( auid ); auid->SetAttributeValueL( _L( "My document type" ) ); iDirectoryDoc->FetchDataL( node ); CleanupStack::Pop( 2 ); //auid, node
In this particular case, even after the fetch operation is complete, the <xcap-directory> element in this document model would not be a real element, a genuine part of the document, but, rather, a "virtual" node on the way to the element that is of real interest to the client application.
Also note that the instance of CXdmDocument on which this subset has been created, cannot be used as a container for a whole document until ResetSubset() has been called.
The incoming parameter MUST separate each step to the target element with a slash character ('/').
const TDesC & aNodePath |
CXdmDocumentNode * | ErrorRoot | ( | ) | [pure virtual] |
Return an error document for a failed update
NOTE: The returning object will be zero in case the used protocol does not support this feature.
IMPORT_C void | FetchDataL | ( | CXdmDocumentNode * | aDocNode = NULL | ) |
Fetch data from the document this object models beginning from the element the parameter points to. If the parameter is not specified, the operation applies to the whole of the document.
CXdmDocumentNode * aDocNode = NULL |
IMPORT_C TInt | Find | ( | const CXdmDocumentNode & | aTargetNode, |
RPointerArray < CXdmDocumentNode > & | aResultArray | |||
) | const |
Search for nodes which match the specified name & attributes
const CXdmDocumentNode & aTargetNode | |
RPointerArray < CXdmDocumentNode > & aResultArray |
IMPORT_C TInt | Find | ( | const TDesC & | aNodeName, |
RPointerArray < CXdmDocumentNode > & | aResultArray | |||
) | const |
Search for nodes which match the specified name & attributes
const TDesC & aNodeName | |
RPointerArray < CXdmDocumentNode > & aResultArray |
IMPORT_C TInt | Find | ( | const TDesC & | aAttributeName, |
RPointerArray < CXdmNodeAttribute > & | aResultArray | |||
) | const |
Search for attributes which match the specified name
const TDesC & aAttributeName | |
RPointerArray < CXdmNodeAttribute > & aResultArray |
IMPORT_C TInt | Find | ( | const TDesC & | aNodeName, |
RPointerArray < CXdmDocumentNode > & | aResultArray, | |||
const RPointerArray < SXdmAttribute16 > & | aAttributeArray | |||
) | const |
Search for nodes which match the specified name & attributes
const TDesC & aNodeName | |
RPointerArray < CXdmDocumentNode > & aResultArray | |
const RPointerArray < SXdmAttribute16 > & aAttributeArray |
IMPORT_C void | InsertL | ( | CXdmDocumentNode * | aDocNode | ) |
Insert the node identified by the parameter. Note that this method cannot be applied to complete documents. Thus the method will fail in case the parameter is NULL. If the client needs to a) add b) replace a document, it needs to do this through the AppendL() or the ReplaceL() method.
NOTE: The operation will fail in case the element identified by the aDocNode parameter already exists in the document. XDM Engine does not make assumptions in this regard; it does not, for instance, change some aspects of the request in order to turn it into a valid insert operation. Instead, it will re-read the whole document and retry the insert operation. If the operation still fails, the engine reports the failure that occurred while performing the operation. In the latter case, the client can get a hold of the error report document, provided that the used protocol supports the feature and that the server included the document in the response, by fetching the root node of the error document through ErrorRoot() method.
CXdmDocumentNode * aDocNode |
IMPORT_C void | RemoveFromModelL | ( | CXdmDocumentNode * | aChileNode | ) |
Remove an element from the document model
NOTE: This method cannot be used with document models that only target a fragment of the document; in practise this means that if the client has constructed a node using DocumentSubsetL() , this method leaves with KErrGeneral. A document subset cannot be treated as an actual document since only a fraction of the elements and their dependencies in the document is known. The client must have the whole document at its disposal in order to be properly able to make use of this method.
CXdmDocumentNode * aChileNode |
IMPORT_C void | ReplaceInModelL | ( | CXdmDocumentNode * | aNewNode, |
CXdmDocumentNode * | aTargetNode | |||
) |
Replace an element in the document model
NOTE: This method cannot be used with document models that only target a fragment of the document; in practise this means that if the client has constructed a node using DocumentSubsetL() , this method leaves with KErrGeneral. A document subset cannot be treated as an actual document since only a fraction of the elements and their dependencies in the document is known. The client must have the whole document at its disposal in order to be properly able to make use of this method.
CXdmDocumentNode * aNewNode | |
CXdmDocumentNode * aTargetNode |
IMPORT_C void | ReplaceL | ( | ) |
Replace the document this object models
NOTE: The name of the document MUST remain the same. This is because the operation first needs to delete the old document and then store the new one. The risk of creating conflicting document names is far too great in case this rule is not imposed.
IMPORT_C void | ReplaceL | ( | CXdmDocumentNode * | aOldNode, |
CXdmDocumentNode * | aNewNode | |||
) |
Replace a named element in the document this object models
NOTE: Both elements MUST have a common parent element, which, in effect, must be the element this document model points to. Also note that the operation will fail in case the "aOldNode" does not exist in the document.
CXdmDocumentNode * aOldNode | |
CXdmDocumentNode * aNewNode |
void | SaveClientStatus | ( | TRequestStatus & | aClientStatus | ) | [private, pure virtual] |
Save the client's request status
TRequestStatus & aClientStatus |
IMPORT_C TBool | operator== | ( | CXdmDocument & | aDocument | ) | const |
Comparison operator
CXdmDocument & aDocument |
RPointerArray < MXdmOperation > | iChangeRequests | [protected] |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.