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



dmosley@xxxxxxxxxx wrote:

I don't really like the idea of looping thru the 'events' of the XML
string, to get values. It just seemed a bit....loose. Meaning, if I
wanted to loop thru all my <tags> and retrieve it's values, and do
something with them, then this loop process just appeared to be a bit
'old school'.

Okay, well that "old school" process is called 'SAX'. That's what SAX is. Anywhere on any platform using any SAX API, you do that.

So, what I did instead was for every "*XML_START_ELEMENT" event, I
would take the <tag> name and execute an XML-INTO to get the tag's
value.

Uhhhhmmm.. that won't work, will it? What happens if you have the same tag name more than once in your document?

Most XML documents that I work with have a structure similar to this (my example is a little abstract... sorry about that)

<doc>
<transaction>
<struct>
<field1>value</field1>
<field2>value</field2>
</struct>
<field3>value</field3>
</transaction>
<transaction>
<struct>
<field1>value</field1>
<field2>value</field2>
</struct>
<field3>value</field3>
</transaction>
</doc>

If you get to the 'transaction' element and it fires the *XML_START_ELEMENT event... then you call XML-SAX for doc/transaction, right? For the first instance of the transaction element, that's no problem. But when you get to the 2nd one, you'll get the value from the first one, won't you?

If you want to avoid XML-SAX, why not use XML-INTO for the whole document?

If you can't use XML-INTO because there's an element or attribute name you can't access with XML-INTO, then why not wrap the XML-SAX logic in a service program? Yes, you may have to write code that you find unpleasant, but you'd only have to do it once and could then reuse that data over and over again -- you'll never have to do it again.

As far as I can tell, the way you're doing it now is not valid.

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.