Retorna um array com os namespaces do nó atual do XML.
DOMGetNsList() |
Nome | Tipo | Descrição |
---|---|---|
aNSList | vetor | Retorna um array de subarray, contendo o nome e o endereço do namespace do nó atual do XML. |
user function TXGetNsL() Local cXML := "" Local oXML Local aNS := {} oXML := TXMLManager():New() cXML += '<book xmlns="http://myurl.com" 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 // aAtt -> ARRAY ( 1) [...] // aAtt[1] -> ARRAY ( 2) [...] // aAtt[1][1] -> C ( 5) [xmlns] // aAtt[1][2] -> C ( 16) [http://myurl.com] aNS := oXML:DOMGetNsList() varinfo( "aNS", aNS ) // Vai exibir "Namespace added!" if !oXML:DOMAddNs( "ns1", "http://myotherurl.com" ) conout( "Could not add namespace!" ) else conout( "Namespace added!" ) endif // Vai exibir // aAtt -> ARRAY ( 2) [...] // aAtt[1] -> ARRAY ( 2) [...] // aAtt[1][1] -> C ( 5) [xmlns] // aAtt[1][2] -> C ( 16) [http://myurl.com] // aAtt[2] -> ARRAY ( 2) [...] // aAtt[2][1] -> C ( 3) [ns1] // aAtt[2][2] -> C ( 21) [http://myotherurl.com] aNS := oXML:DOMGetNsList() varinfo( "aNS", aNS ) return |