Problems defining a schema

Hi,

I’m running Tamino V3.1.1.1 and I tried to define a simple schema with the new schema editor. The loaded DTD is well-formed, valid and looks pretty simple.
I got the following error message:
“validation has detected an error in document; datatype validation for attribute “name” of type xs:NCName failed: An invalid value has been found during validation. ”

In my DTD im not using a attribute “name” but I’m using ID and IDREF. According the XML Schema datatype definition ID, IDREFS are derived from NCName.

Does anybody know what this error message exactly means?
Thanks for any suggestions.
rene.foehn@orion-tech.ch

Just click on the error message and the node that causes the error will be selected in the tree. In the properties panel should be a “name” or a “…name” property that contains a value that is not an NCName.
Thats how I understand this error message.

Hi Harald,
clicking on the error message did not work. So I could not find out which node was causing the problem.
But I finally found the problem accidentaly; I was using namespaces “xyz:…” and by some reason XML schema doesn’t like it.

Hi Rene,
not XML Schema, but the subset that is supported by TSD3 does not like namespaces except targetnamespace.
If you post your errornous schema, we can use it to reproduce this “error positioning” problem.

What exactly do you mean by “TSD3 does not like namespaces except targetnamespace”?

I’m running into a namespace problem when trying to define the schema.
I get the same error message as listed in previous posting:
“validation has detected an error in document; datatype validation for
attribute “name” of type xs:NCName failed: An invalid value has been
found during validation. ”

The DTD defines the xlink namespace as follows:

<!ATTLIST mptr %a.global;
xmlns:xlink CDATA #FIXEDXLink namespace
xlink:type CDATA #FIXED “simple”
xlink:href CDATA #REQUIRED
xlink:role (part) “part”
xlink:title CDATA #IMPLIED >

and the TSD schema created by the schema editor from the DTD contains the following:
xs:complexType
<xs:attribute name = “ID” type = “xs:ID”></xs:attribute>
<xs:attribute name = “xmlns:xlink” type = “xs:string” fixed = “XLink namespace”></xs:attribute>
<xs:attribute name = “xlink:type” type = “xs:string” fixed = “simple”></xs:attribute>
<xs:attribute name = “xlink:href” type = “xs:string” use = “required”></xs:attribute> <xs:attribute name = “xlink:role” default = “part”>
xs:simpleType
<xs:restriction base = “xs:NMTOKEN”>
<xs:enumeration value = “part”></xs:enumeration>
</xs:restriction> </xs:simpleType>
</xs:attribute>
<xs:attribute name = “xlink:title” type = “xs:string”></xs:attribute>
</xs:complexType>

any idea how to fix this error?
thanks.
Clare.

Hi Clare,

TargetNamespace is the namespace in which the instances of the schema should live and which the instances of the schema declare.
You can define only one targetNamespace in a schema.
In XML-Schema schema composition over different target namespaces is done by xs:import. But TSD3 does not support this feature yet.

So you cannot define a element mprt which belongs to the xlink namespace inside a schema that does not targets into the xlink namespace, too.

The conversion from dtd to tsd3 fails in your case and the generated tsd3 does not express what should be expressed in XML-Schema. In a future Tamino version you might express it like this:

- assumed that there is a XML schema somewhere in the world (and that schema is known to your Tamino server instance) that expresses the same as the xlink dtd does – otherwise you have to write this schema yourself -

<xs:schema … xmlns:xlink = “XLink namespace” …>

<xs:import namespace = “XLink namespace” />

<xs:element name = “mptr” type = “xlink:locator” />

The solution with TSD3 is to define your mprt element in you target namespace… The drawback is that mptr does do not refer to xlink namespace in your instances, too and a migration will be necessary if you want to switch to namespace usage with a future Tamino release.

Clare - could you post your schema for so I can check it out? I have a bit of experience with handling schemas with mixed namespaces

Nigel,
Please find the schema attached.
Clare.
Moa2Schema.tsd (87.4 KB)

I have two solutions that Tamino 3.1 accepts as a schema
I don’t have an instance so you will have to it try out with data. If you like you could send me an instance

1) Redefine element mptr as follows

xs:complexType
<xs:anyAttribute namespace=“XLink namespace” />
</xs:complexType>
or 2)
xs:complexType
<xs:anyAttribute namespace=“##other” />
</xs:complexType>

The down side is that Tamino will not schema check instances as exactly as you might like - but the degredation is ONLY in this one element.

If it doesn’t work get back to us.

Sorry I am not sure I understand the solution. Here is how mptr is defined in the schema (below), I believe. Could you be more explicit about the suggested solution and for my sake indicate what you are doing and why it works. I am struggling to do the same type of TSD for stylesheets only trying to define the top-level elements and attributes…

thanks you


<xs:element name = “mptr”>
xs:annotation
xs:documentation…</xs:documentation>
</xs:annotation>
xs:complexType
<xs:attribute name = “ID” type = “xs:ID”></xs:attribute>
<xs:attribute name = “xmlns:xlink” type = “xs:string” fixed = “XLink namespace”></xs:attribute>
<xs:attribute name = “xlink:type” type = “xs:string” fixed = “simple”></xs:attribute>
<xs:attribute name = “xlink:href” type = “xs:string” use = “required”></xs:attribute>
<xs:attribute name = “xlink:role” default = “part”>
xs:simpleType
<xs:restriction base = “xs:NMTOKEN”>
<xs:enumeration value = “part”></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name = “xlink:title” type = “xs:string”></xs:attribute>
</xs:complexType>
</xs:element>

like this

<xs:element name=“mptr”>
xs:annotation
xs:documentation</xs:documentation>
</xs:annotation>
xs:complexType
<xs:anyAttribute namespace=“##other” />
</xs:complexType>
</xs:element>

It is actually dead easy. If you use a the Jscript Dashboard you can create an XSl Style sheet Schema with a button press.

Otherwise copy this - which is what the dashboard uses (modulo cloollection and schema name)


<xs:schema xmlns:xs=“XML Schema” xmlns:tsd=“http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xsl=“XSLT Namespace” targetNamespace=“XSLT Namespace”>
- xs:annotation
- xs:appinfo
- <tsd:schemaInfo name=“xsl:stylesheet”>
<tsd:collection name=“RDF” />
- <tsd:doctype name=“xsl:stylesheet”>
- tsd:logical
tsd:contentclosed</tsd:content>
-
- tsd:accessOptions
<tsd:read />
<tsd:insert />
<tsd:update />
<tsd:delete />
</tsd:accessOptions>
</tsd:logical>
</tsd:doctype>
- </tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:element name=“stylesheet” type=“xs:anyType” />
</xs:schema>

Hello,

I am trying to import the attached schema. This schema is defined by a standards body so i do not have the ability to modify it.

I have been reading this thread and have been able to turn of attribute name checking as per Nigel’s recommendation (usage of the xs:anyAttribute schema element). My problem is in elements that have a name from another namespace. Are there any recomendations?

example:


this is ok!
ref:elem2from another namespace</ref:elem2>

Thanks,
Joe
mddl.dtd (126 KB)

In the same way as attributes belonging to other namespaces (xlink within one of the preceding contributions) can be replaced by the attribute wildcard, i.e. <xs:anyAttribute namespace=“…”/>
you can use the element wildcard for elements belonging to other namespaces, i.e. use

<xs:any namespace=“…”>

Additional attributes supported with xs:any are
processContents, minOccurs and maxOccurs.
Again, this prevents Tamino from validating the respective elements against a schema - but at least you can store your documents in Tamino with a partial validation.

Wait a minute, what happens to my indexes (and sorting) if I define my schema to accept any element or attribute :confused:

You are right: unfortunately, it is not possible to define an index for a node (i.e. element or attribute) which is not described by the schema.

[QUOTE]
Originally posted by Nigel Hutchison:
I have two solutions that Tamino 3.1 accepts as a schema
I don’t have an instance so you will have to it try out with data. If you like you could send me an instance

1) Redefine element mptr as follows

xs:complexType
<xs:anyAttribute namespace=“XLink namespace” />
</xs:complexType>
or 2)
xs:complexType
<xs:anyAttribute namespace=“##other” />
</xs:complexType>

I have seen your solutions…
My problems appears similar to what u described.
my schema looks like this…

<xs:element name = “description”>
xs:complexType
xs:sequence
<xs:element ref = “langstring”></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name = “description”>
xs:complexType
xs:sequence
<xs:any namespace = “http://www.nie.ecc.org.sg”></xs:any>
<xs:element ref = “langstring”></xs:element>
<xs:element ref = “usagerights”></xs:element>
<xs:element ref = “unitpricing”></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

I need two description elements that have different sub elements. But this schema always give me an error saying duplicated name.
I tried to add namespace at the top of the schema,
but it doesn;t work

Thanks alot.

Please see How do i declare two complex elements of the same name with different sub elements using tamino schema?.