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

Home » Public Forums » archive » GENERIC XML READER
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
GENERIC XML READER [message #64182] Tue, 09 December 2008 04:43 Go to next message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Hello people,

I'm trying to write a generic xml reader. Since today I used to read
the xml using the elements name like:

oDesc = (oItem->GetElementsByTagName('description'))

Is it posible to create a generic xml reader? Anybody have any kinds
of examples or codes?

Thanks,
bernat
Re: GENERIC XML READER [message #64257 is a reply to message #64182] Wed, 10 December 2008 13:31 Go to previous message
Karl[1] is currently offline  Karl[1]
Messages: 79
Registered: October 2005
Member
On Dec 10, 9:34 am, Bennett <juggernau...@gmail.com> wrote:
> On Dec 9, 7:43 am, bernat <bernat.puigdomen...@gmail.com> wrote:
>
>> Hello people,
>
>> I'm trying to write a generic xml reader. Since today I used to read
>> the xml using the elements name like:
>
>> oDesc = (oItem->GetElementsByTagName('description'))
>
>> Is it posible to create a generic xml reader? Anybody have any kinds
>> of examples or codes?
>
>> Thanks,
>> bernat
>
> What do you mean by generic?  There are ways to just read out the
> entire xml file but I would think you would be looking for something
> specific to extract from an xml file in order to do anything useful
> with it.  So do you mean a function that would search an xml file for
> a specific tag/text/attribute/etc....?

The original request is a bit vague. Usually, an application reads an
XML file to extract very specific information. So a "generic" reader
is a bit undefined.

If you simply want to read the XML and store the result in memory,
that is exactly what the DOM model does for you. You would just walk
the tree and create objects for each DOM element. As a result, you
would then have read the entire file and have access to all the data
via the objects.

Since XML files are just text, one could write a program to walk the
DOM tree and simply "print out" every XML element. You'd have to
decide what "print out" means for each XML element type, but I think
that is possible. I imagine one could get a bit creative and generate
a graphical visualization of the DOM tree by drawing a tree with a
node for each Element. You could hang attributes off of each node
that has attributes, etc. Another approach would be to dump the tree
in a text format, indenting the text based on tree depth. It would be
a challenge to handle both deep and wide trees well.

I mentioned "walking" the tree twice above. I'm certain that there
are several examples in the IDL XMLDOM documentation that show you how
to write IDL code to walk the entire DOM tree. These routines would
generically "read" the file for you without regard to context or
content. It would then be up to you what to do with each node.

Karl
Re: GENERIC XML READER [message #64265 is a reply to message #64182] Wed, 10 December 2008 07:34 Go to previous message
Juggernaut is currently offline  Juggernaut
Messages: 83
Registered: June 2008
Member
On Dec 9, 7:43 am, bernat <bernat.puigdomen...@gmail.com> wrote:
> Hello people,
>
> I'm trying to write a generic xml reader. Since today I used to read
> the xml using the elements name like:
>
> oDesc = (oItem->GetElementsByTagName('description'))
>
> Is it posible to create a generic xml reader? Anybody have any kinds
> of examples or codes?
>
> Thanks,
> bernat

What do you mean by generic? There are ways to just read out the
entire xml file but I would think you would be looking for something
specific to extract from an xml file in order to do anything useful
with it. So do you mean a function that would search an xml file for
a specific tag/text/attribute/etc....?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Anyone can explain this?
Next Topic: Which subroutine is used to calculate the decimal order of an array?

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

Current Time: Fri Oct 10 07:27:09 PDT 2025

Total time taken to generate the page: 2.16043 seconds