Click to See Complete Forum and Search --> : xml schema for xlink


jamborta
11-30-2007, 05:38 AM
hi,

just wondering how i could write an xml schema for this line:

<url isbn="123454444" xlink:href="http://www.amazon.com" xlink:type="simple">amazon link</url>

thanks

jkmyoung
12-03-2007, 09:59 AM
http://www.w3schools.com/schema/default.asp

What do you have at the moment?
Is there any particular formats, enumerations that your attribute values must follow?
Is there a particular area that's not validating for you?

jamborta
12-03-2007, 04:53 PM
hi.

i have this line:
<url private="true" href="http://applij.oxfordjournals.org/cgi/content/abstract/21/4/553">Link</url>
with the corresponding schema:
<xsd:element name="url" type="urltype" minOccurs="0"/>

<xsd:complexType name="urltype">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="private" type="xsd:boolean" default="false" />
<xsd:attribute name="href" type="xsd:anyURI" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>

and then i'd like to extend the xml to something like this:
<url private="true" xlink:href="http://applij.oxfordjournals.org/cgi/content/abstract/21/4/553" xlink:type="simple">Link</url>

but i havnt managed to modify the schema accordingly

jkmyoung
12-04-2007, 11:47 AM
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xlink="http://www.w3.org/1999/xlink" >
<xs:import schemaLocation="http://www.loc.gov/standards/mets/xlink.xsd" namespace="http://www.w3.org/1999/xlink"/>


<xs:complexType name="urltype">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="private" type="xs:boolean" default="false"/>
<xs:attribute ref="xlink:href"/>
<xs:attribute ref="xlink:type"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

jamborta
12-04-2007, 06:35 PM
thanks, it works with the xlink:href tag, although it still complains about the xlink:type tag, i guess the reason is that it is not declared in the imported namespace, thus it cannot be referenced. but i have no idea this could be solved...