FHIR Chat · XML Schema Question · implementers

Stream: implementers

Topic: XML Schema Question


view this post on Zulip Stephen Royce (Aug 26 2016 at 06:27):

I was looking around at the spec the other day and noticed that StructureDefinition.snapshot.element is an ElementDefinition (nothing new in that) which inherits from Element (which also may not be new, but I'd not picked up on it before). Anyway Element has an id element and so I added IDs to all the elements in my StructureDefinitions and they all immediately failed schema validation because I'd used an (XML) element instead of an (XML) attribute. This seems to be a deviation from the practice everywhere else and I'm just wondering why? Wouldn't it be better to be consistent with DomainResource?

view this post on Zulip Grahame Grieve (Aug 26 2016 at 06:32):

in the last 3 years (since it changed to be like this) you're the first person to comment on it

view this post on Zulip Grahame Grieve (Aug 26 2016 at 06:33):

resource.id is important. And we used an element because that's what's done on other XML REST APIs

view this post on Zulip Grahame Grieve (Aug 26 2016 at 06:34):

other than that, we had always used attribute for the id since it has the same function as ithe xml id attribute - target of references.

view this post on Zulip Stephen Royce (Aug 26 2016 at 06:43):

That's fine; I was just curious; and, in fact, it did occur to me that actually Resource.id might be the odd one out since I have often wondered why that's an (XML) element instead of an attribute because that's not typical XML schema design.

view this post on Zulip Grahame Grieve (Aug 26 2016 at 06:43):

and it would be a little odd to reference #id as a subelement of the actual element

view this post on Zulip Grahame Grieve (Aug 26 2016 at 06:44):

and resource.id is *not* the same in meaning as XML id attribute

view this post on Zulip Stephen Royce (Aug 26 2016 at 06:45):

I don't understand why that is. Wouldn't it be better to do it that way too? Or does the ReST thing cause problems then?

view this post on Zulip Grahame Grieve (Aug 26 2016 at 06:46):

that it's meaing is different?

view this post on Zulip Stephen Royce (Aug 26 2016 at 06:46):

Yeah. It's still just an ID, right?

view this post on Zulip Grahame Grieve (Aug 26 2016 at 06:47):

not in the same sense. it doesn't identify the element. It's an external identifier

view this post on Zulip Stephen Royce (Aug 26 2016 at 06:47):

So why not represent it as an (xml:)id?

view this post on Zulip Grahame Grieve (Aug 26 2016 at 06:47):

because no one else does. and we introduced that specifically to match expectations of simlarity

view this post on Zulip Stephen Royce (Aug 26 2016 at 06:48):

So that depends on what you think the id attribute is; is it the id of the element or is an XML serialisation of id of the concept?

view this post on Zulip Stephen Royce (Aug 26 2016 at 06:49):

The former is not very useful.

view this post on Zulip Stephen Royce (Aug 26 2016 at 06:50):

Especially because then 2 serialisation of the same thing in 2 different places need different IDs and that's a huge pain because now you've got to use other data as the ID.

view this post on Zulip Stephen Royce (Aug 26 2016 at 06:52):

If you actually use xml;id, of course, then you have no choice, but id in your own namespace can be more flexible.

view this post on Zulip Stephen Royce (Aug 26 2016 at 06:54):

Anyway, it's a moot point, and hardly worth the effort debating; I really was just curious.


Last updated: Apr 12 2022 at 19:14 UTC