Importing Schema = no element name

Fezboy

Usenet Archive
Joined
Sep 27, 2004
Messages
2
Reaction score
0
Greetings!

I'm trying to import elements declared in the METS and MODS XML Schema into my own. I've gotten to the point where the xsd validates, but when I try to validate a document against it, it expects element '' in place of mets:fileGrp. The same error obtains for mets:structMap if I comment out the mets:fileGrp code.

Can an insightful person tell me why it will wants '' instead of the actual Qname I use to identify it?

TIA!
Nick

Relevant markup:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.indiana.edu/~eviada" xmlns:xlink="http://www.w3.org/TR/xlink" xmlns:mets="http://www.loc.gov/METS/" xmlns:mods="http://www.loc.gov/mods/v3" targetNamespace="http://www.indiana.edu/~eviada" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:import namespace="http://www.loc.gov/METS/" schemaLocation="http://www.loc.gov/standards/mets/mets.xsd"/> <xsd:import namespace="http://www.loc.gov/mods/v3" schemaLocation="http://www.loc.gov/standards/mods/v3/mods-3-0.xsd"/>

<xsd:element name="head" type="headType"/>
<xsd:element name="fileGrpID" type="xsd:string"/>
<xsd:element name="fileUriPrefix" type="xsd:string"/>
<xsd:element name="collectionID" type="xsd:string"/>
<xsd:element name="collector" type="xsd:string"/>
<xsd:element name="relatedSegments" type="relatedSegmentsType"/> <xsd:element name="segment" type="segmentType"/> <xsd:element name="title" type="xsd:string"/> <xsd:element name="uri" type="xsd:anyURI"/>

<xsd:complexType name="headType">
<xsd:sequence>
<xsd:element ref="fileGrpID"/>
<xsd:element ref="fileUriPrefix"/>
<xsd:element ref="collectionID"/>
<xsd:element ref="collector"/>
<xsd:element ref="mets:fileGrp" type="mets:fileGrpType"/> <xsd:element ref="mets:structMap" type="mets:structMapType"/> <xsd:element ref="relatedSegments"/> </xsd:sequence> </xsd:complexType>

<!-- ... -->

Full URLs can be found:

My xsd file:
http://bl-ldlp-boblee.ads.iu.edu/bullpen/20040927PlaybackSchema.xsd

METS xsd file:
http://www.loc.gov/standards/mets/mets.xsd

XMLSpy generated sample XML file:
http://bl-ldlp-boblee.ads.iu.edu/bullpen/sample4NG.xml
 

Henry S. Thompson

Usenet Archive
Joined
Jan 14, 2000
Messages
309
Reaction score
0
You don't say which schema processor you're using, which makes it hard to respond in detail.

Your schema document is however _not_ valid. For example:

<xsd:element ref="mets:fileGrp" type="mets:fileGrpType"/>

is broken -- xsd:element can have _either_ a 'ref' attribute _or_ a 'name' and a 'type' attribute, but you can't mix the two.

So I suggest

a) Getting a better schema processor, i.e. one which reports this error and b) removing the 'type' attribute from your mets: references.

ht
 

Fezboy

Usenet Archive
Joined
Sep 27, 2004
Messages
2
Reaction score
0
Henry said:
Your schema document is however _not_ valid. For example:

<xsd:element ref="mets:fileGrp" type="mets:fileGrpType"/>

is broken -- xsd:element can have _either_ a 'ref' attribute _or_ a 'name' and a 'type' attribute, but you can't mix the two.

Thanks for pointing this out. I'm new to the schema side of XML processing--I primarily do XSLT.

I've been using XMLSpy write the schema and testing it by having XMLSpy generate sample XML based on that schema. This is where I came across the '' element problem. I went back and tried using only the ref attribute but was getting an error that the schema was not valid on its own, but might be if part of another...

I think the problem stems from the fact that I was using the imported fileGrpType in an improper context. I solved this by creating a local containing element based on the mets:metsType which then holds mets:fileGrp, etc. I cannot vouch for the accuracy of my interpretation of the problem, but I do know that I now have a working schema.

Thanks for the advice, HST.
-Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top