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



Bill Tobiasson wrote:
...
XML-SAX(E) %Handler(HandleData:info) %XML(XML_Input:'doc=file');
...
I can not match up the attrName because there is always the first two
byte missing (& the 2 bytes are missing for the data also) on the string
for the event:

When event = *XML_START_ELEMENT;
(my prototype)
D HandleData PI 10I 0
D comm LikeDS(info)
D event 10I 0 Value
D string * Value
D stringLen 20I 0 Value
D exceptionId 10I 0 Value
...

Bill, it sounds like you used the VARYING keyword when you defined the based variable for the string pointer parameter.

Instead of using VARYING, code the based variable like this:

D theString S 65535A Based(string)

Then use %SUBST with the stringLen parameter:

comm.attrName = %subst(theString : 1 : stringLen);

The reason it's dropping the first two bytes is that the VARYING keyword says that the first two bytes represent a numeric prefix holding the current length. A 30A VARYING field is actually 32 bytes long, 2 bytes for the length prefix and 30 bytes for the data.

If you tell the compiler that a field is varying when it is not actually varying, it will still try to interpret the first two bytes as the length, and it will think that the data doesn't start until the 3rd byte.


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.