File: widget1.xsd
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <xsd:schema targetNamespace="http://www.example.org/widget"
- elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="http://www.example.org/widget">
- <xsd:complexType name="WidgetType">
- <xsd:sequence>
- <xsd:element name="Name" type="xsd:string"/>
- <xsd:element name="ProductID" type="xsd:unsignedInt"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="Widgets">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="Widget" type="tns:WidgetType" minOccurs="1" maxOccurs="65536"/>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
In this file I want to redefine the maxOccurs attribute for Widget to 10.
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <xsd:schema targetNamespace="http://www.example.org/widget" elementFormDefault="qualified"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/widget">
- <xsd:include schemaLocation="widget1.xsd"/>
- <xsd:redefine schemaLocation="widget1.xsd">
- <xsd:complexType name="Widgets">
- <xsd:complexContent>
- <xsd:restriction base="Widgets">
- <xsd:sequence>
- <xsd:element name="tns:Widget" maxOccurs="10"/>
- </xsd:sequence>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:redefine>
- </xsd:schema>
Multiple annotations found at this line:
- src-resolve.4.1: Error resolving component 'Widgets'. It was detected that 'Widgets' has no namespace, but components with no target namespace are not referenceable from schema document 'file:///C:/Projects/Test/XMLSchema/Widget/widget2.xsd'. If 'Widgets' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'Widgets' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:///C:/Projects/Test/XMLSchema/Widget/widget2.xsd'.
- src-redefine.5.b.d: 'restriction' does not have a 'base' attribute that refers to the redefined element, 'http://www.example.org/widget,Widgets'. <complexType> children of <redefine> elements must have <extension> or <restriction> descendants, with 'base' attributes that refer to themselves.
I tried replacing Widgets in the <redefine> with tns:Widgets hoping to get rid of the namespace error but that doesn't work either.
What does this error mean? And is what I'm trying to do possible at all?
Thanks for your help, Ashish