[fpc-pascal] another xml question
Marc Santhoff
M.Santhoff at web.de
Thu Aug 6 14:21:46 CEST 2015
On Do, 2015-08-06 at 01:11 -0700, Chris Moody wrote:
> Hi Marc,
>
> Thanks for the feedback. One more question and I think I'm done for now
> and able to finish the program I'm writing:
>
> If FindNode does not locate a node with the given name, what does it
> return?
I don't know. It looks like it would be the first child of the subnode
you're working at. I'm not sure if that first child can be a nil
pointer, so you need to check yourself or someone else has to answer
this question.
But it is easy to jump to the implementation of FindNode() yourself:
1. Put the cursor on the function call to <yourxmldoc>.FindNode()
2. klick the right mouse key
3. in the popped up menu select "Find Declaration of FindNode"
4. hit the keys Shift+down (arrow)
After Step 3 you're shown the class declaration, then after the fourth
step the cursor is sitting in the implementation of the method in
question. Then you can read the code.
Have fun,
Marc
> Thanks,
>
> Chris
>
> On 07/24/2015 01:34 PM, Marc Santhoff wrote:
> > 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
> >
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
--
Marc Santhoff <M.Santhoff at web.de>
More information about the fpc-pascal
mailing list