Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could please shed some light on targetNamespace, schemaLocation, elementFormDefault ?

 
Himal Chuli
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks,
i would appreciate you guys could shed some light on tagetNamespace, schemaLocation, elementFormDefault and attributeFormDefault in schema showing the implication of their use?
thanks.
himal
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) targetnamespace is the namespace for which you are defining your elements in your schema for; Suppose you defined a schema called XX.xsd for a targetnamespace YY (say)
<xsd:schema xmlns:xsd="......"
targetnamespace="YY"
elementFormDefault="qualified">
............
</xsd:schema>
2) The elements of the instance document should belong to be the namespace YY for the schema XX.xsd to be applied for them as shown here
<root xmlns="YY"
schemaLocation="YY XX.xsd">
......
</root>
3) the elementFormDefault can be "qualified/unqualified". If qualified, you need to qualify every element in the instance document to be belonging to the targetnamespace. Unqualified means you must qualify only the global elements. This is no way changes the intent of schema validation, but only reduces the complexity of namespaces in the instance document elements.
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jayadev
I believe this is incorrect. The value of targetNamespace should be a uri. However, I could not find a syntax spec from W3, only tons of examples. There are no exceptions. All are uri. BTW, there is a case problem in the following attribute name too.
targetnamespace="YY"

If you find anything more concrete, please let me know. Thanks!
Roseanne
[ October 23, 2002: Message edited by: Roseanne Zhang ]
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to explain just the concept there.
 
Niraj Sheth
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Roseanne Zhang:
Jayadev
I believe this is incorrect. The value of targetNamespace should be a uri. However, I could not find a syntax spec from W3, only tons of examples. There are no exceptions. All are uri. BTW, there is a case problem in the following attribute name too.

If you find anything more concrete, please let me know. Thanks!
Roseanne
[ October 23, 2002: Message edited by: Roseanne Zhang ]


"YY" is also an uri syntactically. It is not URL but it qualifies as an URN.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic