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



Sharon wrote:
when event = *XML_CHARS; eventval = event + 1; if %subst(chars : eventval : stringLen) = 'DataArea'; pathvalue = pathvalue; endif;
EVAL chars
CHARS = ....5...10...15...20...25...30...35...40...45...50...55...60 1 ' <DataArea> <storeNumber>7</storeNumber> <trans'

DataArea appears to be an element in your XML file (your DTD from the previous message* also shows this). You should be processing the DataArea start tag using the *XML_START_ELEMENT event.

I haven't written code using XML-SAX, but based on my experience with other SAX parsers, I think the *XML_CHARS event is meant to return the characters _between_ elements. Based on the XML document you posted in your other message*, I think that '%subst(chars : 1 : stringLen)' should be equal to the following values for the first few *XML_CHARS events:
1: x'0D25' - this is the END_OF_LINE marker for the first line
2: x'0D25' - this is the END_OF_LINE marker for the second
3: x'0D254040' - this is the END_OF_LINE marker for the third line,
plus the two spaces preceding the <DataArea> tag.
4: x'0D2540404040' - this is the END_OF_LINE marker for the fourth
line, plus the leading spaces of the sixth line
5: '7' or x'F7' - this is the value contained in the <storeNumber>
element.

As you can see, *XML_CHARS should fire for _any_ data that is between elements, including whitespace characters. The XML-SAX opcode has an option that allows you to trim whitespace, so you'd end up with empty strings for 1-4. That may help you simplify the *XML_CHARS processing. According to Barbara Morris, there is even an example of this in the XML-SAX documentation**.

I've found Jon Paris and Susan Gantner's articles in IBM Systems magazine helpful for these sorts of topics. This one*** covers XML-SAX, and should help you get a better handle on how your SaxHandler routine ought to work.

Hope this helps,
Adam

* http://archive.midrange.com/rpg400-l/200811/msg00144.html
** http://archive.midrange.com/rpg400-l/200704/msg00184.html
*** http://www.ibmsystemsmag.com/i5/march06/coverstory/9021p5.aspx

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.