Can an XML instance remain valid if its associated schema changes elementFormDefault (unqualified -> qualified)?
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 43
- Joined: Tue Jul 26, 2016 6:31 pm
Can an XML instance remain valid if its associated schema changes elementFormDefault (unqualified -> qualified)?
I change schema A into new schema B, which is identical to A except that elementFormDefault goes from unqualified -> qualified.
How does an XML instance that was valid per A become valid per B?
Under what circumstances is an XML instance valid under both A and B?
I.e. is the change elementFormDefault (unqualified -> qualified) always (or sometimes) backward compatible?
How does an XML instance that was valid per A become valid per B?
Under what circumstances is an XML instance valid under both A and B?
I.e. is the change elementFormDefault (unqualified -> qualified) always (or sometimes) backward compatible?
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Can an XML instance remain valid if its associated schema changes elementFormDefault (unqualified -> qualified)?
Hi Michael,
The specs can be read here:
https://www.w3.org/TR/xmlschema-0/#ref50
As far as I know the elementFormDefault controls only the default namespace of elements declared locally in the XML Schema.
If the XML Schema has no target namespace attribute set on it, the attribute value should not matter.
Also if you do not have any local declared elements the attribute value should not matter at all.
Let's say we have a simple XML Schema looking like this:
It declares a global element named a and a local element named "b". Because you have elementFormDefault="qualified", the declared "b" element is interpreted as being in the testNs namespace so this XML file instance is valid:
If you remove the "elementFormDefault="qualified" " from the XML Schema and validate again the XML instance, the validation will complain as it would expect the "b" element to be in no namespace.
So a valid XML instance would look like this:
Regards,
Radu
The specs can be read here:
https://www.w3.org/TR/xmlschema-0/#ref50
As far as I know the elementFormDefault controls only the default namespace of elements declared locally in the XML Schema.
If the XML Schema has no target namespace attribute set on it, the attribute value should not matter.
Also if you do not have any local declared elements the attribute value should not matter at all.
Let's say we have a simple XML Schema looking like this:
Code: Select all
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" targetNamespace="testNs">
<xs:element name="a">
<xs:complexType>
<xs:sequence>
<xs:element name="b"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Code: Select all
<a xmlns="testNs"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="testNs test.xsd">
<b></b>
</a>
So a valid XML instance would look like this:
Code: Select all
<a xmlns="testNs"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="testNs file:/D:/projects/eXml/samples/dita/flowers/test.xsd">
<b xmlns=""></b>
</a>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service