comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » GetLastChild
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: GetLastChild [message #73065 is a reply to message #72960] Fri, 22 October 2010 11:32 Go to previous messageGo to previous message
Karl[1] is currently offline  Karl[1]
Messages: 79
Registered: October 2005
Member
On Oct 22, 9:42 am, Truong Le <truong...@gmail.com> wrote:
> On Oct 22, 11:04 am, Truong Le <truong...@gmail.com> wrote:
>
>
>
>> On Oct 21, 7:29 pm, David Fanning <n...@dfanning.com> wrote:
>
>>> Doug Edmundson writes:
>>>> The ALL_CHILDREN and N_CHILDREN keywords to WIDGET_INFO() should do the
>>>> trick.
>
>>> Better than my low-tech solution, probably. ;-)
>
>>> Cheers,
>
>>> David
>
>>> --
>>> David Fanning, Ph.D.
>>> Fanning Software Consulting, Inc.
>>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
>> Hi All,
>
>> Thank you for responses. I am pretty new to all these. However, I want
>> to get the last child using
>> the similar method that I get for the first child without using the
>> "item" keyword.
>> Below is how I go about obtaining the value of the first child.
>
>>   doc = OBJ_NEW('IDLffXMLDOMDocument', FILENAME=filename)
>>   elementValue = ((((doc->GetFirstChild())-> $
>>     GetElementsByTagName(elementName))->item(0))-> $
>>     GetFirstChild())->GetNodeValue()
>
>> Thanks,
>
>> Truong
>
> Okay, I think I found a way to resolve my problem, and here it is.
>
>   doc = OBJ_NEW('IDLffXMLDOMDocument', FILENAME=filename)
>   totalChild = (((doc->GetLastChild())-> $
>     GetElementsByTagName(elementName)))-> $
>     GetLength()
>
>   elementValue = ((((doc->GetFirstChild())-> $
>     GetElementsByTagName(elementName))->item(totalChild-1))-> $
>     GetFirstChild())->GetNodeValue()
>
> Thank you all!

I bet I was one of the few who knew that you were talking about the
DOMDocument object instead of widgets.

GetLastChild() should work. Maybe if you post some sample XML that
you are using and the code that uses GetLastChild that does not work,
someone can figure out what is going on.

I note that you use doc->GetLastChild to get the count and then doc-
> GetFirstChild to get the parent of the element list. But I think
that both end up referring to the same object, so that should be ok.

You might try turning on the option to ignore ignorable whitespace.
Sometimes ignorable whitespace objects appear in the tree in
unexpected places and can interfere with accessing the elements.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: FTGET error
Next Topic: Re: PostScript and TrueColor images

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 13:55:55 PDT 2025

Total time taken to generate the page: 1.20027 seconds