diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-E20C2C98-A294-551B-99CF-BE1DAA6F597E.dita --- a/Symbian3/PDK/Source/GUID-E20C2C98-A294-551B-99CF-BE1DAA6F597E.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-E20C2C98-A294-551B-99CF-BE1DAA6F597E.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,76 +1,76 @@ - - - - - -Serialising -XML DOMThis topic explains how to serialise a DOM document and save it -to a file. -

Before you start, you must:

    -
  • understand the concepts -of Document Object Model -(DOM) and serialisation

  • -
  • understand the structure -and classes of the XML -DOM Engine component

  • -
  • have created an RXmlEngDocument (called myDoc in -this example), either by parsing an XML file (as indicated in the XML -DOM Parsing Tutorial) or by adding nodes to a new DOM tree.

  • -
-

The XML Engine is based on the libxml2 library, which supports -the serialisation of XML documents. This process converts a DOM tree into -a format that can be saved to a file or transferred through a network connection.

This -tutorial explains how to save an existing XML document to a file. To store -the result in a buffer, use the SetOutput(RBuf8&) method -instead of the SetOutputL(TDesC&) method -used below.

- - -If you have not done it earlier, call the XmlEnginePushL() method -to open the XML library and put serialisation resources on the clean-up stack. -XmlEnginePushL(); - -Create an instance -of the serialiser by calling its NewL() method. -The serialiser type is a member of the TXmlEngSerializerType enumeration. -CXmlEngSerializer* serializer = CXmlEngSerializer::NewL( ESerializerDefault ); - -Configure the serialiser -by using the SetOutputL() and SetSerialisationOptions() methods. -You set the type of output (file, buffer, or stream) by choosing one -of the SetOutput() or SetOuputL() methods. -_LIT( KOutputFile, "c:\\tutorial.xml" ); -serializer->SetOutputL( KOutputFile ); -The SetSerialisationOptions() function sets other serialisation -options from the TXmlEngSerializationOptions class. -TXmlEngSerializationOptions options( TXmlEngSerializationOptions::KOptionIndent ); -serializer->SetSerializationOptions( options ); - - - -Call the SerializeL() method to save -your document to the tutorial.xml file. -TInt bytesWritten = serializer->SerializeL( myDoc ); - - -Free your resources as necessary. - - -Close the XML library by calling the XmlPopAndClose() method. -This method also removes the serialisation resources from the clean-up stack. - - -Perform any other clean-up operations. - - - - -

The data in the myDoc XML document -is stored in the tutorial.xml file.

+ + + + + +Serialising +XML DOMThis topic explains how to serialise a DOM document and save it +to a file. +

Before you start, you must:

    +
  • understand the concepts +of Document Object Model +(DOM) and serialisation

  • +
  • understand the structure +and classes of the XML +DOM Engine component

  • +
  • have created an RXmlEngDocument (called myDoc in +this example), either by parsing an XML file (as indicated in the XML +DOM Parsing Tutorial) or by adding nodes to a new DOM tree.

  • +
+

The XML Engine is based on the libxml2 library, which supports +the serialisation of XML documents. This process converts a DOM tree into +a format that can be saved to a file or transferred through a network connection.

This +tutorial explains how to save an existing XML document to a file. To store +the result in a buffer, use the SetOutput(RBuf8&) method +instead of the SetOutputL(TDesC&) method +used below.

+ + +If you have not done it earlier, call the XmlEnginePushL() method +to open the XML library and put serialisation resources on the clean-up stack. +XmlEnginePushL(); + +Create an instance +of the serialiser by calling its NewL() method. +The serialiser type is a member of the TXmlEngSerializerType enumeration. +CXmlEngSerializer* serializer = CXmlEngSerializer::NewL( ESerializerDefault ); + +Configure the serialiser +by using the SetOutputL() and SetSerialisationOptions() methods. +You set the type of output (file, buffer, or stream) by choosing one +of the SetOutput() or SetOuputL() methods. +_LIT( KOutputFile, "c:\\tutorial.xml" ); +serializer->SetOutputL( KOutputFile ); +The SetSerialisationOptions() function sets other serialisation +options from the TXmlEngSerializationOptions class. +TXmlEngSerializationOptions options( TXmlEngSerializationOptions::KOptionIndent ); +serializer->SetSerializationOptions( options ); + + + +Call the SerializeL() method to save +your document to the tutorial.xml file. +TInt bytesWritten = serializer->SerializeL( myDoc ); + + +Free your resources as necessary. + + +Close the XML library by calling the XmlPopAndClose() method. +This method also removes the serialisation resources from the clean-up stack. + + +Perform any other clean-up operations. + + + + +

The data in the myDoc XML document +is stored in the tutorial.xml file.

\ No newline at end of file