473,793 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Simple Schema : What is wrong?

Hello,
I have a simple schema as shown below. When I validate it, I get the error

"Type 'http://www.w3.org/2001/XMLSchema:empty pe' is not declared. An error
occurred at , (6, 12)."

***************
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<xsd:element name="Employee" >
<xsd:complexTyp e>
<xsd:sequence >
<xsd:element name="Name" type="xsd:strin g" />
<xsd:element name="EmployeeT ype" type="xsd:empty pe" />
<xsd:element name="Salary" type="xsd:int" />
</xsd:sequence>
</xsd:complexType >
</xsd:element>
<xsd:simpleTy pe name="emptype">
<xsd:restrictio n base="xsd:strin g">
<xsd:enumeratio n value="fulltime " />
<xsd:enumeratio n value="parttime " />
</xsd:restriction >
</xsd:simpleType>
</xsd:schema>
*************** *******

Can someone help?.

Thanks,
Ganesh
Jul 7 '06 #1
1 1445
"Ganesh Muthuvelu" <Ga************ *@discussions.m icrosoft.comwro te in
message news:5F******** *************** ***********@mic rosoft.com...
Hello,
I have a simple schema as shown below. When I validate it, I get the error

"Type 'http://www.w3.org/2001/XMLSchema:empty pe' is not declared. An error
occurred at , (6, 12)."

***************
<?xml version="1.0" encoding="utf-16"?>
<xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<xsd:element name="Employee" >
<xsd:complexTyp e>
<xsd:sequence >
<xsd:element name="Name" type="xsd:strin g" />
<xsd:element name="EmployeeT ype" type="xsd:empty pe" />
<xsd:element name="Salary" type="xsd:int" />
</xsd:sequence>
</xsd:complexType >
</xsd:element>
Ganesh,

The following defines <no namespace>:empt ype, not xsd:emptype (which is
http://www.w3.org/2001/XMLSchema:emptype). The xsd namespace belongs to
someone else (w3c). You do not define things in someone else's namespace!
<xsd:simpleTy pe name="emptype">
<xsd:restrictio n base="xsd:strin g">
<xsd:enumeratio n value="fulltime " />
<xsd:enumeratio n value="parttime " />
</xsd:restriction >
</xsd:simpleType>
</xsd:schema>
*************** *******
<xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:tns="urn: GaneshMuthuvelu " targetNamespace =="urn:GaneshMu thuvelu">
....
<xsd:element name="EmployeeT ype" type="tns:empty pe" />
....
<xsd:simpleTy pe name="emptype">
....

Your schema will be defining names in your namespace. When you need to refer
to those names in the schema itself, you can refer to them with the
tns:<name>. Note that the use of "tns" as a prefix is only a convention -
you can use any prefix you like, but it's frequently useful to define a
prefix which matches the targetNamespace .

I hope that helps.

John
(still learning xsd subleties myself)
Jul 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2258
by: Chris Vinall | last post by:
I'm an SQL beginner and this is driving me nuts as it seems simple enough but I can't figure it out. I have a table that looks like: ID: int MajorVersion: int MinorVersion: int Content: ntext
0
7113
by: mjcsfo | last post by:
I can't seem to find a reference nor any helpful threads on this topic. I've gotten the following error in two circumstances: 1. A complex type has nested within it another complex type, in the "Russian doll" style of schema design, where the nested type is local and anonymous (not a separate global type). 2. A complex type has nested within it a simple type which is derived through restriction with at least one facet, again nested,...
1
1681
by: Harry Zoroc | last post by:
I would like to treat an xsd Schema file as XML file and to display the targetNamespace and all the imports. That's it. But the following does not work. Why? I did not enter the stylesheet in the xsd file directly but tried to compute the output on the command line e.g. with xalan like: java net.sf.saxon.Transform -o myout.html myschema.xsd myxsltfile.xslt Using Saxon yields no better result. The produced myout.html contains all HTML...
1
1447
by: Ron Rohrssen | last post by:
I've been working on learning XML schemas and trying to make use of the MS classes for validating data against a schema. So, I've been trying to work through some simple schemas and instances. But, the parser inside of Visual Studio seems to frequently validate against a cached version of the schema. Occassionally I have an XML file that won't validate
9
3392
by: Steven C. | last post by:
Hello: I'm getting an error, "primary key not defined" when trying to use the FIND method on the DataTable Rows collection. I have a typed dataset called 'MortgagesDS' that I created with the XSL builder tool in .NET. I define the dataset at the beginning the the main class: MortgageDS _MortgageDS = new MortgageDS();
2
1895
by: smachin1000 | last post by:
Hi All, In the sample schema & document below, I'd like the attribute "name" to be unique for all function elements under function_list. The tools I'm using (XML Spy and xmllint) all validate the sample document and do not pick up that the name is not unique. Any clues as to what could be going wrong? Thanks.
9
3020
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13> <binaryobject3></binaryobject3>
3
3102
by: Eric Lilja | last post by:
Hello, this is an xml-file with a nested DTD. It validates, test-1- with-dtd.xml: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE persons > <persons> <person name="Eric Lilja" /> </persons>
2
4131
by: olympus_mons | last post by:
Hi, I'm just discovering the power of xsd.exe, so maybe I'm doing something wrong. schema files describing requests and responses. So there is an extra xsd file for each response and each request as well as some base schemas, i.e. defining a data type for a result element. Among others this result element contains a simple enumeration type "ResultState" which can either be "OK" or "FAILED".
0
9671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10433
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10212
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.