?
=?ISO-8859-1?Q?L=E9na=EFc?= Huard
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
I've some namespace problems when defining default values for attributes.
My problem seems to come from the fact that the attributes are defined in a
different namespace from the element.
I've defined the XLink attributes in xlink.xsd. (I've copied just a subset)
I've written a personal schema defining elements in an other namespace in
schema.xsd. I defined default values for some XLink attributes.
But, when I process doc.xml,
the element
<link xl:href="http://www.google.fr">Google</link>
becomes
<link xl:href="http://www.google.fr" show="new" actuate="onRequest"
type="simple">Google</link>
But I expected:
<link xl:href="http://www.google.fr" xl:show="new" xl:actuate="onRequest"
xl:type="simple">Google</link>
I don't understand why the XML processor (Xerces in my case) deletes the xl
namespace prefix.
Note, that the processed file is not valid any more !!!
As a consequence, Mozilla doesn't interpret this link node as an hypertext
node. :-(
How can I do in order to define default values for attributes that are
defined in a different namespace from the elements ??
Thanks for any help !
Lénaïc.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="copy.xsl" ?>
<root xmlns="http://MySchema"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://MySchema schema.xsd">
<link xl:href="http://www.google.fr">Google</link>
<link xl:href="http://www.w3.org">W3C</link>
<link xl:type="simple" xl:href="http://www.xmlfr.org" xl:show="new"
xl:actuate="onRequest">XML</link>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="copy.xsl" ?>
<root xmlns="http://MySchema" xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://MySchema schema.xsd">
<link xl:href="http://www.google.fr" show="new" actuate="onRequest"
type="simple">Google</link>
<link xl:href="http://www.w3.org" show="new" actuate="onRequest"
type="simple">W3C</link>
<link xl:type="simple" xl:href="http://www.xmlfr.org" xl:show="new"
xl:actuate="onRequest">XML</link>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN"
"http://www.w3.org/2001/XMLSchema.dtd">
<xs:schema xmlns="http://www.w3.org/1999/xlink"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/1999/xlink"
elementFormDefault="qualified"
attributeFormDefault="qualified">
<xs:attribute name="type">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="simple" />
<xs:enumeration value="extended" />
<xs:enumeration value="locator" />
<xs:enumeration value="arc" />
<xs:enumeration value="resource" />
<xs:enumeration value="title" />
<xs:enumeration value="none" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="href" type="xs:anyURI" />
<xs:attribute name="show">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="new" />
<xs:enumeration value="replace" />
<xs:enumeration value="embed" />
<xs:enumeration value="other" />
<xs:enumeration value="none" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="actuate">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="onLoad" />
<xs:enumeration value="onRequest" />
<xs:enumeration value="other" />
<xs:enumeration value="none" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="label" type="xs:NCName" />
<xs:attribute name="from" type="xs:NCName" />
<xs:attribute name="to" type="xs:NCName" />
<xs:attributeGroup name="simpleLink">
<xs:attribute ref="xl:type" fixed="simple" />
<xs:attribute ref="xl:href" use="optional" />
<xs:attribute ref="xl:show" use="optional" />
<xs:attribute ref="xl:actuate" use="optional" />
</xs:attributeGroup>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN"
"http://www.w3.org/2001/XMLSchema.dtd">
<xs:schema xmlns="http://MySchema"
xmlns:my="http://MySchema"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://MySchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/1999/xlink"
schemaLocation="xlink.xsd" />
<xs:element name="root" type="my:rootType" />
<xs:complexType name="rootType">
<xs:sequence>
<xs:element name="link" type="my:linkDefaultType"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="linkBaseType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="xl:simpleLink" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="linkDefaultType">
<xs:simpleContent>
<xs:restriction base="my:linkBaseType">
<xs:attribute ref="xl:show" default="new" />
<xs:attribute ref="xl:actuate" default="onRequest" />
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
- --
(o_ Lénaïc HUARD
//\ (e-mail address removed)
V_/_ KeyID: 0x04D2E818
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBMMPBjYEjJATS6BgRAuA2AJ4t+lz0R8CeGN9XZXWUdh+qlWHpSwCgn4F7
TzhlOG7NXMguHDyDm753Tns=
=EfcB
-----END PGP SIGNATURE-----
Hash: SHA1
Hello,
I've some namespace problems when defining default values for attributes.
My problem seems to come from the fact that the attributes are defined in a
different namespace from the element.
I've defined the XLink attributes in xlink.xsd. (I've copied just a subset)
I've written a personal schema defining elements in an other namespace in
schema.xsd. I defined default values for some XLink attributes.
But, when I process doc.xml,
the element
<link xl:href="http://www.google.fr">Google</link>
becomes
<link xl:href="http://www.google.fr" show="new" actuate="onRequest"
type="simple">Google</link>
But I expected:
<link xl:href="http://www.google.fr" xl:show="new" xl:actuate="onRequest"
xl:type="simple">Google</link>
I don't understand why the XML processor (Xerces in my case) deletes the xl
namespace prefix.
Note, that the processed file is not valid any more !!!
As a consequence, Mozilla doesn't interpret this link node as an hypertext
node. :-(
How can I do in order to define default values for attributes that are
defined in a different namespace from the elements ??
Thanks for any help !
Lénaïc.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="copy.xsl" ?>
<root xmlns="http://MySchema"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://MySchema schema.xsd">
<link xl:href="http://www.google.fr">Google</link>
<link xl:href="http://www.w3.org">W3C</link>
<link xl:type="simple" xl:href="http://www.xmlfr.org" xl:show="new"
xl:actuate="onRequest">XML</link>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="copy.xsl" ?>
<root xmlns="http://MySchema" xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://MySchema schema.xsd">
<link xl:href="http://www.google.fr" show="new" actuate="onRequest"
type="simple">Google</link>
<link xl:href="http://www.w3.org" show="new" actuate="onRequest"
type="simple">W3C</link>
<link xl:type="simple" xl:href="http://www.xmlfr.org" xl:show="new"
xl:actuate="onRequest">XML</link>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN"
"http://www.w3.org/2001/XMLSchema.dtd">
<xs:schema xmlns="http://www.w3.org/1999/xlink"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/1999/xlink"
elementFormDefault="qualified"
attributeFormDefault="qualified">
<xs:attribute name="type">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="simple" />
<xs:enumeration value="extended" />
<xs:enumeration value="locator" />
<xs:enumeration value="arc" />
<xs:enumeration value="resource" />
<xs:enumeration value="title" />
<xs:enumeration value="none" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="href" type="xs:anyURI" />
<xs:attribute name="show">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="new" />
<xs:enumeration value="replace" />
<xs:enumeration value="embed" />
<xs:enumeration value="other" />
<xs:enumeration value="none" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="actuate">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="onLoad" />
<xs:enumeration value="onRequest" />
<xs:enumeration value="other" />
<xs:enumeration value="none" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="label" type="xs:NCName" />
<xs:attribute name="from" type="xs:NCName" />
<xs:attribute name="to" type="xs:NCName" />
<xs:attributeGroup name="simpleLink">
<xs:attribute ref="xl:type" fixed="simple" />
<xs:attribute ref="xl:href" use="optional" />
<xs:attribute ref="xl:show" use="optional" />
<xs:attribute ref="xl:actuate" use="optional" />
</xs:attributeGroup>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN"
"http://www.w3.org/2001/XMLSchema.dtd">
<xs:schema xmlns="http://MySchema"
xmlns:my="http://MySchema"
xmlns:xl="http://www.w3.org/1999/xlink"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://MySchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/1999/xlink"
schemaLocation="xlink.xsd" />
<xs:element name="root" type="my:rootType" />
<xs:complexType name="rootType">
<xs:sequence>
<xs:element name="link" type="my:linkDefaultType"
maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="linkBaseType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="xl:simpleLink" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="linkDefaultType">
<xs:simpleContent>
<xs:restriction base="my:linkBaseType">
<xs:attribute ref="xl:show" default="new" />
<xs:attribute ref="xl:actuate" default="onRequest" />
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
- --
(o_ Lénaïc HUARD
//\ (e-mail address removed)
V_/_ KeyID: 0x04D2E818
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBMMPBjYEjJATS6BgRAuA2AJ4t+lz0R8CeGN9XZXWUdh+qlWHpSwCgn4F7
TzhlOG7NXMguHDyDm753Tns=
=EfcB
-----END PGP SIGNATURE-----