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

Home » Public Forums » archive » Re: read XML with IDL
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
Re: read XML with IDL [message #71668] Wed, 14 July 2010 06:58 Go to next message
KRDean is currently offline  KRDean
Messages: 69
Registered: July 2006
Member
On Jul 14, 3:59 am, sh <sebastian.h...@gmail.com> wrote:
> Hello together,
>
> I already searched in the archive, but I didn't find a clear answer.
>
> Every time you want to read .xml files, you have to write your own
> parser (e.g. .edit xml_to_struct__define.pro) right?
>
> But is there a possibilty to build up a struct automatically? E.g. the
> input .xml file
>
> <Solar_System>
>    <Planet NAME='Mercury'>
>       <Orbit UNITS='kilometers' TYPE='ulong64'>579100000</Orbit>
>       <Period UNITS='days' TYPE='float'>87.97</Period>
>       <Satellites TYPE='int'>0</Satellites>
>    </Planet>
>   ...
> </Solar_System>
>
> output in IDL (structs within a "main" struct) the name of struct and
> tags depends on the name of elements and the attributes
>
> solar_system={solar_system,planet:{planet,orbit:
> {orbit,units:'kilometers',type:'ulong64',value:'579100000'}, period:
> {period,units:'days',type:'float',value:'87.97'},satellites:
> {satellites,type:'int',value:'0'}}}
>
> print, solar_system.planet.orbit
> { kilometers ulong64 579100000}
>
> print, solar_system.planet.orbit.value
> 579100000
>
> My questions are now: Should I write my own parser? Should I wait for
> IDL8, maybe there are more adv. features for XML? Or does someone have
> already such a routine?
>
> thanks,
> Sebastian

Have you looked into xml_to_struct__define.pro example provided with
the IDL distribution?

I would think you have, as ths Solar System XML is the example they
use to turn into a structure.

IDL Help provides a tutorial for this example code.

Kelly Dean
Fort Collins, CO
Re: read XML with IDL [message #71755 is a reply to message #71668] Wed, 14 July 2010 12:16 Go to previous message
Karl[1] is currently offline  Karl[1]
Messages: 79
Registered: October 2005
Member
On Jul 14, 7:58 am, kBob <krd...@gmail.com> wrote:
> On Jul 14, 3:59 am, sh <sebastian.h...@gmail.com> wrote:
>
>
>
>> Hello together,
>
>> I already searched in the archive, but I didn't find a clear answer.
>
>> Every time you want to read .xml files, you have to write your own
>> parser (e.g. .edit xml_to_struct__define.pro) right?
>
>> But is there a possibilty to build up a struct automatically? E.g. the
>> input .xml file
>
>> <Solar_System>
>>    <Planet NAME='Mercury'>
>>       <Orbit UNITS='kilometers' TYPE='ulong64'>579100000</Orbit>
>>       <Period UNITS='days' TYPE='float'>87.97</Period>
>>       <Satellites TYPE='int'>0</Satellites>
>>    </Planet>
>>   ...
>> </Solar_System>
>
>> output in IDL (structs within a "main" struct) the name of struct and
>> tags depends on the name of elements and the attributes
>
>> solar_system={solar_system,planet:{planet,orbit:
>> {orbit,units:'kilometers',type:'ulong64',value:'579100000'}, period:
>> {period,units:'days',type:'float',value:'87.97'},satellites:
>> {satellites,type:'int',value:'0'}}}
>
>> print, solar_system.planet.orbit
>> { kilometers ulong64 579100000}
>
>> print, solar_system.planet.orbit.value
>> 579100000
>
>> My questions are now: Should I write my own parser? Should I wait for
>> IDL8, maybe there are more adv. features for XML? Or does someone have
>> already such a routine?
>
>> thanks,
>> Sebastian
>
>  Have you looked into xml_to_struct__define.pro example provided with
> the IDL distribution?
>
>  I would think you have, as ths Solar System XML is the example they
> use to turn into a structure.
>
>  IDL Help provides a tutorial for this example code.
>
> Kelly Dean
> Fort Collins, CO

IDLffXMLSAX
and
IDLffXMLDOM

are two XML parsers that come with IDL. I think that the SAX parser
would help here.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: PRINTF printing to wrong LUN
Next Topic: Re: How to allocate memory for an array of more than 2G

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

Current Time: Wed Oct 08 11:40:51 PDT 2025

Total time taken to generate the page: 0.00434 seconds