Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Putting Common attribute groups in "headers"

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Say I have a Camera xsd and a model xsd which both make use of an attribute group called Vector
How do I make up the xsd file structure? and how do I share the attribute groups in the xsd files?
thanks
Jack
 
g tsuji
Ranch Hand
Posts: 656
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've got to be much more precise rather than making some partial abstraction of the statement of the problem because it's got to have some fairly intriguing co-relation among the elements and attributes to come up with a correct structure or structures. In particular, you should mention clearly in what namespaces are Camera, model and Vector and the attributes contained in the attribute group Vector.
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
g tsuji wrote:You've got to be much more precise rather than making some partial abstraction of the statement of the problem because it's got to have some fairly intriguing co-relation among the elements and attributes to come up with a correct structure or structures. In particular, you should mention clearly in what namespaces are Camera, model and Vector and the attributes contained in the attribute group Vector.


Attribute Group - Vector -> x, y, z

In Camera.xsd
Camera -> Eye Pos -> Vector -> x,y,z

In Model.xsd
Model -> Frame -> Mesh -> Vertex -> Vector -> x, y,z


Inside Camera and Model.xsd, both of which make use of the attribute group Vector, however, I don't want to define them twice in both xsds..
I want to put the attribute group vector in a common file which looks like the .h header in C++ so that they can share it and I don't have to re-define them in each file
Please let me know if you need further info.
BTW, belated merry christmas. happy holidays
Thanks
Jack
 
g tsuji
Ranch Hand
Posts: 656
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very well, as you've mentioned nothing about the possible complication on namespaces and that Camera and Model (or model?) schemas are completely independent, then I would not be surprised a simple xs:include would do. Just add this line right after the xs:schema root element of the schemas Camera.xsd and model.xsd.

and in the Common.xsd (supposedly in the same directory of Camera.xsd or Model.xsd), isolate out the definition of the attribute group.

And then you use ref="Vector" to refer to the attribute group Vector in the elements EyePos (no space admissible) and Vertex or their types.

Just be careful that if Camera.xsd and Model.xsd involve anything with non-null targetNamespace, xs:include could become problematic and you might have to test around with xs:import. In any case, since nothing of the sort is mentioned at all, I would leave the answer as such hoping no complications come up.
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say Camera and Model are completely independent, do you mean that a model would not use an instance of Camera? Sorry, I am a newbie to xsd
Thanks
Jack
 
g tsuji
Ranch Hand
Posts: 656
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say Camera and Model are completely independent,...

That's fine.
...do you mean that a model would not use an instance of Camera?

You can, but the Common would have to be the same copy (meaning one single copy in the same directory...) if there is no other complication to determine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic