[fpc-pascal] another xml question

Marc Santhoff M.Santhoff at web.de
Fri Jul 24 22:34:15 CEST 2015


On Fr, 2015-07-24 at 11:57 -0700, Chris Moody wrote:

> Would it be easiest to introduce a fourth element to the XML that says 
> how many children the 3rd element has? Or is there an easy way already 
> to get this and just run a for next loop to read each child?

Maybe sth. like this would do:

<counted_element count=3>
	<child>1>/child>
	<child>2>/child>
	<child>3>/child>
</counted_element>

or similar. Besides making the count an attribute of the root node of
counted elements you could simply use a standard pascal loop:

n: XMLNode;

{ this is only pseude code ... }
while (xmldoc.hasMoreChilds()) do begin
	n := getChild();
	... process n ...
end:

For real code http://wiki.freepascal.org/XML_Tutorial mwill help.

HTH,
Marc

-- 
Marc Santhoff <M.Santhoff at web.de>




More information about the fpc-pascal mailing list