- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Gotta love third party vendors who think they know everything, eh?
Admin
If that's the biggest problem you've got with XML and interoperability, you're a very lucky person.
Just accept the single quotes.
Admin
{Sound of forehead hitting desk}
Admin
MSIE's behind-the-scenes error correction has effectively made erroneous HTML, XML, etc. the de facto standard, and for the sake of compatibility the rest of the world is forced to "comply" with this undocumented "standard." Suck!
Admin
The wtf is that they're using notepad on vista, right?
Admin
{Sound of a second forehead hitting desk}
Admin
The WTF is that they wrote "away" instead of "a way".
Admin
And these guys do programming for living ? This story gives me the creeps. I do not think they were serious. Either they were joking or trying to save face. I refuse to believe that someone actually believes that notepad does ANY conversion when loading the file (other than maybe char-encoding).
Admin
Follow up by posting screenshots of the XML file opened in WordPad, Word, TextPad, and a hex viewer.
Admin
{Sound of the vendor's head hitting my desk}
Captcha: ewww (the response from the vendor's head hitting my desk)
Admin
I have fought very similar fights with clients/3rd party vendors. I finally got my point across when I made them open up the the file in a hex editor and take a look at the actual hex values.
Admin
OK, correct me if I'm wrong, but doesn't XML allow both single and double quotes to be used for attribute values?
Admin
thank you for your prompt reply. Consulting my calendar, I see that I will be busy early next week taking bids from your three main competitors. Pursue the Notepad issue if you wish; however, in all likelihood, by the time you respond I will be too involved with them to discuss your findings with you.
Regards, Client
Admin
Well then you simply haven't lived in the business world long enough. This struck me as one of the more boring WTF stories, because responses like that happen so often.
Admin
"XMLSpy and IE both correct minor errors". Maybe this should have given Rick a clue as to how to proceed.
Admin
Yeah, Ender, I had the same question. If they're sending valid XML, why do you care. The WTF is probably a do-it-yourself parser that doesn't hew to the standard.
Admin
Actually, attribute values should be delimited by double quotes. It does not say that they should not be delimited by anything else. Because of this, parsers were written to handle both. Because some parsers handle both (like IE's) but the spec says double quotes, IE will convert the singles to doubles and happily churn along.
This doesn't seem bad until you start embedding quotes inside your attribute values and get away from the standard. Imagine what would happen when IE converts the following wrong implementation: value='He said "Hello" to her.' Please stick with the standard, encode your embedded quotes and let every parser work, not just those that look at your bad code and try to fix it for you.
Admin
Admin
http://www.w3.org/TR/REC-xml/
'string'
Admin
The spec does not say to use double quotes. It says either is acceptable. Here, I am assuming "the spec" refers to the XML 1.0 specification, Fourth Edition: http://www.w3.org/TR/2006/REC-xml-20060816/
And then, in the grammar:Admin
http://www.w3.org/TR/REC-xml/
[41] Attribute ::= Name Eq AttValue
[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"
Admin
Who uses an XML parser that only allows "" for attributes these days?
Admin
As if! Most of us peons are stuck with a wretched company like this because our "higher-ups" bought the sales pitch.
And, couldn't agree more about Microsoft screwing up the standards.
Admin
The vendor is correct. Notepad routinely translates and filters what you try to say to it.
Proof: http://www.entropiaforum.com/forums/wlwc/28871-things-you-cant-say-notepad.html
Admin
This is genius!
Admin
http://www.w3.org/TR/2006/REC-xml-20060816/#NT-AttValue
Notice that both single and double quotes are explicitly allowed.
Admin
This reminds me of an incident I faced a few months ago. The vendor I was dealing with on my project requested that I send some samples of the web services requests we would be sending, so I sent them as .xml files. The vendor's representative (this was a tester, not a developer, but I still don't call it an excuse) asked that I please send the file as a .txt file, because, when she opened the file, it had little symbols in front of the text. It took me some time to realize that she was double clicking on the file and it was opening in IE, and the "little symbols" were the "+" and "-" icons IE provides to allow you to collapse and expand elements of an XML file.
Admin
well... we use text files because binary is harder. but seems even text is too hard for some people.
theres something called monospace. the concept of plant/text or tools called hex-editor hex-viewer
anything of this will fix this people problem.
but maybe whas originated on a non-tecnical guy, like the reply email was written by management, and not the tecnical guys.
Admin
It's that simple.
Admin
To sum up this dialogue: Rick: "Hey Terry, my dick's bigger." Terry: "No, mine is." Rick: "No, mine is."
Admin
Please RTFStandard before asking other people to stick with it. The standard does not require you to use double quotes, or escape inner quotes that differ from the outer quotes.
This has been in the spec at least since the 1996 working draft.
I don't need to imagine it because I actually tested it: IE simply displays the outer and inner quotes in different colors, which IMO is acceptable for an XML viewer.
Admin
As some commenters have already said, the clueless WTFer's are on both sides : QUOTES ON ATTRIBUTES ARE VALID XML.
So if you're having trouble parsing xml files because of quotes, it means you're parsing it with a homebrew and not so smart parser.
Pot, meet kettle and go pool your resources to buy a clue.
Admin
I always tought the utility of notepad was actually to see text files without any formatting....
Admin
The real WTF is that anyone thought this was a WTF
Admin
Unfortunately, not all that uncommon a phenomenon. :-(
Admin
Admin
Yes, it does.
Admin
The worrying thing is, I can't think of any xml library in any language that would generate some attribute values enclosed in ' and others in "
Which can only mean they are hand crafting the xml... errk
Admin
Not only that, but add to it the fact that they will spend all this time in a pissing contest and not spend 5 minutes actually TRYING the fix to see if it works. Even after they verified his notepad screenshot. Which means they had it open in a medium that would allow them to fix it RIGHT THEN. They were literally a few clicks away from the fix, but chose to continue the arguement instead. Unfortunately, there is probably no way to explain (in terms they can understand) this to management which means you are stuck with this vendor regardless of the level of stupidity they exhibit. And for those that don't know, yes this happens ALL the time with some vendors.
Admin
Indeed, it is the last member of not-so-intelligent programs. That's why you need it so badly: no transforms, no automatic changes of files, and simply open everything that is called a file.
Admin
When the XML document is tiny and/or guaranteed to have a static structure, it's perfectly reasonable to decline involving a lumbering XML library.
Admin
The real WTF is that they are fighting about wether attributes are delimited by single ' or double " when the standard clearly allows both. Insisting otherwise is just standardization-by-hearsay:
STag ::= '<' Name (S Attribute)* S? '>' Attribute ::= Name Eq AttValue AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"
http://www.w3.org/TR/REC-xml/#NT-AttValue
The reason IE shows the attributes all as double quotes is because it's parsing the XML to a DOM tree, before displaying it again using the default style sheet. Parsing the XML loses the information about what delimiters were used around the attribute because it isn't actually important.
I can accept confusion about XMLs dusty corners and gnarlier features: entity references, doctypes, system identifiers, DTDs, CDATA and namespaces. But XML at the simplest lexical level: element and attribute ought not be a source of confusion for a competent programmer.
Admin
Am I the only one that finds it strange that XMLspy would change the 's to "s? If they're correct, then I would want to see them as they are. If they're wrong, then I still want to see them as they are. XMLspy's functionality is deteriorated IMHO because of this one bug.
Admin
I totally agree, this kind of "background correction of minor errors" is rahter a bug, not a feature.
Admin
Agreed. If there's a mistake in the XML being viewed, the viewer should report the problem, not fix it on the sly. At least make a user-configurable option to fix small problems quietly, after prompting, or never. (Default to never.)
Admin
WTF 1: insisting single quotes are not allowed WTF 2: insisting notepad replaces quotes The Real WTF™: using XML
Interestingly, feed this to IE:
You'll see something like: All correctly syntax-highlighted, mind you, so evidently it gets parsed correctly, but the resulting display is not valid XML even when we ignore the +/- thingies.Admin
Admin
The real WTF is the idiot who thought the XML he was being sent was flawed for containing single quoted attribute values. That's different from what most people seem to have assumed, which is that the WTF was the person stating there was no problem with the XML but the viewer (though that might qualify as a WTF in its own right, albeit of a lesser proportion).
Admin
It's seems every one is missing the point of the article... Those people thought that Notepad was changing the quotes as IE does.
Anyway, the RealWTF is that they're using Vista.
$cat foo.xml
That's it Tesla!
Admin
Dear Client
It is with regret that we note our ironic humour did not hit the mark when we replied to your idiotic bug report with an equally idiotic response.
I wish you luck finding a vendor willing to provide you with a system that automagically works around your obviously flawed software that is incapable of parsing correct XML.
regards Competent People