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

Home » Public Forums » archive » Muddling Through XML Files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Muddling Through XML Files [message #43856] Thu, 05 May 2005 14:02 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Hi Folks,

I'm back onto the big XML project. :-(

I'm muddling through, but I have a question. I'm busting through
a configuration file, reading tags and making widgets as I go.
All of this works nicely. But eventually I come to a "sensor"
tag that is significantly different from all the other tags
in the file, and needs to be processed differently.

What I would like to do, and what I have been led to believe
other languages allow you to do, is take that whole tag, with
all of its sub-tags, out of that file and send it somewhere
else for processing. I can't seem to make out how to do that
among the millions (alright, *thousands*) of XML objects
sitting here in front of me. :-(

Any ideas?

Thanks,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Muddling Through XML Files [message #43991 is a reply to message #43856] Fri, 06 May 2005 08:41 Go to previous message
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
On Thu, 05 May 2005 15:02:03 -0600, David Fanning wrote:

> Hi Folks,
>
> I'm back onto the big XML project. :-(
>
> I'm muddling through, but I have a question. I'm busting through
> a configuration file, reading tags and making widgets as I go.
> All of this works nicely. But eventually I come to a "sensor"
> tag that is significantly different from all the other tags
> in the file, and needs to be processed differently.
>
> What I would like to do, and what I have been led to believe
> other languages allow you to do, is take that whole tag, with
> all of its sub-tags, out of that file and send it somewhere
> else for processing. I can't seem to make out how to do that
> among the millions (alright, *thousands*) of XML objects
> sitting here in front of me. :-(

I'm assuming that you just want to write a subroutine that handles
sensor elements. All you should need to do is pass the objref of the
Element (IDLffXMLDOMElement) of that sensor node to that subroutine.
Then, that subroutine can freely visit the sensor's children to do what it
needs to do. If the subroutine needs to find the document containing the
sensor for some reason, you can use IDLffXMLDOMNode::GetOwnerDocument for
that, rather than passing it as an extra parm to your subroutine.

But you say "out of the file". If this means writing the sensor element
and its children to a new file, try the following:

oClone = oSensorElement->CloneNode(/DEEP)
oSensorDoc = OBJ_NEW('IDLffXMLDOMDocument')
oSensorDoc->appendChild(oClone)
oSensorDoc->Save, FILENAME='sensor.xml'
OBJ_DESTROY, oSensorDoc

Karl
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: readu sees unexpected records
Next Topic: type conversion

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

Current Time: Fri Oct 10 06:14:26 PDT 2025

Total time taken to generate the page: 1.19905 seconds