Histórico da Página
| Composition Setup |
|---|
import.css=/download/attachments/6062824/tecnologia.css
|
...
| Pagetitle | ||||
|---|---|---|---|---|
|
O método altera um atributo do nó elemento da expressão XPath.
Sintaxe
| Bloco de código | ||
|---|---|---|
| ||
lRet := XPathSetAtt( < cXPathExpr >, < cAttName >, < cAttValue > )
|
Parâmetros
Nome | Tipo | Descrição | Obrigatório | Referência |
|---|---|---|---|---|
cXPathExpr | caractere | Expressão XPath. | X |
...
cAttName | caractere | Nome do atributo desejado | X |
...
cAttValue | caractere | Valor do atributo desejado | X |
...
Retorno
Nome | Tipo | Descrição |
|---|---|---|
lRet | lógico | Verdadeiro (.T.) caso tenha sido possivel alterar. Falso (.F.) caso contrário. |
Observações
- O valor contido em <cXPathExpr> deve ser informado de acordo com o case no XML. Esta implementação é case sensitive.
Exemplos
| Bloco de código | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
user function XPSetAtt() Local cXML := "" Local oXML Local aAtt := {} 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 // aAtt -> ARRAY ( 1) [...] // aAtt[1] -> ARRAY ( 2) [...] // aAtt[1][1] -> C ( 5) [isNew] // aAtt[1][2] -> C ( 4) [true] aAtt := oXML:XPathGetAttArray( "/book" ) varinfo( "aAtt", aAtt ) // Vai exibir ".F." conout( oXML:XPathSetAtt( "/book", "hardcover", "false" ) ) // Vai exibir // aAtt -> ARRAY ( 1) [...] // aAtt[1] -> ARRAY ( 2) [...] // aAtt[1][1] -> C ( 5) [isNew] // aAtt[1][2] -> C ( 4) [true] aAtt := oXML:XPathGetAttArray( "/book" ) varinfo( "aAtt", aAtt ) // Vai exibir ".T." conout( oXML:XPathSetAtt( "/book", "isNew", "false" ) ) // Vai exibir // aAtt -> ARRAY ( 1) [...] // aAtt[1] -> ARRAY ( 2) [...] // aAtt[1][1] -> C ( 5) [isNew] // aAtt[1][2] -> C ( 5) [false] aAtt := oXML:XPathGetAttArray( "/book" ) varinfo( "aAtt", aAtt ) return |
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas