By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,824 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,824 IT Pros & Developers. It's quick & easy.

Importing Schema = no element name

P: n/a
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/bul...backSchema.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
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Jul 20 '05 #2

P: n/a
Henry S. Thompson wrote:

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
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.