× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



 >Tracking states (nesting levels) is your problem.

That is what I had a problem with when I first starting parsing XML and
the reason I wrote the DOMParser.  But once I realized that the SAX
parser was nearly exactly the same as RPG level breaks when writing a
standard report I jumped on the SAX bandwagon.

The SAX parser notifies you of all events that occur (ie element begin,
element end, character data, etc), so in affect you have all the
necessary events to process an XML document just like you would a set of
Order Header and Order Detail files (i.e. parent child relationship).

Here is an example of the XMLSAX parser wrapper that I wrote:
http://mowyourlawn.com/temp/PARSE25.RPGLE

Also note that Scott Klement has a SAX parser wrapper for RPG that is
based on an open source.  All his needs is a nice Xpath interface and it
will operate pretty much like mine (hint, hint, if anybody wants to help
Scott out :-)

Just some comments,
Aaron Bartell


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] 
Sent: Monday, October 11, 2004 10:02 AM
To: rpg400-l
Subject: Re: XMLSAX (was [RPG XML] misuse of DOMXPath_getElemCount() ?)

Document Object Model (DOM)
Simple Application Programming Interface for XML (SAX)


Most XML parsers offer one or both interface/models.

As the name implies, SAX is simple parser.  You typically setup the
callback functions (procedure pointers) and it walks the document
calling your routines (tags, data).  It's usually faster and more
efficient the DOM model and can work well on very large documents.  But
because the document is processed sequentially, this can be less
convenient than the DOM model.
Tracking states (nesting levels) is your problem.

DOM APIs present a tree model interface which allow you can walk/process
the document in the order you choose.  From an application perspective
this can be easier to use, but it comes at the cost of being slower and
having larger memory requirements.


Keith



----- Original Message -----
From: "Dan Bale" <dbale@xxxxxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Monday, October 11, 2004 7:34 AM
Subject: XMLSAX (was [RPG XML] misuse of DOMXPath_getElemCount() ?)


> Aaron,
>
> Could you give a brief explanation of the XMLSAX parser?  Your web
site
> offers the download (which I am retrieving -- 22MB???) but little else
that
> I could see of that describes what it does.  I am also downloading the
> rpg-xml-parser from your Code page; is this something different from
XMLSAX?
>
> We are looking at a project in which we will need to "deal" with
> XML-formatted data, both in receiving it on the AS/400 from a PC
server
and
> sending it the other way as well.
>
> When your XML parsing is working in an RPG program, where is the XML
data?
> A stream file in the IFS?  A native AS/400 flat file?
>
> FYI, we are not using Java for our project.
>
> tia,
> db
>
> > -----Original Message-----
> > From: rpg400-l-bounces@xxxxxxxxxxxx / Bartell, Aaron L. (TC)
> > Sent: Monday, October 11, 2004 10:14 AM
> >
> > Use the SAX parser instead that is also on my site.  It is quite
faster
> > and less bulky.  I don't support the DOM parser wrappers I wrote
anymore
> > because the SAX parser is the one to use.
> >
> > BTW, if you know Java that is the way you should be processing your
XML.
> > WDSc has some amazing wizards to get you up and running with XML in
> > minutes, literally.
> >
> > Aaron Bartell
>
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.