OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] xsd : root element not found

[ Lists Home | Date Index | Thread Index ]

Darren,

Elements in your schema belong to three different namespaces:
http://globals.namespace.org/content/xml/xsd/v10/article/single/
http://globals.namespace.org/content/xml/xsd/v10/article/
http://globals.namespace.org/content/xml/xsd/v10/reference/

However, in your xml file you use them as if they were in the same
namespace.  Here's what you should do:

<?xml version="1.0" encoding="utf-8"?>
<standaloneArticle 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	
xmlns="http://globals.namespace.org/content/xml/xsd/v10/article/single/";
	
xsi:schemaLocation="http://globals.namespace.org/content/xml/xsd/v10/art
icle/single/ standaloneArticle.xsd">
	
xmlns:art="http://globals.namespace.org/content/xml/xsd/v10/article/";
	
xsi:schemaLocation="http://globals.namespace.org/content/xml/xsd/v10/art
icle/ article.xsd">  
	
xmlns:ref="http://globals.namespace.org/content/xml/xsd/v10/reference/";
	
xsi:schemaLocation="http://globals.namespace.org/content/xml/xsd/v10/ref
erence/ reference.xsd">  

  <art:article>
	...
  </art:article>
  <ref:reference>
	...
  </ref:reference>
</standaloneArticle>


Stan Kitsis
Microsoft Corporation

-----Original Message-----
From: Darren Hall [mailto:dhall@utrs.com] 
Sent: Tuesday, May 23, 2006 7:12 AM
To: 'George Cristian Bina'
Cc: 'XML-Dev Mailing list'
Subject: RE: [xml-dev] xsd : root element not found

So something like this would be correct?

(You have to bear with me, I've never attempted XML Schema before, and
though I've worked with XML before, I'm not an XML expert.)

[from article.xml]
<?xml version="1.0" encoding="utf-8"?>
<standaloneArticle
xmlns="http://globals.namespace.org/content/xml/xsd/v10/article/single/";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 
xsi:schemaLocation="http://globals.namespace.org/content/xml/xsd/v10/art
icle
/single/ standaloneArticle.xsd">
  <article>
...
  </article>
</standaloneArticle>

[from standaloneArticle.xsd]
<?xml version="1.0" encoding="UTF-8" ?> 
<xs:schema
targetNamespace="http://globals.namespace.org/content/xml/xsd/v10/articl
e/si
ngle/"
 
xmlns:sar="http://globals.namespace.org/content/xml/xsd/v10/article/sing
le/"
  xmlns:art="http://globals.namespace.org/content/xml/xsd/v10/article/";
 
xmlns:ref="http://globals.namespace.org/content/xml/xsd/v10/reference/";
  xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
  elementFormDefault="qualified" 
  attributeFormDefault="qualified">
  <!-- import of external definitions -->
  <xs:import
namespace="http://globals.namespace.org/content/xml/xsd/v10/article/";
           schemaLocation="article.xsd"/>
  <xs:import
namespace="http://globals.namespace.org/content/xml/xsd/v10/reference/";
           schemaLocation="reference.xsd"/>
  <!-- definition of complex type elements -->
  <xs:element name="standaloneArticle">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="art:article" minOccurs="1" maxOccurs="1"/>
        <xs:element ref="ref:reference" minOccurs="1" maxOccurs="1"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


I wasn't sure how these namespace declarations should be setup and
defined -
I've basically been working from examples and trial and error.

Thanks again,

Darren

P.S. it seems to get bast the initial error now, but fails to validate
because it gets the error "Unexpected element 'article' in element
'standaloneArticle'. Expected: article". 'standaloneArticle.xsd'
validates
properly in XMLSpy Home.

Uhhhh...?

-----Original Message-----
From: George Cristian Bina [mailto:george@oxygenxml.com] 
Sent: Tuesday, May 23, 2006 9:34 AM
To: Darren Hall
Cc: 'XML-Dev Mailing list'
Subject: Re: [xml-dev] xsd : root element not found

Hi Daren,

Your XML file has a root element standaloneArticle from the 
"http://globals.namespace.org"; namespace while your schema defines a 
standaloneArticle element in the 
http://globals.namespace.org/content/xml/xsd/v10/article/single/ (schema

target namespace) namespace so there is no definition for your root 
element in that schema.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Darren Hall wrote:
> Hi all,
> 
> I'm having a quick problem here. I've created a schema document based
on
an
> xml format I'm going to be using. When I try to validate the xml
document
in
> XMLSpy Home, I get a "This file is not valid: The element declaration
was
> not found for root element 'standaloneArticle'." error.
> 
> It seems to me that the path to the xsd file in my xml document is not
> correct. I'm doing my document editing on my local file system. On my
> desktop I've created a folder called 'xml' and I've put both the xsd
and
the
> xml document in that folder at the same level.
> 
> Why can't XMLSpy validate my xml? I don't see what I'm doing wrong
here.
> 
> Thanks,
> 
> Darren
> 
> (--relevant code follows--)
> 
> [from article.xml]
> <?xml version="1.0" encoding="utf-8"?>
> <standaloneArticle xmlns="http://globals.namespace.org";
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  
>
xsi:schemaLocation="http://globals.namespace.org/content/xml/xsd/v10/art
icle
> /single/ standaloneArticle.xsd">
>   <article>
> ...
>   </article>
> </standaloneArticle>
> 
> [from standaloneArticle.xsd]
> <?xml version="1.0" encoding="UTF-8" ?> 
> <xs:schema
>
targetNamespace="http://globals.namespace.org/content/xml/xsd/v10/articl
e/si
> ngle/"
>   xmlns:sar="http://globals.
> namespace.org/content/xml/xsd/v10/article/single/"
>   xmlns:art="http://globals.
namespace.org/content/xml/xsd/v10/article/"
>   xmlns:ref="http://globals.
namespace.org/content/xml/xsd/v10/reference/"
>   xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
>   elementFormDefault="qualified" 
>   attributeFormDefault="qualified">
>   <!-- import of external definitions -->
>   <xs:import namespace="http://globals.
> namespace.org/content/xml/xsd/v10/article/"
>            schemaLocation="article.xsd"/>
>   <xs:import namespace="http://globals.
> namespace.org/content/xml/xsd/v10/reference/"
>            schemaLocation="reference.xsd"/>
>   <!-- definition of complex type elements -->
>   <xs:element name="standaloneArticle">
> ...
>   </xs:element>
> </xs:schema>
> 
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>
> 

-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://www.oasis-open.org/mlmanage/index.php>





-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
initiative of OASIS <http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://www.oasis-open.org/mlmanage/index.php>





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS