| Article: |
XML Document Validation with an XML Schema | |
| Subject: | Error coming | |
| Date: | 2007-01-09 14:57:47 | |
| From: | dvohra09 | |
|
Response to: Error coming
|
||
|
Is the schema specified in the XML document? Please specify schema in XML document withn noNamespaceSchemaLocation attribute. |
||
Showing messages 1 through 6 of 6.
-
Error coming
2007-01-09 15:08:32 javanew [Reply | View]
i was not specifying noNamespaceSchemaLocation attribute. My xml looked like this:
<?xml version="1.0" encoding="utf-8" ?>
<catalog xmlns="catalog.xsd">
<journal date="April 2004">
<article>
<title>Declarative Programming in Java</title>
<author>Narayanan Jayaratchagan</author>
</article>
</journal>
<journal date="January 2004">
<article>
<title>Data Binding with XMLBeans</title>
<author>Daniel Steinberg</author>
</article>
</journal>
</catalog> -
Error coming
2007-01-09 15:13:51 Deepak Vohra | [Reply | View]
Please modify the root element.
<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://c:/Schemas/catalog.xsd"> -
Error coming
2007-01-09 15:13:04 Deepak Vohra | [Reply | View]
Please modify the root element.
<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://c:/Schemas/OracleCatalog.xsd"> -
Error coming
2007-01-09 15:26:03 javanew [Reply | View]
Both xml and xsd are WSAD workspace, so I cannot give file path. There are in the same location. So, is there any way I can specify the path?
<?xml version="1.0" encoding="utf-8" ?>
<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="catalog.xsd" >
<journal date="April 2004">
<article>
<title>Declarative Programming in Java</title>
<author>Narayanan Jayaratchagan</author>
</article>
</journal>
<journal date="January 2004">
<article>
<title>Data Binding with XMLBeans</title>
<author>Daniel Steinberg</author>
</article>
</journal>
</catalog>
-
Error coming
2007-01-09 15:06:15 javanew [Reply | View]
Thanks for the quick reply Deepak. I will try what you advised.
Actually, I was reading xml and xsd from file system and passing them as String. Now I am passing them as InputStream. Now I am getting these errors. Any idea?
cvc-elt.1: Cannot find the declaration of element 'catalog'.
cvc-elt.1: Cannot find the declaration of element 'journal'.
cvc-elt.1: Cannot find the declaration of element 'article'.
cvc-elt.1: Cannot find the declaration of element 'title'.
cvc-elt.1: Cannot find the declaration of element 'author'.
cvc-elt.1: Cannot find the declaration of element 'journal'.
cvc-elt.1: Cannot find the declaration of element 'article'.
cvc-elt.1: Cannot find the declaration of element 'title'.
cvc-elt.1: Cannot find the declaration of element 'author'.
XML Document has Error:true cvc-elt.1: Cannot find the declaration of element 'author'.




<?xml version="1.0" encoding="utf-8" ?>
<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="catalog.xsd" >
<journal date="April 2004">
<article>
<title>Declarative Programming in Java</title>
<author>Narayanan Jayaratchagan</author>
</article>
</journal>
<journal date="January 2004">
<article>
<title>Data Binding with XMLBeans</title>
<author>Daniel Steinberg</author>
</article>
</journal>
</catalog>