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



Peter,

That's one of the reasons XML works great as a concept, but not always such
in reality.

There are standards, but unless everyone follows them, it won't work. And
rarely do I see someone follow XML standards to a "T" (except for very
large companies that provide data to thousands of customers and it would be
bad not to).

If you're sending XML to someone and just whipped up a quick program to
send data to one person, you probably will overlook encoding special
characters.

The way I see it, if someone sends you bad XML you tell them to fix it or
you can't process it. I understand "the customer is always right" but, in
this case, they're not. And I wouldn't want to write catches for all the
possible errors that could happen with poorly formatted XML.

Easier said than done, I know. :)

Brad
www.bvstools.com


On Tue, May 13, 2014 at 2:37 AM, Peter Connell <Peter.Connell@xxxxxxxxxx>wrote:

Developers parsing xml should be aware of the pre-requisite to encode
entity references like ampersand.
What I'm asking is for an explanation of the rather counter-intuitive
handling of the event when the sax parser when encounters an ampersand..
It is not unreasonable to be sent a large xml file from a customer who may
not have sufficient checks on populating xml values.

---Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
thomas.raddatz@xxxxxx
Sent: Tuesday, 13 May 2014 6:10 p.m.
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: XMLSAX parser handling for embedded ampersand


Peter,

It is not XML-SAX that fails parsing the xml document due to a bug, but
the creator of the document who made the mistake. The ampersand is a xml
special character that needs to be encoded as "&amp;".

For example (taken from "ILE RPG Reference":

xmlDocument =
'<meeting>+
<attendee name="Jack" company="A&amp;B Electronics"/>+
<attendee company="City&#x2B; Waterworks" name="Jill"/>+
<attendee name="Bill" company="Ace Movers" extra="yes"/>+
</meeting>';

Is parsed and printed as:

Attendee Jack is from company A&B Electronics
Attendee Jill is from company City+ Waterworks

Feel free to refer to w3schools for details:

http://www.w3schools.com/xml/xml_syntax.asp

Regards,

Thomas.

rpg400-l-bounces@xxxxxxxxxxxx schrieb am 13.05.2014 01:32:39:

Von: Peter.Connell@xxxxxxxxxx
An: RPG400-L@xxxxxxxxxxxx,
Datum: 13.05.2014 01:33
Betreff: XMLSAX parser handling for embedded ampersand Gesendet von:
rpg400-l-bounces@xxxxxxxxxxxx

XMLSAX does not appear to allow you to handle data like "smith&brown"
( supplied by customer in a large file ) The parser raises a an
*XML_EXCEPTION event when the ampersand is
encountered.
Even if you code for *XML_EXCEPTION events to ignore them it appears
that once encountered all subsequent events are returned as
*XML_EXCEPTION.

Some IBM doco says an ampersand should generate *XML_UNKNOWN_REF but I
always get *XML_EXCEPTION Another IBM doco says a limitation of XMLSAX
is that it does not handle ampersand.

Anybody found this?




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

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.
If you need assistance, please contact Veda on either :- Australia
customerassistance@xxxxxxxxxxx or New Zealand +64 9 367 6200
--
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.



--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and email confirmation to the
sender.
--
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.


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

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.
If you need assistance, please contact Veda on either :-
Australia customerassistance@xxxxxxxxxxx or New Zealand +64 9 367 6200
--
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.