Go Back   Velocity Reviews > Newsgroups > XML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

XML - Infinetely stupid question

 
Thread Tools Search this Thread
Old 05-22-2006, 08:48 PM   #1
Default Infinetely stupid question


I am really sorry if this sounds stupid. Namespace is just not my cup
of tea.

Could anybody tell me what is wrong with this xsd file (It has
something wrong with the namespaces)

I am getting the error "The element 'Books' is used but not declared in
the DTD/Schema."

If I remove targetNamespace="http://calendar/aiman" and
xmlns:myns="http://calendar/aiman" and change type="myns:BookType" to
type="BookType" it works.

-------------------------------------------------

<?xml version="1.0"?>
<xsd:schema
targetNamespace="http://calendar/aiman"
xmlnssd="http://www.w3.org/2001/XMLSchema"
xmlns:myns="http://calendar/aiman"
elementFormDefault="qualified">

<xsd:element name="Books">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Book" type="myns:BookType" minOccurs="1"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:complexType name="BookType">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" minOccurs="1"/>
<xsd:element name="Author" type="xsd:string" minOccurs="1"/>
<xsd:element name="Award" type="xsd:string" minOccurs="0"/>
<xsd:element name="Price" minOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="5000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Description" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:integer" use="required"/>
</xsd:complexType>
</xsd:schema>

------------------------------------------------------------------

If u help me solve this , i'll bless u with my infinte stupidity/wisdom




GeezerButler
  Reply With Quote
Old 05-22-2006, 10:00 PM   #2
George Bina
 
Posts: n/a
Default Re: Infinetely stupid question

The schema looks valid. Probably you validate an instance document
against this schema. When you have a target namespace set on a schema
then when you declare a global element like Books in your case then
that is a declaration for an element in the schema target namespace. So
in your instance document you need to place that element in the
appropriate namespace. From your description it seems you are placing
it in no namespace so instead of
<Books>

you should have

<Books xmlns="http://calendar/aiman">

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

  Reply With Quote
Old 05-22-2006, 10:38 PM   #3
GeezerButler
 
Posts: n/a
Default Re: Infinetely stupid question


George Bina wrote:
> The schema looks valid. Probably you validate an instance document
> against this schema. When you have a target namespace set on a schema
> then when you declare a global element like Books in your case then
> that is a declaration for an element in the schema target namespace. So
> in your instance document you need to place that element in the
> appropriate namespace. From your description it seems you are placing
> it in no namespace so instead of
> <Books>
>
> you should have
>
> <Books xmlns="http://calendar/aiman">
>
> Best Regards,
> George
> ---------------------------------------------------------------------
> George Cristian Bina
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com



Thanks!!!! that worked.

  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump