XSD key/keyref: hierarchical key structure?

Even if many children, there will only be one parent, and combining the (parent,child) creates a globally unique key, even though the child key is only unique within its parent.

Even if many children, there will only be one parent, and combining the (parent,child) creates a globally unique key, even though the child key is only unique within its parent: This doesn't work in xmllint, even though the spec doesn't seem to explicitly disallow this for fields - only for selectors: 3.11.4, (2) says the selector can't be an ancestor (it can only be the context node or descendants. ) Ah, here's the nail in the coffin (looking at specific syntax): the XPath expressions allowed are very limited, and simply don't include ".." w3.org/TR/xmlschema-1/#c-fields-xpaths So, sorry, this doesn't answer your question, but maybe it will give you some ideas.

1 Yeah; I had tried that myself and made the same discovery about the strict limitations on selector and field xpath expressions. Nice idea in theory, though. Thanks for the efforts!

– Aron May 22 '09 at 0:14 I conjecture that in combining this constraint, together with the other constraint you found (for an xpath to refer to only one node), there is a proof that what you want to do is impossible in XSD - I bet the proof (if there is one) is very simple, but I can't quite see it. – 13ren May 22 '09 at 2:24.

It's become noisy last I checked, but some of the creators of xml were still hanging out there.

Yeah, that would be a possibility, but I think it causes more problems than it solves...as you say, ugly. My design has moved away from this structure for external reasons, so it's more of an academic exercise at this point, but maybe I'll give the list a try. Thanks for the idea!

– Aron Jun 4 '09 at 1:47.

I had a similar question: stackoverflow.com/questions/1348753/xml-... I decided that the best approach for me was to reorder the XML to allow for the scope to be determined by locality instead of enforcing a key with two fields. In your scenario, if you move referrer inside the parent, this will allow the scope to be set to reference the appropriate child. You would then have the referrer element refer to the outer scope to the element that it needs to reference.It is a little hard to determine if this is an acceptable solution because your problem appears to be a little abstracted.

In my problem, described in my question, I was dealing with questions, answers, and user responses. I originally was trying to validate if a user's response was actually a valid answer; my first approach involved a same technique you are using.My final solution involved moving the response to inside the question, and then referring to the user. My XML BEFORE: yes white no blue Do you like the color red?

Yes no What is your favorite color? Red blue white yellow My XML AFTER: Do you like the color red? Yes no yes no What is your favorite color?

Red blue white yellow white blue.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions