[fpc-pascal] Modify XML Document
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Fri Jun 23 04:46:10 CEST 2006
Hello,
I am trying to use the units XMLRead, XMLWrite, DOM to modify the
structure of a XML file.
Reading the XML file is very easy and works very well, but I am lost
about how to modify it´s structure. Specifically I want to add a new
"brother" to a node. I try to create a DomNode and then add it, but I
cannot change the NodeName property. So how can I change the name of a
newly created node??
Also, how can I add a new Attribute to a DomNode??
The following code will give an error because NodeName is read-only:
var
NovoNo: TDomNode;
begin
Posicao := TreeView1.Selected.Index;
NovoNo := TDomNode.Create(XMLDoc);
NovoNo.NodeName := 'categoria';
XMLDoc.DocumentElement.InsertBefore(NovoNo,
XMLDoc.DocumentElement.ChildNodes.Item[Posicao]);
I looked at the examples on fpcsrc, but there are only very basic ones
about xml.
Any help e very welcome.
thanks a lot,
--
Felipe Monteiro de Carvalho
More information about the fpc-pascal
mailing list