XML Hell

Oct. 29th, 2015 06:42 pm
billroper: (Default)
[personal profile] billroper
I'm currently being bedeviled by some interesting XML to parse. To wit:


<myObject>
<this value=fred>
</this>
<that value=barney>
</that>
</myObject>


Ok, you can parse this, but why would you want to? Shouldn't this be:


<myObject this=fred that=barney>
</myObject>


Or even:


<myObject this=fred that=barney />


It's like they were being paid by the character...

XML tricks

Date: 2015-10-30 12:57 am (UTC)
hazelchaz: (Default)
From: [personal profile] hazelchaz
Would this work equally well?


Fred
Barney


My thought is that it's generated by a program that works well enough to accurately assemble XML that does what it's supposed to do, and once it reached that point there was no interest in optimizing it further.

Re: XML tricks

Date: 2015-10-30 04:26 am (UTC)
hazelchaz: (Default)
From: [personal profile] hazelchaz
Well, source code is usually generated by human beings too. The same principle applies -- the person learning XML a bit at a time learned enough about the syntax to create something that parsed correctly, and then stopped.

Date: 2015-10-30 01:52 am (UTC)
mdlbear: blue fractal bear with text "since 2002" (Default)
From: [personal profile] mdlbear
Of course, what you're more likely to see is

<myObject>
  <property name="this" value="fred" />
  <property name="that" value="barney" />
</myObject>

Did I mention that I don't like XML very much?
Edited Date: 2015-10-30 01:53 am (UTC)

Date: 2015-10-30 12:26 pm (UTC)
madfilkentist: My cat Florestan (gray shorthair) (hex)
From: [personal profile] madfilkentist
It depends on what went into the schema. If a lot of other options exist (e.g., address, phone, etc.), it may make sense for the schema to make "this" and "that" separate tags. But if the parameter really is "value", and not something specific like "name", that's a problem.

I've seen too many complicated XML schemas to have an opinion without detailed information, which I understand you can't give out here.

Date: 2015-10-30 08:25 pm (UTC)
From: [identity profile] whl.livejournal.com
You've seen schemas? The first place I worked at that used XML, I asked if we had a schema, and was told that we (and the cell phone carrier feeding us data) just sort of made it up as we went along.

Which explains why, when I had that company moved to Pittsburgh out from under me, my new boss (who at one time had been my boss at the old place; pretty much the whole development team moved en masse across the Kennedy to avoid Pittsburgh), I found that I was the guy in charge of our XML schema, and the code to validate against it...

Profile

billroper: (Default)
billroper

December 2025

S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 28th, 2025 11:02 pm
Powered by Dreamwidth Studios