You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2001/03/03 18:15:09 UTC
[Bug 831] New - Validating a xml doc vs schema causes problem
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=831
*** shadow/831 Sat Mar 3 09:15:09 2001
--- shadow/831.tmp.6850 Sat Mar 3 09:15:09 2001
***************
*** 0 ****
--- 1,71 ----
+ +============================================================================+
+ | Validating a xml doc vs schema causes problem |
+ +----------------------------------------------------------------------------+
+ | Bug #: 831 Product: Xerces-J |
+ | Status: NEW Version: 1.3.0 |
+ | Resolution: Platform: PC |
+ | Severity: Normal OS/Version: Windows NT/2K |
+ | Priority: High Component: Build |
+ +----------------------------------------------------------------------------+
+ | Assigned To: xerces-j-dev@xml.apache.org |
+ | Reported By: sugrue@ocean.ucc.ie |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ hi.
+ my problem is that when I try to validate an XML Document written in accordance
+ with the www.w3.org site XML Schema recommendation it says that the element
+ needs to be declared for all elements except one which is a direct child node
+ of the schema element and is a simple type (xsd:string).
+ Here is what I have in the header of my XML document :
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <purchaseOrder xmlns ="http://www.purchases.org"
+ xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
+ xsi:schemaLocation="http://www.purchases.org potest.xsd"
+ orderDate = "1999-10-20">
+
+
+ which references a schema with this as it's header
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <schema xmlns="http://www.w3.org/2000/10/XMLSchema"
+ targetNamespace="http://www.purchases.org"
+ xmlns:po="http://www.purchases.org"
+ elementFormDefault="unqualified">
+ <element name="purchaseOrder" type="po:PurchaseOrderType"/>
+
+ <element name="comment" type="string"/>
+
+ <complexType name="PurchaseOrderType">
+ <element name="shipTo" type="po:USAddress"/>
+ <element name="billTo" type="po:USAddress"/>
+ <element ref="comment" minOccurs="0"/>
+ <element name="items" type="po:Items"/>
+ <attribute name="orderDate" type="date"/>
+ </complexType>
+
+
+ I have shown part of the schema so that I can explain that the comment element
+ is ok, but that anything from the PurchaseOrderType on is producing errors in
+ validation, namely :
+
+ [Error] potest.xml:6:60: Schema error: ComplexType 'PurchaseOrderType': Invalid
+ child 'element' in the complex type.
+ [Error] potest.xml:6:60: Schema error: ComplexType 'USAddress': Invalid
+ child 'element' in the complex type.
+ [Error] potest.xml:6:60: Attribute "orderDate" must be declared for element
+ type "purchaseOrder".
+ [Error] potest.xml:9:25: Element type "shipTo" must be declared.
+ [Error] potest.xml:9:25: Attribute "country" must be declared for element
+ type "shipTo".
+
+
+
+ Any help would be greatly appreciated as I need the validation feature working
+ in my application for my final year project in Computer Science.
+
+ Regards
+ James Sugrue