user function XPChCnt()
Local cXML := ""
Local oXML
oXML := TXMLManager():New()
cXML += '<book isNew="true">' + CRLF
cXML += ' <title>A Clash of Kings</title>' + CRLF
cXML += ' <author>George R. R. Martin</author>' + CRLF
cXML += ' <price>9.99</price>' + CRLF
cXML += ' <origin>US</origin>' + CRLF
cXML += '</book>' + CRLF
if !oXML:Parse( cXML )
conout( "Errors on Parse!" )
return
endif
// Vai exibir "-1"
conout( oXML:XPathChildCount( "/song/composer" ) )
// Vai exibir "0"
conout( oXML:XPathChildCount( "/book/price" ) )
// Vai exibir "4"
conout( oXML:XPathChildCount( "/book" ) )
return
|