Jump to content

Schema/xpath Integration


Jack McKalling
 Share

Recommended Posts

The tutorials about both Schema and XPath were not so difficult to go through. In fact, they made complete sence to me after two read throughs.However, I am making my first combination with both, and I seem to miss out on some examples. I reread everything, but I cannot find good examples on some of the more interesting things in Schema. If you want to key anything for instance, there is no explanation about how to do that. The reference page of XSD only shows the syntax of the nessecary elements, but no examples on how to make such a key constraint. Let allone how to reference it!As I know a lot about programming myself I can fix things fairly easily, but this might not be the case for everyone. Thus I would suggest some more examples about some of those elements not spoken about, like key, unique, selector, field, keyref, and especially, some examples on how to get them all linked together with XPath. Note that the accepted expressions for the XPath attribute isn't the same as the specification, so it is not easy to figure it out all by yourself. (I tried looking at the source of 'The' schema of all schema files, but it looks a little too complicated for going in deep, lol.So is this possible, or is there some reason behind the scheme/scene?

Link to comment
Share on other sites

XML Schema in general is regarded as being complicated. Getting into its more complicated parts in the tutorial would be quite troublesome for newbies. Image that you don't need keying, and yet you read it... it will just blow up your mind (the only reason it didn't blew mine was that I was already comfortable enough with the aspects of Schema I know already).I think if just the reference pages are filled with some examples, this would be enough.A note on the limited XPath is probably also a good idea. I have to say, I never would've thought it's THAT restrictive. I mean, from 3.11.6, it's

[1] Selector ::= Path ( '|' Path )* [2] Path ::= ('.//')? Step ( '/' Step )* [3] Step ::= '.' | NameTest [4] NameTest ::= QName | '*' | NCName ':' '*'
which basically means no predicates, no functions, no ancestor checks... waaay limiting. On the other hand, I suppose this is a must to make it easier for Schema to be used by streaming (SAX and SAX like) validators.
Link to comment
Share on other sites

Correct, I have read (somewhere on W3C) that the XPath used in schema is supposed to be restrictive, just for the convenience of the developer. I agree to that.You are also right about the fact schema is complicated in general, and explanations about keying etc might be no good in the normal flow of the tutorial. Though you didn't heared me saying where to put them :) I prefer them in the reference listing myself too, as that is the place where the elements are explained, and that is the place where you should be able to learn more about the usage, not in the tutorial pages. However, it could be chosen for to actually put some tutorial pages about them between the rest, with a statement of it being "advanced schema" or something, I have seen more such pages for other languages too. But it is a consideration only, discussable.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...