Hi James
That's true as far as it goes but then when some "real" XML arrives - and
eventually it will - then a full XML parser will be called for. This will
probably come about after the in-house parser breaks or processes the new
XML incorrectly. By incorrect I mean doing things like inserting entities
into the database as though they were actual text, so columns will contain
data like "Steptoe & Son Ltd" instead of "Steptoe & Son Ltd".
What you're describing is text masquerading as XML, not XML.
When sending data the same principle applies; the data to be transmitted is
not simply some text stuck between a couple of tags formatted to look like
XML - the data has to be encoded as well, so it's a bit more complex than
building some strings that look like XML.
Having been burned on this once I'd go the route of doing it properly and
using a parser and XML-aware tooling from the start.
Regards
Evan Harris
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of James H. H. Lampert
Sent: Friday, 4 December 2009 5:21 a.m.
To: RPG programming on the IBM i / System i
Subject: Re: So let me get this straight.... (XML in RPG)
Larry Ducie wrote:
I would consider this statement to be true only if you can guarantee
the XML element to be found is uniquely named, and the unique name
will exist in one and only one XPath location. Even with these
guarantees you have to consider that other XML elements may have a
name that begins with this name and this element may/may not have
attributes. These two combined can cause false positives:
Indeed. Very well put.
Then again, if you're parsing it with something less than a full XML
parser, you're probably going to be parsing a small, highly predictable,
family of XML data streams, rather than actually parsing XML as XML.
At least, that's what I've done, where XML data streams been shoved down
my throat with no other meaningful alternative offered.
--
JHHL
As an Amazon Associate we earn from qualifying purchases.