Difference between revisions of "Talk:XML Tutorial"

From Lazarus wiki
(Docelement as root of XML tree in DOM?)
m (Confirmation root element)
Line 1: Line 1:
=== Docelement as root of XML tree in DOM? ===
+
=== Docelement is not the root of XML tree in DOM ===
 
The first sample has
 
The first sample has
 
     ReadXMLFile(Doc, 'test.xml');
 
     ReadXMLFile(Doc, 'test.xml');
Line 15: Line 15:
  
 
[[User:Gorelkin|Gorelkin]] 09:11, 25 July 2011 (CEST)
 
[[User:Gorelkin|Gorelkin]] 09:11, 25 July 2011 (CEST)
 +
 +
Thanks! This clears it up!
 +
--[[User:BigChimp|BigChimp]] 14:04, 26 July 2011 (CEST)
  
 
=== Required uses clauses - seems fixed? ===
 
=== Required uses clauses - seems fixed? ===
 
The example routines, taken "as is",  does not compile.
 
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) --[[User:Kormoran|Kormoran]] 14:19, 26 March 2011 (CET)
 
Need to tell what units are needed in the '''uses''' section, at least (no, I don't know what they are) --[[User:Kormoran|Kormoran]] 14:19, 26 March 2011 (CET)

Revision as of 13:04, 26 July 2011

Docelement is not the 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)

Thanks! This clears it up! --BigChimp 14:04, 26 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)