| dalla versione 19.5.7600 - modificato il 11/10/2019 - link - english
|
XMLDocument doc = new()
XMLNode root = doc.addElement("root", ...)
XMLNode tableH = root.addElement("h:table", "http://www.w3.org/TR/html4/")
XMLNode trH = tableH.addElement("h:tr", "http://www.w3.org/TR/html4/")
XMLNode tdH1 = trH.setTextNode("h:td", "Apples", "http://www.w3.org/TR/html4/")
XMLNode tdH2 = trH.setTextNode("h:td", "Apples", "http://www.w3.org/TR/html4/")
XMLNode tableF = root.addElement("f:table", "https://www.w3schools.com/furniture")
XMLNode trF = tableF.addElement("f:tr", "https://www.w3schools.com/furniture")
XMLNode nameF = trF.setTextNode("f:name", "African Coffee Table", "https://www.w3schools.com/furniture")
XMLNode widthF = trF.setTextNode("f:width", "80", "https://www.w3schools.com/furniture")
XMLNode lengthF = trF.setTextNode("f:length", "120", "https://www.w3schools.com/furniture")
string xml = doc.saveToString(...)
Con questo codice si ottiene questo xml:
<root>
<h:table xmlns:h="http://www.w3.org/TR/html4/">
<h:tr>
<h:td>Apples</h:td>
<h:td>Bananas</h:td>
</h:tr>
</h:table>
<f:table xmlns:f="https://www.w3schools.com/furniture">
<f:name>African Coffee Table</f:name>
<f:width>80</f:width>
<f:length>120</f:length>
</f:table>
</root>
Funzionalità interessate
Lettura/scrittura di XML con namespace dei nodi e attributi.
Note
-
Miglioramento relativo a questo thread del forum.
- Miglioramento relativo alla proposta di modifica PRP000356.
Cosa ne pensi?
Ti sono rimaste delle domande su punti che questo articolo non ha trattato? Pensi che sia utile aggiungere una nota all'articolo? Aiutaci a migliorare la documentazione di Instant Developer scrivendo il tuo commento nei campi qui sotto.