[fpc-pascal] Modify XML Document

dhkblaszyk at zeelandnet.nl dhkblaszyk at zeelandnet.nl
Fri Jun 23 08:55:25 CEST 2006


Felipe,

Have a look at the lazdocfrm.pas file located in lazarus/ide. for a
working example.

Darius


> 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
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>





More information about the fpc-pascal mailing list