[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New 'gb.xml2' component



Am 08.11.26 um 19:40 schrieb Benoît Minisini:
You should read the 'libxml2' documentation, alas it is not very easy to read (more difficult than the Gambas documentation!).
I didn't find anything useful yet which helped me to get an idea about the new API.

There is two ways of parsing an XML document:

1) The 'XmlDocument' class. It loads the document in memory entirely (from a file or a string), and creates a tree of 'XmlNode' and 'XmlAttribute' objects. The 'XmlNode' should be your 'XmlElement'.

The 'XmlDocument.Root' returns the root 'XmlNode' of the XML document. Then you can use the 'XmlNode.Children' property to browse the children nodes, and 'XmlNode.Attributes' property to browse the node attributes.
I tried to find a method which returns all child-nodes of the root with certain properties - without success.
The funny thing in 'libxml2' is that 'XmlNode' and 'XmlAttribute' are almost managed the same way (this is why I think it is named "node" and not "element"), but I made the distinction better in the the 'gb.xml2' API.

I didn't write any documentation yet, as the component API is not really finished.
The Load and FromString methods didn't work. They always resulted in a Null XMLDocument. Only hXMLDoc = New XMLDocument(sXMLPath) worked.

By the way I have just starting to implement in 'XmlDocument' the ability to modify the document, but it is not finished (you should be able to save your changes for example).
👍 This is one thing I was missing badly.

Regards,

--
Benoît Minisini.

Best regards

Claus


Follow-Ups:
Re: New 'gb.xml2' componentLee <t.lee.davidson@xxxxxxxxx>
References:
New 'gb.xml2' componentBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: New 'gb.xml2' componentBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: New 'gb.xml2' componentClaus Dietrich <claus.dietrich@xxxxxxxxxx>
Re: New 'gb.xml2' componentBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: New 'gb.xml2' componentClaus Dietrich <claus.dietrich@xxxxxxxxxx>
Re: New 'gb.xml2' componentClaus Dietrich <claus.dietrich@xxxxxxxxxx>
Re: New 'gb.xml2' componentClaus Dietrich <claus.dietrich@xxxxxxxxxx>
Re: New 'gb.xml2' componentBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>