| Article: |
XML Document Validation with an XML Schema | |
| Subject: | Error coming | |
| Date: | 2007-01-09 14:15:25 | |
| From: | javanew | |
|
Hello Deepak, when I try to use catalog.xml and catalog.xsd, i get the following errors. Can you please give me some idea on why this error could be coming:
|
||
Showing messages 1 through 7 of 7.
-
Error coming
2007-01-09 14:57:47 Deepak Vohra [Reply | View]
-
Error coming
2007-01-09 15:19:41 javanew [Reply | View]
Now I specified specifying noNamespaceSchemaLocation attribute. Now my xml looks like this. Both xml and xsd are WSAD workspace, so I cannot give file path. There are in the same location. So, do i need to mention any relative 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: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'.





Please specify schema in XML document withn noNamespaceSchemaLocation attribute.