Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 25th, 2006, 10:35 AM
askar.bektassov@gmail.com
Guest
 
Posts: n/a
Default Schema validation

Hello guys, I'm new to XML so sorry for probably 'obvious' question

I have the following xml schema

<!-- dynamicMeasurement.xsd -->

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:measure="http://www.example.org"
targetNamespace="http://www.example.org">

<xs:complexType name="dynamicObjectsContainer">
...
</xs:complexType>
...
</xs:schema>

<!-- dynamicObject.xml -->

<?xml version="1.0" encoding="UTF-8"?>
<measure:dynamicObjectsContainer
xmlns:measure="http://www.example.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org dynamicMeasurement.xsd">

...
</measure:dynamicObjectsContainer>

But whenever I try to validate the xml file (I'm using oxygen plugin
for eclipse 3.1) I got

cvs-elt.1: Cannot find the declaration of element
'measure:dynamicObjectContainer'
@see: http://www.w3.org/TR/xmlschema-1/#cvs-elt

So the problem is: do I miss some kind of declaration, or namespace?
incredibly I believe I copied another xml, xsd definitions (stored in
another directory) which works without any problem.

Thanks in advance,
cheers

  #2  
Old July 26th, 2006, 11:05 AM
George Bina
Guest
 
Posts: n/a
Default Re: Schema validation

Hi,

You defined in the schema file a complex type with the name
dynamicObjectsContainer. The error says that there is no declaration
for the element with the local name dynamicObjectsContainer that you
use in your instance document. XML Schema does not automatically map an
element name to a type with the same name as the element. You need to
add to your schema an element declaration like below:

<xs:element name="dynamicObjectsContainer"
type="measure:dynamicObjectsContainer"/>

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


askar.bektassov@gmail.com wrote:
Quote:
Hello guys, I'm new to XML so sorry for probably 'obvious' question
>
I have the following xml schema
>
<!-- dynamicMeasurement.xsd -->
>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:measure="http://www.example.org"
targetNamespace="http://www.example.org">
>
<xs:complexType name="dynamicObjectsContainer">
...
</xs:complexType>
...
</xs:schema>
>
<!-- dynamicObject.xml -->
>
<?xml version="1.0" encoding="UTF-8"?>
<measure:dynamicObjectsContainer
xmlns:measure="http://www.example.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org dynamicMeasurement.xsd">
>
...
</measure:dynamicObjectsContainer>
>
But whenever I try to validate the xml file (I'm using oxygen plugin
for eclipse 3.1) I got
>
cvs-elt.1: Cannot find the declaration of element
'measure:dynamicObjectContainer'
@see: http://www.w3.org/TR/xmlschema-1/#cvs-elt
>
So the problem is: do I miss some kind of declaration, or namespace?
incredibly I believe I copied another xml, xsd definitions (stored in
another directory) which works without any problem.
>
Thanks in advance,
cheers
  #3  
Old August 1st, 2006, 11:05 AM
askar.bektassov@gmail.com
Guest
 
Posts: n/a
Default Re: Schema validation

George Bina wrote:
Quote:
...
Thank you very much for reply,

Indeed, looking with little bit more attention on some other xml
examples I can see how the elements declared in the schema and
referenced externally by xml files are usually constructed by

<xs:element name="A">
<xs:complexType>
</xs:complexType>
</xs:element>

but then another question arises naturally - the construction of type:
Quote:
<xs:element name="dynamicObjectsContainer"
type="measure:dynamicObjectsContainer"/>
shouldn't get inside a infinite recursive loop, since it is declared of
the same type as it is itself?

  #4  
Old August 2nd, 2006, 08:35 AM
George Bina
Guest
 
Posts: n/a
Default Re: Schema validation

but then another question arises naturally - the construction of type:
Quote:
>
Quote:
<xs:element name="dynamicObjectsContainer"
type="measure:dynamicObjectsContainer"/>
>
shouldn't get inside a infinite recursive loop, since it is declared of
the same type as it is itself?
No, you have an element with the same name as a type, but they are
different components.

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

askar.bektassov@gmail.com wrote:
Quote:
George Bina wrote:
Quote:
...
>
Thank you very much for reply,
>
Indeed, looking with little bit more attention on some other xml
examples I can see how the elements declared in the schema and
referenced externally by xml files are usually constructed by
>
<xs:element name="A">
<xs:complexType>
</xs:complexType>
</xs:element>
>
but then another question arises naturally - the construction of type:
>
Quote:
<xs:element name="dynamicObjectsContainer"
type="measure:dynamicObjectsContainer"/>
>
shouldn't get inside a infinite recursive loop, since it is declared of
the same type as it is itself?
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles