[relaxng-user] Problems converting <xs:any> schema elements
Tom Gaven
Tom.Gaven at exostar.com
Fri May 28 08:08:07 ICT 2004
Spencer,
It might be good to rework the schemas manually, but as a first pass,
you might just try replacing the offending names.
Change
<define name="any(lax:##other)5">
To
<define name="any_lax___other_5">
You'd have to be careful to keep all changes in sync, since there are
bound to be many references to this particular define. Of course,
'anybutfoo' (or whatever name is meaningful to your schema) is more
descriptive than 'any_lax___other_5'
Tom
-----Original Message-----
From: relaxng-user-bounces at relaxng.org
[mailto:relaxng-user-bounces at relaxng.org] On Behalf Of Bob Foster
Sent: Friday, May 28, 2004 3:11 AM
To: Spencer Cheng
Cc: relaxng-user at relaxng.org
Subject: Re: [relaxng-user] Problems converting <xs:any> schema elements
Let's say you have a schema like:
<xs:schema elementFormDefault="qualified" xml:lang="EN"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="foo">
<xs:element name="example">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##other"
processContents="lax"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The rough equivalent of the above written in the compact syntax would
be:
default namespace foo = "foo"
start = element example { anybutfoo }
anybutfoo = element * - foo { anycontents }
anycontents = mixed {
(attribute * { text }
| any)*
}
any = element * { anycontents }
Trang translates this to RELAX NG as:
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="foo" xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<element name="example">
<ref name="anybutfoo"/>
</element>
</start>
<define name="anybutfoo">
<element>
<anyName>
<except>
<name>foo</name>
</except>
</anyName>
<ref name="anycontents"/>
</element>
</define>
<define name="anycontents">
<mixed>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<ref name="any"/>
</choice>
</zeroOrMore>
</mixed>
</define>
<define name="any">
<element>
<anyName/>
<ref name="anycontents"/>
</element>
</define>
</grammar>
Bob Foster
http://xmlbuddy.com/
Spencer Cheng wrote:
> Hi Folks,
>
> I am trying to convert some existing W3C XML schema from MPEG into >
relaxNG schema using Sun's RNG converter (mainly so I can edit XML >
documents using nXML). I am running into problems with the conversion of
> xs:any elements. > > The original elements typically looks like
this. > > <xsd:any namespace="##other" processContents="lax"/> > >
The output from rngconv looks like > > <define
name="any(lax:##other)5"> > > Which does not validate. Being new to
relaxNG, would someone provide > some hints on how to fix these
manually? I could remove them from the > original schema but that seems
to be cheating. :) > > Regards > Spencer > >
_______________________________________________
> relaxng-user mailing list
> relaxng-user at relaxng.org
> http://relaxng.org/mailman/listinfo/relaxng-user
>
_______________________________________________
relaxng-user mailing list
relaxng-user at relaxng.org
http://relaxng.org/mailman/listinfo/relaxng-user
More information about the relaxng-user
mailing list