XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 17th, 2004, 01:31 AM
Rogelio Rogelio is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 104 Rogelio User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 43 m 32 sec
Reputation Power: 5
Send a message via AIM to Rogelio
need XML/XSD help (reusable data type)

ID.XSD
Code:
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
targetNamespace = "whatever">

<xsd:simpleType name ="idno">
<xsd:restriction base = "xsd:string">
<xsd:pattern value = "E\d{3}"/>
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>


number2.XSD
Code:
<schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
xmlns:emp ="whatever">
<include id = "emp" schemaLocation ="id.xsd"/>
<xsd:element name ="PURCHASEORDER" type ="purord"/>
<complexType name="purord">
		<sequence>
			<xsd:element name ="EMPLOYEE" type="ord"/>
		</sequence>

<xsd:attribute name ="EMPID" type ="emp:idno"/>
</complexType>
<complexType name="ord">
	<sequence>
		<xsd:element name="NAME" type ="xsd:string"/>
		<xsd:element name="ADDRESS" type ="xsd:string"/>
		<xsd:element name="DESIGNATION" type ="xsd:string"/>
		<xsd:element name="DATEOFJOINING" type ="xsd:string"/>
		<xsd:element name="DEPT" type ="xsd:string"/>			
	</sequence>
</complexType>
</schema>


number2.XML
Code:
<?xml version = "1.0"?>
<prod:PURCHASEORDER xmlns:prod = "whatever"
EMPID = "E001">
<EMPLOYEE>
	<NAME>Man</NAME>
	<ADDRESS>123 fake st</ADDRESS>
	<DESIGNATION>Designation</DESIGNATION>
	<DATEOFJOINING>12-12-2004</DATEOFJOINING>
	<DEPT>Dept</DEPT>
</EMPLOYEE>
</prod:PURCHASEORDER>



the error:

line 31
char 1
error: file://C/webweek9/number2.xsd#/schema[1]
Incorrect definitionfor the root element in schema
code: 0
URL: file://C\XML Learning Environment\Schema.htm



basically it says i can t declaire th e root. I d like ot know why this is... they seem correct when i make XML files of them and run then through a validator....

any help on this is greatly appreciated
thanks again

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > need XML/XSD help (reusable data type)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT