Comment On The XML Escape

"One day, our logistics analysis vendor interface completely broke down," wrote Ben Davis, "that's a Bad ThingTM, as our primary focus is to provide logistical services to our clients." [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Re: The XML Escape

2012-01-11 08:07 • by ParkinT
Why not replace all ampersands with the the three characters AND ?!

Or would that inhibit their ability to apply SQL queries to the XML string?

Re: The XML Escape

2012-01-11 09:02 • by Null (unregistered)
You obviously failed to read the article.

Re: The XML Escape

2012-01-11 09:06 • by Fr3nchie (unregistered)
371606 in reply to 371601
ParkinT:
Why not replace all ampersands with the the three characters AND ?!

If they could have done that, they also could have replaced all ampersands with the five characters "&".

Re: The XML Escape

2012-01-11 09:07 • by Pim
I'll buy that for a &.

Re: The XML Escape

2012-01-11 09:12 • by Boeboe
We once asked a customer to properly xmlencode special characters when sending over xml. This is what we got:
<customer_name>Brandon & Sons</customer_name>

:(

Re: The XML Escape

2012-01-11 09:14 • by DonaldK (unregistered)
I suppose before they change the &'s to $'s, they should change the $'s to something else... but they cannot change it to USD, so it'll have to be # (most likely), which will probably translate to the pound symbol... hahahaha.

They're fixing the symptom not the root cause...

Wait until they get other special characters like "ë" etc... they also sometimes throw off home-grown (and M$, I mean M& developed) XML parsers.

But that's a problem for another day I guess...

Re: The XML Escape

2012-01-11 09:18 • by Blue Leader (unregistered)
Sweet. I'm naming my next company <FooCo/> -- I wonder how many XML apps will choke on that.

Re: The XML Escape

2012-01-11 09:19 • by OneMist8k (unregistered)
This WTF happens all the time at my company, except the trading partners say "We'll get right on it and fix it," but they never do.

Home-grown XML generators. Bleg.

2012-01-11 09:24 • by anonymous_coder() (unregistered)
I've torn out like 10 different ones in our codebase, all written differently. It seems like a rite of passage for crap programmers to try and reimplement an XML parser or generator. Badly.

I actually had to do it because some of the homegrown solutions were bogging down the server... Yay XML::LibXML and Devel::NYTProf::Apache.

My boss didn't believe me until I stepped through the profiling results with him.

Re: The XML Escape

2012-01-11 09:25 • by Demo (unregistered)
How about:

* U+FE60 ﹠​ small ampersand
* U+FF06 &​ fullwidth ampersand
* U+214B ⅋​ inverted ampersand

Re: The XML Escape

2012-01-11 09:26 • by frits
371615 in reply to 371606
Fr3nchie:
ParkinT:
Why not replace all ampersands with the the three characters AND ?!

If they could have done that, they also could have replaced all ampersands with the five characters "&amp;".
That's cool. But what about the infinite recursion problem when replacing the leading character in "&amp;" with "&amp;"? Did you think about that?

Re: The XML Escape

2012-01-11 09:32 • by Old Crow T. Robot (unregistered)
I hope his company isn't doing any business with Ke$ha's production company.

Re: The XML Escape

2012-01-11 09:34 • by Andrei Rinea (unregistered)
What if the content legitimately contains a dollar sign? Wouldn't that be wrongly converted to an ampersand? Bunch of losers..

Re: The XML Escape

2012-01-11 09:36 • by Anon (unregistered)
CDATA to the rescue!

Re: The XML Escape

2012-01-11 09:39 • by Pim
371623 in reply to 371609
DonaldK:
Wait until they get other special characters like "ë" etc...
In theory, you can put things like that in an XML file without problems. As long as, in theory, the encoding is right.

Anyway, seriously now. I don't understand why they didn't simply use a plus sign. Brandon + Sons sounds much more like Brandon & Sons than Brandon $ Sons. Doesn't it.

Re: The XML Escape

2012-01-11 09:42 • by Anonymous Guy (unregistered)
because you would never need $ as a real character right....

awful

Re: The XML Escape

2012-01-11 09:44 • by faoileag (unregistered)
371627 in reply to 371615
frits:
Fr3nchie:
ParkinT:
Why not replace all ampersands with the the three characters AND ?!

If they could have done that, they also could have replaced all ampersands with the five characters "&amp;".
That's cool. But what about the infinite recursion problem when replacing the leading character in "&amp;" with "&amp;"? Did you think about that?

You don't like &&&&&&&&&&&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp; constructs?
CAPTCH: ingenium - a true ingenium way of handling &'s in XML

Re: The XML Escape

2012-01-11 09:46 • by Hexadecima (unregistered)
371628 in reply to 371616
Old Crow T. Robot:
I hope his company isn't doing any business with Ke$ha's production company.


Hey, I just got off the phone with Micro&oft.

Re: The XML Escape

2012-01-11 09:51 • by Mr Keith (unregistered)
The next time they invoice for maintenance, send them a check payable in &

Re: The XML Escape

2012-01-11 09:52 • by Andrew (unregistered)
371630 in reply to 371601
ParkinT:
Why not replace all ampersands with the the three characters AND ?!

Or would that inhibit their ability to apply SQL queries to the XML string?


If they could do multi-character replacement, then I choose "WTF".

Re: The XML Escape

2012-01-11 09:54 • by renewest
The only proper way out of this mess is to change the name of the customer.

Re: The XML Escape

2012-01-11 09:55 • by BentFranklin
Instead of replacing the ampersand, try replacing the vendor.

Re: The XML Escape

2012-01-11 09:58 • by Lockwood
They're changing all the longs to strings?!

Re: The XML Escape

2012-01-11 10:06 • by Laurent (unregistered)
371635 in reply to 371601
ParkinT:
Why not replace all ampersands with the the three characters AND ?!


Because the original string might not be in english ?

Re: The XML Escape

2012-01-11 10:10 • by dkf
371636 in reply to 371620
Anon:
CDATA to the rescue!
Which is fine as long as your data doesn't contain the sequence “]]>”…

Re: The XML Escape

2012-01-11 10:13 • by boog
Long story short, it was absolutely impossible for them to do a multi-character replacement...
Maybe it's written in C. I seem to recall that multi-character search-and-replace wasn't exactly a straightforward process.

As for "absolutely impossible"... maybe for their programmers, it seems...

Re: The XML Escape

2012-01-11 10:15 • by Nagesh (unregistered)

String Nagesh = "<customer_name>Brandon & Sons</customer_name>";
System.out.println("Substitution string = " + Nagesh.replace('&', '&amp;');


Test.java:4: unclosed character literal

System.out.println("Substitution string = " + Nagesh.replace('&'
, '&amp;');

^

Re: The XML Escape

2012-01-11 10:19 • by boog
371639 in reply to 371615
frits:
But what about the infinite recursion problem when replacing the leading character in "&amp;" with "&amp;"? Did you think about that?
I'm pretty sure you'd replace the leading character in "&amp;" with &quot;

Re: The XML Escape

2012-01-11 10:21 • by Noread (unregistered)
371640 in reply to 371611
Blue Leader:
Sweet. I'm naming my next company <FooCo/> -- I wonder how many XML apps will choke on that.

Why not go all the way and name your company <Foo]]>Co/>.

Re: The XML Escape

2012-01-11 10:25 • by frits
371643 in reply to 371639
boog:
frits:
But what about the infinite recursion problem when replacing the leading character in "&amp;" with "&amp;"? Did you think about that?
I'm pretty sure you'd replace the leading character in "&amp;" with &quot;
You're lack of understanding of English Language syntax surprises me.

Re: The XML Escape

2012-01-11 10:27 • by Tomatoman
Sometimes the solution to the problem is so simple that nobody seems to notice. Why not ask Brandon & Sons to rename their business? I wouldn’t advise ‘Brandon $ Sons’, but ‘Brandon, Bart and Bobbie’ would be just fine.

Re: The XML Escape

2012-01-11 10:29 • by Anon (unregistered)
371645 in reply to 371643
>You're

0/10
Try harder.

Re: The XML Escape

2012-01-11 10:30 • by AndreiR23
What if the content legitimately contains a dollar sign? Wouldn't that be wrongly converted to an ampersand? Bunch of losers..

Re: The XML Escape

2012-01-11 10:34 • by Ben (unregistered)
Infinite recursion of replacing & with &amp;... unclosed character literals...

Code trolls make me cry inside.

Re: The XML Escape

2012-01-11 10:36 • by Jaime
Our EDI team did exactly this to us a few years ago. We negotiated XML as an interchange format and in testing we started getting files with unescaped ampersands.

Also, when we sent them data, they choked on all of our data. The hand-built test files had each element on a separate line, and our chose parser didn't add line breaks between elements. We were blamed for "changing the format".

I sent them a link to the XML spec and they responded "we can't do all that". To this day, we exchange pseudo-XML with a pre-processor on our end.

Re: The XML Escape

2012-01-11 10:38 • by Bob (unregistered)
371649 in reply to 371618
Andrei Rinea:
What if the content legitimately contains a dollar sign? Wouldn't that be wrongly converted to an ampersand? Bunch of retards..

Please attempt some sensitivity: I had a son who was retarded, and let me assure you it is no laughing matter.

Re: The XML Escape

2012-01-11 10:42 • by boog
371650 in reply to 371643
frits:
boog:
frits:
But what about the infinite recursion problem when replacing the leading character in "&amp;" with "&amp;"? Did you think about that?
I'm pretty sure you'd replace the leading character in "&amp;" with &quot;.
You're lack of understanding of English Language syntax surprises me.
Your right, I forgot the period at the end of my sentence, silly me. Sorry.

Sorry, everyone.

Re: The XML Escape

2012-01-11 10:43 • by boog
371651 in reply to 371649
Bob:
Please attempt some sensitivity: I had a son who was retarded...
Did he get better?

Re: The XML Escape

2012-01-11 10:49 • by Smitt-Tay (unregistered)
The real WTF is XML.

The whole 'self-describing' thing is stupid, unnecessary, and nearly impossible to implement, so, avoid the hassle. Write data protocols which match your data, don't squeeze your data into a generic protocol.


Re: The XML Escape

2012-01-11 10:49 • by SCSimmons
371653 in reply to 371651
boog:
Bob:
Please attempt some sensitivity: I had a son who was retarded...
Did he get better?
He probably got a job with this vendor.

Re: The XML Escape

2012-01-11 10:53 • by dkf
371654 in reply to 371649
Bob:
Please attempt some sensitivity: I had a son who was retarded, and let me assure you it is no laughing matter.
Don't worry. He takes after his father.

Re: The XML Escape

2012-01-11 10:55 • by Anon (unregistered)
371655 in reply to 371627
faoileag:
frits:
Fr3nchie:
ParkinT:
Why not replace all ampersands with the the three characters AND ?!

If they could have done that, they also could have replaced all ampersands with the five characters "&amp;".
That's cool. But what about the infinite recursion problem when replacing the leading character in "&amp;" with "&amp;"? Did you think about that?

You don't like &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;amp; constructs?


FTFY - but I guess that's expected from somebody who includes their CAPTCHA in their post.

Re: The XML Escape

2012-01-11 10:58 • by philz
371656 in reply to 371648
Jaime:
Our EDI team did exactly this to us a few years ago. We negotiated XML as an interchange format and in testing we started getting files with unescaped ampersands.

Also, when we sent them data, they choked on all of our data. The hand-built test files had each element on a separate line, and our chose parser didn't add line breaks between elements. We were blamed for "changing the format".

I sent them a link to the XML spec and they responded "we can't do all that". To this day, we exchange pseudo-XML with a pre-processor on our end.


I knew I am not alone!
Fnac (http://en.wikipedia.org/wiki/Fnac) does exactly this.

Plus you cannot use shorthands like <field/> for an empty field.

Re: The XML Escape

2012-01-11 10:59 • by Nagesh
One time I work on request to make sure that there are exact number of cariage return marks in an address field.

That was big WTF. I send story to Alex, but it not published yet.

Re: The XML Escape

2012-01-11 11:00 • by Joe (unregistered)
371658 in reply to 371640
Noread:
Blue Leader:
Sweet. I'm naming my next company <FooCo/> -- I wonder how many XML apps will choke on that.

Why not go all the way and name your company <Foo]]>Co/>.

<Foo]]-->Co;/>'or 1=1;drop table customers

