O método permite remover o nó atual do XML assim como todos os nós filhos desse nó.
Sintaxe
DOMDelNode()
Retorno
Nome | Tipo | Descrição |
|---|---|---|
lRet | lógico | Verdadeiro (.T.) caso tenha sido possivel remover. Falso (.F.) caso contrário. |
Observações
- Caso o nó seja removido, o nó atual será alterado para o próximo nó, o nó anterior ou o nó pai, se existir, obedecendo essa ordem de verificação.
Exemplos
Exemplo 1
user function TXDelN()
Local cXML := ""
Local oXML
Local aChildren := {}
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
// aChildren -> ARRAY ( 4) [...]
// aChildren[1] -> ARRAY ( 2) [...]
// aChildren[1][1] -> C ( 5) [title]
// aChildren[1][2] -> C ( 16) [A Clash of Kings]
// aChildren[2] -> ARRAY ( 2) [...]
// aChildren[2][1] -> C ( 6) [author]
// aChildren[2][2] -> C ( 19) [George R. R. Martin]
// aChildren[3] -> ARRAY ( 2) [...]
// aChildren[3][1] -> C ( 5) [price]
// aChildren[3][2] -> C ( 4) [9.99]
// aChildren[4] -> ARRAY ( 2) [...]
// aChildren[4][1] -> C ( 6) [origin]
// aChildren[4][2] -> C ( 2) [US]
aChildren := oXML:DOMGetChildArray()
varinfo( "aChildren", aChildren )
oXML:DOMChildNode()
// Vai exibir ".T."
conout( oXML:DOMDelNode() )
oXML:DOMParentNode()
// Vai exibir
// aChildren -> ARRAY ( 3) [...]
// aChildren[1] -> ARRAY ( 2) [...]
// aChildren[1][1] -> C ( 6) [author]
// aChildren[1][2] -> C ( 19) [George R. R. Martin]
// aChildren[2] -> ARRAY ( 2) [...]
// aChildren[2][1] -> C ( 5) [price]
// aChildren[3][2] -> C ( 4) [9.99]
// aChildren[3] -> ARRAY ( 2) [...]
// aChildren[3][1] -> C ( 6) [origin]
// aChildren[3][2] -> C ( 2) [US]
aChildren := oXML:DOMGetChildArray()
varinfo( "aChildren", aChildren )
// Vai exibir "book"
conout( oXML:CNAME )
// Vai exibir ".T."
conout( oXML:DOMDelNode() )
// Vai exibir ""
conout( oXML:CNAME )
// Vai exibir
// aChildren -> ARRAY ( 0) [...]
aChildren := oXML:DOMGetChildArray()
varinfo( "aChildren", aChildren )
return
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas