|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > need XML/XSD help (reusable data type) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|