And yes, we've all seen the XKCD reference, no need to repeat it.

--Joe

Re: The XML Escape

2012-01-11 11:00 • by acsi (unregistered)
371659 in reply to 371615
frits:
Fr3nchie:
ParkinT:
Why not replace all ampersands with the the three characters AND ?!

If they could have done that, they also could have replaced all ampersands with the five characters "&amp;".
That's cool. But what about the infinite recursion problem when replacing the leading character in "&amp;" with "&amp;"? Did you think about that?


frits, you're high this morning

Re: The XML Escape

2012-01-11 11:05 • by Ken B. (unregistered)
371660 in reply to 371640
Noread:
Blue Leader:
Sweet. I'm naming my next company <FooCo/> -- I wonder how many XML apps will choke on that.

Why not go all the way and name your company <Foo]]>Co/>.
ITYM ]]><![CDATA[. And, of course, Bobby Tables would be the CEO.

Re: The XML Escape

2012-01-11 11:08 • by Jaime
Another stupid XML one... HP's iLO technology that allows low-level management of servers (things like remotely power cycling a hung server) has an XML based communications protocol. However, the response to any command is formatted like this:

<RIBCL VERSION="2.22"/>
... stuff ...
</RIBCL>

So, it's not possible to parse the response with any XML parser.

It also occasionally returns multiple complete XML documents, complete with an XML directive for each. Example:

<?xml version="1.0"?>
... result 1 ...
<?xml version="1.0"?>
... result 2 ...

Re: The XML Escape

2012-01-11 11:11 • by Ken B. (unregistered)
371662 in reply to 371650
boog:
Your right, I forgot the period at the end of my sentence, silly me. Sorry.
Yes, you're supposed to have the period placed so that it's on your right, not my right.

Re: The XML Escape

2012-01-11 11:20 • by frits
371663 in reply to 371659
acsi:
frits:
Fr3nchie:
ParkinT:
Why not replace all ampersands with the the three characters AND ?!

If they could have done that, they also could have replaced all ampersands with the five characters "&amp;".
That's cool. But what about the infinite recursion problem when replacing the leading character in "&amp;" with "&amp;"? Did you think about that?


frits, you're high this morning
Right, because I totally meant that, Captchaman.
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Add Comment