Talk:XML Tutorial

From Lazarus wiki
Jump to navigationJump to search

Docelement as root of XML tree in DOM?

The first sample has

   ReadXMLFile(Doc, 'test.xml');
   PassNode := Doc.DocumentElement.FindNode('password');

Does this mean that DocumentElement is the representation of the top of the XML document in DOM form? Can you also write to that to e.g. change <?xml version="1.0"?> to <?xml version="1.0" standalone="yes"?>

--BigChimp 09:36, 24 July 2011 (CEST)

No, the top of XML document is represented by the Document object itself. DocumentElement is a regular TDOMElement object, which is a child of Document. The reason of having a separate DocumentElement property is that the document may contain comments and processing instructions before and after the root element, and it also may contain a DTD node, so condition DocumentElement=Document.FirstChild is not always true.

The XML declaration <?xml version="1.0"?> is not a part of node tree. DOM specification levels 1 and 2 do not provide any means to modify it, but DOM level 3 introduces Document.xmlVersion, Document.xmlEncoding and Document.xmlStandalone properties for this purpose. xmlStandalone is not yet implemented by fcl-xml.

Gorelkin 09:11, 25 July 2011 (CEST)

Required uses clauses - seems fixed?

The example routines, taken "as is", does not compile. Need to tell what units are needed in the uses section, at least (no, I don't know what they are) --Kormoran 14:19, 26 March 2011 (CET)