473,385 Members | 1,830 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,385 software developers and data experts.

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:emptype' 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:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="EmployeeType" type="xsd:emptype" />
<xsd:element name="Salary" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="emptype">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="fulltime" />
<xsd:enumeration value="parttime" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
**********************

Can someone help?.

Thanks,
Ganesh
Jul 7 '06 #1
1 1415
"Ganesh Muthuvelu" <Ga*************@discussions.microsoft.comwrote in
message news:5F**********************************@microsof t.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:emptype' 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:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="EmployeeType" type="xsd:emptype" />
<xsd:element name="Salary" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Ganesh,

The following defines <no namespace>:emptype, 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:simpleType name="emptype">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="fulltime" />
<xsd:enumeration value="parttime" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
**********************
<xsd:schema xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:GaneshMuthuvelu" targetNamespace=="urn:GaneshMuthuvelu">
....
<xsd:element name="EmployeeType" type="tns:emptype" />
....
<xsd:simpleType 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
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:...
0
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...
1
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...
1
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....
9
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...
2
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...
9
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>...
3
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.