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



You can also read the XML into a DOM using XML4PR, you can then navigate the
DOM to any element you like.

This can be inefficient for very large documents but does work well for
small to medium sized ones.

XML4PR also has the SAX parsers in it too.

I haven't as of yet been able to get XPATH working, but you can do something
like.

QxmlDOMNOde_getElementsByTagName(RootNode:'Company');

Then foreach Company Node


QxmlDOMNOde_getElementsByTagName(CompanyNode:'registered_assets');

Then foreach registered_assets

QxmlDOMNOde_getElementsByTagName(reg_assets:'asset');

Then with each of the assest you can do whatever you like, i.e.
QXMLDOMNode_getValue etc.

It takes a little getting used to but with some simple wrapper methods you
can create some pretty power xml "parsing" code.

Neill


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Peter Connell
Sent: 20 June 2010 00:42
To: 'RPG400-L@xxxxxxxxxxxx'
Subject: XML-INTO nested handlers

I cannot find a way to specify a path option on XML-INTO which resolves to a
specific instance of an element which occurs multiple times.
For example, a response returns many <company> elements as per the snippet
below.

Since there can be too many to load then I can write a handler procedure
handle up to say 50 <company> elements at a time by specifying a
path=response/company. No problem.
But each company may have up to 1000 <asset> elements returned within a
<registered_assets> element (in actual fact, each asset could itself have
further child elements of its own) .
Because there may be too many assets to load, I would like write a handler
to accommodate up to 1000 <asset> elements, say 50 at a time, which would be
nested within the handler for each <company> element
The path would be expected to be something like
path=response/company(1)/registered_assets/asset. This would allow me to
iterate thru all the assets for each company, 50 at a time.
But alas, it does not seem possible to resolve a path to the assets of a
specific company element. The only alternative seems to be resorting to
XML_SAX.

<response>
<company>
<name>company 1</name>
<registered_assets>
<asset>data for item
1</asset>
<asset>data for item
2</asset>
<asset>data for item
3</asset>
</registered_assets>
</company>
<company>
<name>company 2</name>
<registered_assets>
<asset>data for item
1</asset>
<asset>data for item
2</asset>
<asset>data for item
3</asset>
</registered_assets>
</company>
<company>
<name>company 3</name>
<registered_assets>
<asset>data for item
1</asset>
<asset>data for item
2</asset>
<asset>data for item
3</asset>
</registered_assets>
</company>
</response>

Peter

Visit our website www.vedaadvantage.com. It has a new design with improved
navigation and search capabilities; and customer friendly interface with
more relevant insights and solutions to help you make informed decisions.

############################################################################
#########

This correspondence is for the named person's use only. It may contain
confidential
or legally privileged information, or both. No confidentiality or privilege
is waived
or lost by any mistransmission. If you receive this correspondence in error,
please
immediately delete it from your system and notify the sender. You must not
disclose,
copy or rely on any part of this correspondence if you are not the intended
recipient.
Any views expressed in this message are those of the individual sender,
except where
the sender expressly, and with authority, states them to be the views of
Veda Advantage.
If you need assistance, please contact Veda Advantage on either :-
Australia 1300-921-621 or New Zealand +64 9 367 6200

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.