473,323 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

XML Schema redefinition error

Hi, I'm trying to redefine the maxOccurs attribute of an element in a simple XML Schema using Eclipse's WTP plugin as my IDE.

File: widget1.xsd

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsd:schema targetNamespace="http://www.example.org/widget"
  3.   elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  4.   xmlns:tns="http://www.example.org/widget">
  5.  
  6.   <xsd:complexType name="WidgetType">
  7.     <xsd:sequence>
  8.       <xsd:element name="Name" type="xsd:string"/>
  9.       <xsd:element name="ProductID" type="xsd:unsignedInt"/>
  10.     </xsd:sequence>
  11.   </xsd:complexType>
  12.  
  13.   <xsd:element name="Widgets">
  14.     <xsd:complexType>
  15.       <xsd:sequence>
  16.         <xsd:element name="Widget" type="tns:WidgetType" minOccurs="1" maxOccurs="65536"/>
  17.       </xsd:sequence>
  18.     </xsd:complexType>
  19.   </xsd:element>
  20.  
  21. </xsd:schema>
  22.  
File: widget2.xsd
In this file I want to redefine the maxOccurs attribute for Widget to 10.

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsd:schema targetNamespace="http://www.example.org/widget" elementFormDefault="qualified"
  3.   xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/widget">
  4.  
  5.   <xsd:include schemaLocation="widget1.xsd"/>
  6.  
  7.   <xsd:redefine schemaLocation="widget1.xsd">
  8.     <xsd:complexType name="Widgets">
  9.       <xsd:complexContent>
  10.         <xsd:restriction base="Widgets">
  11.           <xsd:sequence>
  12.             <xsd:element name="tns:Widget" maxOccurs="10"/>
  13.           </xsd:sequence>
  14.         </xsd:restriction>
  15.       </xsd:complexContent>
  16.     </xsd:complexType>
  17.   </xsd:redefine>
  18.  
  19. </xsd:schema>
  20.  
However, validation fails on widget2.xsd and Eclipse reports this error

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
Jul 6 '10 #1
0 1540

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: ranma79 | last post by:
Hi, Has anyone played around with Schema Extensions to provide custom error messages when validating an XML file with an XSD? This is mentioned in Appendix B of O'Reilly's XML Schema book (page...
3
by: cody | last post by:
Hello fols. I'm doin a school project and have this stupid problem. We're on virtual functions and have to seperate out each class into a file. There are 9 classes and so 9 .h and .c files. the...
2
by: nepo | last post by:
I try to validate a complex schema using XSD and I get a series of errors of the following format: Validation Error:'http://xml.msdw.com/ns/mdco/data/1.0:tradeSymbol' cannot be a member of...
0
by: Harold Putman | last post by:
The XmlValidatingReader seems to have changed drastically in .Net Frameworks 1.0 SP3 and beyond with regards to validating XML files that are XML Schemas. Consider the following code: ---...
0
by: Sharad Garg | last post by:
Hi, I have the following scheme of things:- Schema1: targetnamespace A
16
by: Brad Wood | last post by:
I'm using a 2.0 XmlReaderSettings object with setting.ValidationType set to ValdationType.Schema to validate a document against a schema. Following is a schema fragment (names altered):...
5
by: vfunc | last post by:
Despite a #ifndef I am getting a redefinition error The offending .h file looks like the following #ifndef DISTRIB_H #define DISTRIB_H double dblpi; // this is getting compiled twice ...
0
by: rautsmita | last post by:
hello friends , i am using to jdk6 and JAXB2.0, i have geomtry.xsd file i am trying to compile this file using jaxb but i got some error i.e.The particle of the type is not a valid restriction of...
9
by: pauldepstein | last post by:
On my visual c++ compiler, I compiled code which contained something like for( int i =0; i < 5; i++) { double x =5;} I expected it to give a compiler error because x is being redefined
0
by: Mapisto | last post by:
Hi all, I'm moving from gcc 3 to gcc 4, and I've got a redefinition error: defs.h is a header file which contains a lot detentions and one of them is "extern int my_var". main.c includes defs.h...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.