cvc.elt1: Cannot find the declartion of element "xs:sch
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 6
- Joined: Wed Aug 17, 2005 12:33 pm
cvc.elt1: Cannot find the declartion of element "xs:sch
Hi everybody,
Just started messing around with XML and its schemas with Oxygen, but am having trouble getting any of it to work, due to this peculiar error -
cvc.elt1: Cannot find the declartion of element "xs:schema"
This was happening for a while with my first mock ups, so i went and copied the first tutorial of xml.com and i still get teh same thing. Complains about the the secodn line from the xml's point of view and then when i try and to a 'Vailidate with..' (all the other tests show it to be fine) and enter http://www.w3.org/2001/XMLSchema i get the above error back.
Obviously i've got sumting wrong somewhere but can't for the life of me find out where it is!! Please can some one help me!!
Heres the xsd -
and the xml i'm using
Thanks for any ideas clues pointers, anything at all that you think would be helpful.
Coup
Just started messing around with XML and its schemas with Oxygen, but am having trouble getting any of it to work, due to this peculiar error -
cvc.elt1: Cannot find the declartion of element "xs:schema"
This was happening for a while with my first mock ups, so i went and copied the first tutorial of xml.com and i still get teh same thing. Complains about the the secodn line from the xml's point of view and then when i try and to a 'Vailidate with..' (all the other tests show it to be fine) and enter http://www.w3.org/2001/XMLSchema i get the above error back.
Obviously i've got sumting wrong somewhere but can't for the life of me find out where it is!! Please can some one help me!!
Heres the xsd -
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="character" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="friend-of" type="xs:string" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="since" type="xs:date"/>
<xs:element name="qualification" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="isbn" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="book">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="character" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="friend-of" type="xs:string" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="since" type="xs:date"/>
<xs:element name="qualification" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="isbn" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
Coup
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Coup,
What you label as XML is also a schema file, you should open that with the XSD editor. An instance document for the schema file you posted and labeled as a xsd should start like below:
<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="book.xsd">
<title>test</title>
<author></author>
...
You may take a look at the sample project that comes with oXygen, see personal-schema.xml for a sample instance document of the personal.xsd schema.
Best Regards,
George
What you label as XML is also a schema file, you should open that with the XSD editor. An instance document for the schema file you posted and labeled as a xsd should start like below:
<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="book.xsd">
<title>test</title>
<author></author>
...
You may take a look at the sample project that comes with oXygen, see personal-schema.xml for a sample instance document of the personal.xsd schema.
Best Regards,
George
-
- Posts: 6
- Joined: Wed Aug 17, 2005 12:33 pm
Hi George,
First thank you for your very quick reply, very helpful it was to! Second sorry about that miss posting of the xml file, was surposed to be my example but was having some trouble getting stuff into the form (firefox kept bring up the find bar and putting all my typing/pasting in there, most annoying!).
Have tried the samples and get what looks likes good results, except (you knew it was coming
) i get a complaint about the doctype
Thanks again
Coup
First thank you for your very quick reply, very helpful it was to! Second sorry about that miss posting of the xml file, was surposed to be my example but was having some trouble getting stuff into the form (firefox kept bring up the find bar and putting all my typing/pasting in there, most annoying!).
Have tried the samples and get what looks likes good results, except (you knew it was coming

and another about the grammerDocument root element "personnel", must match DOCTYPE root "null".
I also get thisDocument is invalid: no grammar found.
Are these ligit problems or are they just moans? Is does seem to be working apart from these.Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in element 'personnel'.
Thanks again
Coup
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Coup,
Both [oxygen/samples/personal.xml and [oxygen]/samples/personal-schema.xml are valid and should be reported valid by oXygen if you use the default options and the "Validate" action.
If you have problems please post the exact documents to reproduce the problem and a schor description of the steps we should take to reproduce that.
Best Regards,
George
Both [oxygen/samples/personal.xml and [oxygen]/samples/personal-schema.xml are valid and should be reported valid by oXygen if you use the default options and the "Validate" action.
If you have problems please post the exact documents to reproduce the problem and a schor description of the steps we should take to reproduce that.
Best Regards,
George
-
- Posts: 6
- Joined: Wed Aug 17, 2005 12:33 pm
Hi george,
Bascially i am trying to parse the documents againist the schema in java, with the view to having xml files being posted to a servlet, validated via the schema then passed deeper into the system for processing, etc. (I realize this now mayb abit off topic for this forum but i'll struggle on anyway.) Using the following code
Where schemaFile is set to /eclipsepluginsfolder/oxygenplugin[/]/personnal.xsd and xmlFile is set to /eclipsepluginsfolder/oxygenplugin[/]/personnal-schema.xml.
The output is
Domimpl = com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl@11f2ee1
Warning: validation was turned on but an org.xml.sax.ErrorHandler was not set, which is probably not what is desired. Parser will use a default ErrorHandler to print the first 10 errors. Please call the setErrorHandler method to fix this.
Error: URI = "file:///opt/eclipse/plugins/com.oxygenxml.editor_6.1.0/samples/personal-schema.xml", Line = "3", : Document root element "personnel", must match DOCTYPE root "null".
Error: URI = "file:///opt/eclipse/plugins/com.oxygenxml.editor_6.1.0/samples/personal-schema.xml", Line = "3", : Document is invalid: no grammar found.
Error: URI = "file:///opt/eclipse/plugins/com.oxygenxml.editor_6.1.0/samples/personal-schema.xml", Line = "3", : cvc-complex-type.3.2.2: Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in element 'personnel'.
Error: URI = "file:///opt/eclipse/plugins/com.oxygenxml.editor_6.1.0/samples/personal-schema.xml", Line = "3", : cvc-complex-type.3.2.2: Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in element 'personnel'.
After this i can output the elements in doco with no problems. This is using Eclispe 3.0 and a new jdk1.5 as the jvm. Not quite sure what you meant by a 'schor', but hopefully this gives you enuff info about what i'm trying to achieve.
Thank you for your help thus far.
Coup
Bascially i am trying to parse the documents againist the schema in java, with the view to having xml files being posted to a servlet, validated via the schema then passed deeper into the system for processing, etc. (I realize this now mayb abit off topic for this forum but i'll struggle on anyway.) Using the following code
Code: Select all
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
SchemaFactory sFact = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
Schema schema = sFact.newSchema(schemaFile);
factory.setSchema(schema);
DocumentBuilder dommer = factory.newDocumentBuilder();
DOMImplementation domImpl = dommer.getDOMImplementation();
System.out.println("Domimpl = "+domImpl.toString());
Document doco = dommer.parse(xmlFile);
The output is
Domimpl = com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl@11f2ee1
Warning: validation was turned on but an org.xml.sax.ErrorHandler was not set, which is probably not what is desired. Parser will use a default ErrorHandler to print the first 10 errors. Please call the setErrorHandler method to fix this.
Error: URI = "file:///opt/eclipse/plugins/com.oxygenxml.editor_6.1.0/samples/personal-schema.xml", Line = "3", : Document root element "personnel", must match DOCTYPE root "null".
Error: URI = "file:///opt/eclipse/plugins/com.oxygenxml.editor_6.1.0/samples/personal-schema.xml", Line = "3", : Document is invalid: no grammar found.
Error: URI = "file:///opt/eclipse/plugins/com.oxygenxml.editor_6.1.0/samples/personal-schema.xml", Line = "3", : cvc-complex-type.3.2.2: Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in element 'personnel'.
Error: URI = "file:///opt/eclipse/plugins/com.oxygenxml.editor_6.1.0/samples/personal-schema.xml", Line = "3", : cvc-complex-type.3.2.2: Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in element 'personnel'.
After this i can output the elements in doco with no problems. This is using Eclispe 3.0 and a new jdk1.5 as the jvm. Not quite sure what you meant by a 'schor', but hopefully this gives you enuff info about what i'm trying to achieve.
Thank you for your help thus far.
Coup
-
- Posts: 6
- Joined: Wed Aug 17, 2005 12:33 pm
Hi Geogre,
Have tried inserting the newer version but i still get the same old errors. Have found a work around by defining the DTD in the XML (thou in production this will have to be seperate). Is this in any way normal, having to have a dtd below yr schema? i thought it was a replacemnt not an addition. Prehaps you cld clear that up for me.
Cheers
Coup
Have tried inserting the newer version but i still get the same old errors. Have found a work around by defining the DTD in the XML (thou in production this will have to be seperate). Is this in any way normal, having to have a dtd below yr schema? i thought it was a replacemnt not an addition. Prehaps you cld clear that up for me.
Cheers
Coup
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
You may try setting the schemaLanguage property to specify that you want validation only against XML Schema:
setProperty(
"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema"
)
Best Regards,
George
setProperty(
"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema"
)
Best Regards,
George
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
You may find this recent thread on the Xerces-user list interesting, it discusses exactly this issue. I recomment again working with Xerces 2.7.1, I do not know what Xerces version Java 1.5 picked up...
http://marc.theaimsgroup.com/?l=xerces- ... 021493&w=2
http://marc.theaimsgroup.com/?t=112311878700001&r=1&w=2
Best Regards,
George
http://marc.theaimsgroup.com/?l=xerces- ... 021493&w=2
http://marc.theaimsgroup.com/?t=112311878700001&r=1&w=2
Best Regards,
George
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service