× 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.



Unless I completely mis-understand DOM Joe, XML-INTO is not a DOM parser.

It isn't necessarily a DOM parser but it has DOM-like features. The
bummer about DOM is that it uses up more CPU cycles than the
traditional SAX approach because you are going all over the document
(potentially) with "random access". I guess you could chalk it up as
making it easier for programmers and that CPU's are getting bigger all
the time.

<vendor>
Anyways, my team has been working on the next version of RPG-XML Suite
(www.rpg-xml.com) and we have started implementing DOM like features
as shown below. I wouldn't say it is "purist DOM" but instead DOM in
how we thought it worked the best :-) We were basically looking for a
way to easily gain access to data in an XML document without pointers
(or more specifically, procedure pointers).


/copy rxs,rxscp

D gError ds likeds(RXS_Error) inz

D gLineItemCnt s 10i 0
D gCompCnt s 10i 0
D gXml s like(RXS_XMLData)
D i1 s 10I 0
D i2 s 10I 0

D gOrd ds qualified inz
D cstId 7 0
D item likeds(gLineItem) dim(10)

D gLineItem ds qualified inz
D itemId 15a
D compId 6a dim(10)
/free

gXml =
'<order custId="123">' +
'<lineItem itemId="HAT111">' +
'<component id="11" />' +
'<component id="12" />' +
'<component id="13" />' +
'</lineItem>' +
'<lineItem itemId="HAT222">' +
'<component id="21" />' +
'<component id="22" />' +
'<component id="23" />' +
'</lineItem>' +
'</order>';

DOM_build( gXml : RXS_VAR : gError ); // Parse the document
into memory

gOrd.cstId = RXS_charToNbr(DOM_getData('/order@custId'): 0);

// Process lineItem elements
gLineItemCnt = DOM_getDataCount('/order/lineItem');
for i1 = 1 to gLineItemCnt;
gOrd.item(i1).itemId =
DOM_getData('/order/lineItem': i1: '@itemId');

// Process components for this specific line item.
gCompCnt = DOM_getDataCount('/order/lineItem': i1: '/component');
for i2 = 1 to gCompCnt;
gOrd.item(i1).compId(i2) =
DOM_getData('/order/lineItem': i1: '/component': i2 :'@id');
endfor;
endfor;

DOM_cleanup();
*inlr = *on;

/end-free
</vendor>

Aaron Bartell
http://mowyourlawn.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.