Undefined type . . .

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Undefined type . . .

Albretch Mueller-3

~
 I have the simple schema pasted below that is not validating.
~
 The errors I get from
~

~
 are:
~
Undefined type xs{http://www.w3.org/2001/XMLSchema}:dtmf referenced as
type definition of srvgmt
Undefined type xs{http://www.w3.org/2001/XMLSchema}:dtmf referenced as
type definition of srvxpgmt
Undefined type xs{http://www.w3.org/2001/XMLSchema}:dtmf referenced as
type definition of lupgmt
~
 The only thing I am going just a bit fancy is the restriction of the
dateTime format
~
 If I try using the jaxb compiler I get:
~
sh-3.1# xjc LWSC00.localents.xsd
parsing a schema...
[ERROR] src-resolve.4.2: Error resolving component 'xs:dtmf'. It was
detected that 'xs:dtmf' is in namespace
'http://www.w3.org/2001/XMLSchema', but components from this namespace
are not referenceable from schema document
'file:/media/hda2/prjx/java/JAXB/LocalWebSynchedCache/xsd/LWSC00.localents.xsd'.

 If this is the incorrect namespace, perhaps the prefix of 'xs:dtmf'
needs to be changed. If this is the correct namespace, then an
appropriate 'import' tag should be added to
'file:/media/hda2/prjx/java/JAXB/LocalWebSynchedCache/xsd/LWSC00.localents.xsd'.

  line 13 of file:/media/hda2/prjx/java/JAXB/LocalWebSynchedCache/xsd/LWSC00.localents.xsd

Failed to parse a schema.
~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ SCHEMA FILE ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~
<?xml version="1.0" encoding="UTF-8" ?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en">

<!-- Simple Data Type for Date formatting -->
 <xs:simpleType name="dtmf">
  <xs:restriction base="xs:dateTime">
   <xs:pattern value="YYYY-MM-DDThh:mm:ssTZD" />
  </xs:restriction>
 </xs:simpleType>

<!-- Web Section -->
 <xs:element name="srvgmt" type="xs:dtmf" /><!-- server's:
"Last-Modified:" (GMT format) -->
 <xs:element name="srvxpgmt"  type="xs:dtmf" /><!-- server's "Expires"
(GMT format) -->
 <xs:element name="srvmaxage"  type="xs:int" /><!-- server's:
"Cache-Control: max-age=" -->
 <xs:element name="srvetag" type="xs:string" /><!-- server's "ETag:" -->
 <xs:element name="srvcntlngth" type="xs:int" /><!-- server's
"Content-Length:" -->
 <xs:element name="srvcnttp" type="xs:string" /><!-- server's
"Content-Type:" -->

 <xs:element name="web">
  <xs:complexType>
   <xs:sequence>
    <xs:element ref="srvgmt" /><!-- server's: "Last-Modified:" (GMT format) -->
    <xs:element ref="srvxpgmt" /><!-- server's "Expires" (GMT format) -->
    <xs:element ref="srvmaxage" /><!-- server's: "Cache-Control: max-age=" -->
    <xs:element ref="srvetag" /><!-- server's "ETag:" -->
    <xs:element ref="srvcntlngth" /><!-- server's "Content-Length:" -->
    <xs:element ref="srvcnttp" /><!-- server's "Content-Type:" -->
   </xs:sequence>
  </xs:complexType>
 </xs:element>

<!-- Local Caches -->
 <xs:element name="root" type="xs:string" /><!-- Local root mount
point/Partition -->
 <xs:element name="dir" type="xs:string" /><!-- Local Directory
branching off partition -->
 <xs:element name="lupgmt" type="xs:dtmf" /><!-- Last Update in GMT format -->

 <xs:element name="ksh">
  <xs:complexType>
   <xs:sequence>
    <xs:element ref="root" /><!-- Local root mount point/Partition -->
    <xs:element ref="dir" /><!-- Local Directory branching off partition -->
    <xs:element ref="lupgmt" /><!-- Last Update in GMT format -->
   </xs:sequence>
   <xs:attribute name="ix" type="xs:NMTOKEN" use="required" />
  </xs:complexType>
 </xs:element>

 <xs:element name="entpath" type="xs:string" /><!-- Entity Path
branching off root mount point/dir (partition/directory) -->
 <xs:element name="cntlngth" type="xs:int"/><!-- Local TEXTUAL content
length -->
 <xs:element name="md5sum" type="xs:string"/><!-- ^ md5sum -->

 <xs:element name="loc">
  <xs:complexType>
   <xs:sequence>
    <xs:element ref="entpath" /><!-- Entity Path branching off root
mount point/dir (partition/directory) -->
    <xs:element ref="cntlngth" /><!-- Local TEXTUAL content length -->
    <xs:element ref="md5sum" /><!-- ^ md5sum -->
    <xs:element ref="ksh" minOccurs="1" maxOccurs="8" />
   </xs:sequence>
  </xs:complexType>
 </xs:element>

 <xs:element name="ent">
  <xs:complexType>
   <xs:sequence>
    <xs:element ref="web" />
    <xs:element ref="loc" />
   </xs:sequence>
   <xs:attribute name="ix" type="xs:NMTOKEN" use="required" />
   <xs:attribute name="uri" type="xs:string" use="required" />
  </xs:complexType>
 </xs:element>

<!-- Local Entities -->
 <xs:element name="LocEnts">
  <xs:complexType>
   <xs:sequence>
    <xs:element ref="ent" minOccurs="0" maxOccurs="unbounded" />
   </xs:sequence>
  </xs:complexType>
 </xs:element>

</xs:schema>


Reply | Threaded
Open this post in threaded view
|

Re: Undefined type . . .

G. Ken Holman

At 2008-07-30 19:21 -0400, Albretch Mueller wrote:
>  I have the simple schema pasted below that is not validating.

It has a simple error.

>Undefined type xs{http://www.w3.org/2001/XMLSchema}:dtmf referenced as
>type definition of srvgmt
>...
>[ERROR] src-resolve.4.2: Error resolving component 'xs:dtmf'. It was
>detected that 'xs:dtmf' is in namespace
>'http://www.w3.org/2001/XMLSchema',

Those are your clues:  you haven't defined the type "xs:dtmf" ... but
I see from your schema that you did define the type "dtmf":

><!-- Simple Data Type for Date formatting -->
>  <xs:simpleType name="dtmf">
>   <xs:restriction base="xs:dateTime">
>    <xs:pattern value="YYYY-MM-DDThh:mm:ssTZD" />
>   </xs:restriction>
>  </xs:simpleType>

So then your error is here:

>  <xs:element name="srvgmt" type="xs:dtmf" />

and the fix is:

  <xs:element name="srvgmt" type="dtmf" />

I hope this helps.

. . . . . . . . . . . .  Ken


--
Upcoming XSLT/XSL-FO hands-on courses:      Wellington, NZ 2009-01
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:[hidden email]
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal