[fpc-pascal] How to read TDOMNode attributes

Frank Church vfclists at gmail.com
Sat Dec 3 02:13:23 CET 2011


On 2 December 2011 20:43, Sven Barth <pascaldragon at googlemail.com> wrote:

> On 02.12.2011 21:26, Frank Church wrote:
>
>>
>>
>> On 2 December 2011 19:45, Mattias Gaertner <nc-gaertnma at netcologne.de
>>
>> <mailto:nc-gaertnma@**netcologne.de <nc-gaertnma at netcologne.de>>> wrote:
>>
>>    On Fri, 2 Dec 2011 19:30:17 +0000
>>    Frank Church <vfclists at gmail.com <mailto:vfclists at gmail.com>> wrote:
>>
>>     > On 2 December 2011 19:09, Mattias Gaertner
>>    <nc-gaertnma at netcologne.de <mailto:nc-gaertnma@**netcologne.de<nc-gaertnma at netcologne.de>
>> >>wrote:
>>
>>     >
>>     > > On Fri, 2 Dec 2011 18:59:25 +0000
>>     > > Frank Church <vfclists at gmail.com <mailto:vfclists at gmail.com>>
>>
>>    wrote:
>>     > >
>>     > > > Is there a way of knowning the attribute count of a TDOMNode
>>    as well as
>>     > > > reading the value of an attribute if it exists?
>>     > >
>>     > > HasAttribute:=(Node is TDOMElement) and
>>     > > (TDOMElement.hasAttribute('**Name'));
>>     > >
>>     > > Attribute value:
>>     > >
>>     > > if Node is TDOMElement then
>>     > >  Value:=TDOMElement(Node).**GetAttribute('Name')
>>     > > else
>>     > >  Value:='';
>>     > >
>>     > >
>>     > > Mattias
>>     > > ______________________________**_________________
>>     > > fpc-pascal maillist  - fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
>>    <mailto:fpc-pascal at lists.**freepascal.org<fpc-pascal at lists.freepascal.org>
>> >
>>
>>     > > http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>>     > >
>>     >
>>     > Is there a way of counting the attributes and listing them out if
>>    you don't
>>     > know what they are in advance, or some kind of iteration which
>>    will tell
>>     > you when you are on the last item or there are none at all?
>>
>>    You may want to read the fpc xml tutorial:
>>    http://wiki.freepascal.org/**XML_Tutorial#Printing_the_**
>> names_of_nodes_and_attributes<http://wiki.freepascal.org/XML_Tutorial#Printing_the_names_of_nodes_and_attributes>
>>
>>    Mattias
>>    ______________________________**_________________
>>    fpc-pascal maillist  - fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
>>    <mailto:fpc-pascal at lists.**freepascal.org<fpc-pascal at lists.freepascal.org>
>> >
>>
>>    http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>>
>>
>>
>> The example you pointed doesn't show what I am looking for, but it led
>> me to one that does -
>> http://wiki.freepascal.org/**XML_Tutorial#Populating_a_**
>> TreeView_with_XML<http://wiki.freepascal.org/XML_Tutorial#Populating_a_TreeView_with_XML>
>> .
>>
>> The method in question is the TDomNode.Attributes.Length property. I
>> thought something like that shoud exist but I was looking for a Count
>> property. Shouldn't it be count instead?
>>
>
> FPC's XML implementation is based on the DOM specification by W3C. And
> there it defined as "length". Also changing it to "count" would break
> existing code.
>
>
I am now familiarizing myself with XML. I suspect anyway that there had to
be a reason for it.


> Regards,
> Sven
>
> ______________________________**_________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.**org<fpc-pascal at lists.freepascal.org>
> http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>
>



-- 
Frank Church

=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111203/9fddfc1c/attachment.html>


More information about the fpc-pascal mailing list