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



Jon,



The reason for developing my own XML reader was many, but here are some of
the majors



- XML-INTO isn’t supported before V5R4

- XML-INTO in V5R4 is very limited because of storage limits and
the need to make dim’s, the standard form UI in powerEXT Framework is XML
based and even just specifying simple forms in XML hit the roof.

- XML-INTO is inflexible, you have to specify the whole structure
from your entry point in DS to get to the data

- XML-INTO doesn’t support XPATH

- XML-INTO hasn’t any solution (as my last snippet) to save a
large file at document level for archiving.



XML-INTO is basic simple XML support nothing else, it doesn’t support
dividing datasets to be stored as documents in archive systems or anything
else that is required in an legal EDI document environment, being in X12,
EDIFACT or XML.



XML-INTO is theoretical based, not real life practical based where you
receive big envelopes (as in X12/EDIFACT) and you have to bind pieces to
financial transactions such as a specific A/R, A/P or group of G/L
transactions – and you have to be able to trace them back.



Yes this can be done by placing the data in house files, the problem is
that isn’t legal – in any electronic communication you need the original –
so you have to see it in a broader application perspective.



Besides having a standard financial system running on IBM I that covers
A/R, A/P and G/L – my core business is also EDI and that has been that for
20 years, I have been member of the group that defined EDI standards within
the banking and book industry in Denmark and the EU, both in EDIfact and
XML and I also was an active part and supplied several open sourced XSLT
transformations when we in Denmark went from paper to total electronic
administration within the invoicing field (of course in UTF-8).



My XML converter does what it needs to do, read the info you need, nothing
else – it snaps any information in even complex hierarchical structures
without prior definition of hierarchical structures.


And besides that – when I set it in HTML mode – it becomes an evil reader
of homepages ;-)


On Thu, Mar 7, 2013 at 8:46 PM, Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:


On Thu, 7 Mar 2013, at 18:48:29, Henrik R?tzou <hr@xxxxxxxxxxxx> wrote:

Jon,

lets make this a little more interesting:

d elements ds qualified
d type 50a varying inz('A')
d len 10p 0
d dataalpha 1024a varying
...

That just captures the type, length etc. of an individual element - it
isn't storing it in the variable indicated by the element name etc. So
you're not comparing like with like.

Given this XML

<Customers>
<Customer>
<Name>Fred</Name>
<Address>Any street, Anytown</Address>
<Balance></Balance>
</Customer>
<Customer>
<Name>Joe</Name>
<Address>Another street, Differenttown</Address>
<Balance>155.99</Balance>
</Customer>
<Customer>
<Name>Jane</Name>
<Address>Another Raod, Newtown</Address>
<Balance>None</Balance>
</Customer>

This code (not tested) will load all elements into the DS where individual
fields can be processed by name. Significantly, if I add 5 more elements to
the XML I can process it by simply adding 5 more lines to the DS.

D Customers ds Qualified
D Customer LikeDS(Customer_T) Dim(99)
D countCustomer 5i 0

D Customer_T DS Template Qualified
D Name 30a
D Address 80a
D Balance 10a

D Balance s 9p 2 Dim(99)

D i s 5i 0 Inz

/Free

XML-INTO Customers %XML('/wherever/test.xml':
'doc=file countprefix=count');

For i = 1 to Customers.countCustomer;
Monitor;
Balance(i) = %Dec(Customers.Customer(i).Balance: 9: 2);
On-Error; // Signal error identifying element in error and set
default.
Balance(i) = 0; // Or choice of default
Dsply ('Invalid Balance element ' + %Char(i) + ' Value '
+ Customers.Customer(i).Balance);
EndMon;
EndFor;

This I believe would handle the issue that the OP raised and also my point
about invalid numeric values. It also enables just about every field
definition to be made via the LIKE keyword in the DS to match the database
defs.

That's what XML-INTO can do.

I have no argument that your solution is better and easier than hand
coding XML-SAX - but I think XML-INTO is better suited in many cases.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com




--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





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.