diff -r ebc84c812384 -r 46218c8b8afa Symbian3/PDK/Source/GUID-92C2317A-57B8-558E-984B-B10FD0404981.dita --- a/Symbian3/PDK/Source/GUID-92C2317A-57B8-558E-984B-B10FD0404981.dita Thu Mar 11 15:24:26 2010 +0000 +++ b/Symbian3/PDK/Source/GUID-92C2317A-57B8-558E-984B-B10FD0404981.dita Thu Mar 11 18:02:22 2010 +0000 @@ -1,59 +1,59 @@ - - - - - -Searching -a DOM Tree using XPathThis topic explains how to search in a DOM tree using an XPath -expression. -

Before you start, you must:

    -
  • understand XPath syntax and the concept of Document Object Model (DOM).

  • -
  • understand the architecture -and classes of the XML -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.

  • -
-

XPath is a simple query language for XML. An XPath expression -describes a subset of an XML tree, such as all the elements with a specified -name, or all the children of a specific node. Evaluating an XPath expression -means searching in the XML tree for matching nodes or content: clients of -the XML Engine use it to explore XML data.

The following steps show -how to make an XPath query with the XML Engine.

- -Create an instance -of RXmlEngXPathExpression by calling the TXmlEngXpathEvaluator::CreateExpressionL() method. -RXmlEngXPathExpression expr = TXmlEngXpathEvaluator::CreateExpressionL( "@*" ); -This XPath expression is only useful to illustrate this tutorial: it -returns all the attributes in an XML tree. - - -Evaluate the XPath expression by applying it to your XML document. -RXmlEngXPathResult searchResult = expr.EvaluateL( myDoc ); -The searchResult variable contains a tree of TXmlEngAttr objects. This tree is a subset of the DOM -tree. - - -Use the result, for example by accessing it as a node set as follows: -RXMLEngNodeSet set = result.AsNodeSet(); -if( for TInt i = 0; i < set.Length(); i++ ) - { - TXmlEngNode resultNode = set[i]; - /* [...] do something with the result */ - } - - -Free your resources as necessary. - - -
-Serialising -XML DOM + + + + + +Searching +a DOM Tree using XPathThis topic explains how to search in a DOM tree using an XPath +expression. +

Before you start, you must:

    +
  • understand XPath syntax and the concept of Document Object Model (DOM).

  • +
  • understand the architecture +and classes of the XML +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.

  • +
+

XPath is a simple query language for XML. An XPath expression +describes a subset of an XML tree, such as all the elements with a specified +name, or all the children of a specific node. Evaluating an XPath expression +means searching in the XML tree for matching nodes or content: clients of +the XML Engine use it to explore XML data.

The following steps show +how to make an XPath query with the XML Engine.

+ +Create an instance +of RXmlEngXPathExpression by calling the TXmlEngXpathEvaluator::CreateExpressionL() method. +RXmlEngXPathExpression expr = TXmlEngXpathEvaluator::CreateExpressionL( "@*" ); +This XPath expression is only useful to illustrate this tutorial: it +returns all the attributes in an XML tree. + + +Evaluate the XPath expression by applying it to your XML document. +RXmlEngXPathResult searchResult = expr.EvaluateL( myDoc ); +The searchResult variable contains a tree of TXmlEngAttr objects. This tree is a subset of the DOM +tree. + + +Use the result, for example by accessing it as a node set as follows: +RXMLEngNodeSet set = result.AsNodeSet(); +if( for TInt i = 0; i < set.Length(); i++ ) + { + TXmlEngNode resultNode = set[i]; + /* [...] do something with the result */ + } + + +Free your resources as necessary. + + +
+Serialising +XML DOM
\ No newline at end of file