Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

rng-users · RELAX NG users

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 194
  • Category: XML
  • Founded: Jun 18, 2005
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 1316 - 1346 of 1479   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#1316 From: "Tara" <taraathan@...>
Date: Mon Feb 7, 2011 10:52 pm
Subject: how to specify xsd:anyType
taraathan
Send Email Send Email
 
I am preparing a Relax NG compact schema to use as a pivot format.
The original schema (actually a complex hierarchy) is xsd.
I am running into trouble with xsd:anyType

I have the xsd

<xs:element name="Data" type="xs:anyType"/>

What can I put into Relax NG that will produce this when converted to xsd (I am
using oXygen) or at least emulate it?

I have tried

Data.type = element Data {data}

as suggested in Relax NG textbook by van der Vlist, but this gives an error
[Jing] reference to undefined pattern "data"

I thought about trying to define the pattern myself

data = xsd:decimal|xsd:float| and so on
but I looked up what types I would have to list and there were so
many that this just seemed ridiculous.

So I thought, maybe

data = xsd:*
would work, but that says "syntax error" .

I have run out of ideas ... any suggestions?

Thanks, Tara

#1317 From: John Cowan <cowan@...>
Date: Tue Feb 8, 2011 1:23 am
Subject: Re: how to specify xsd:anyType
johnwcowan
Send Email Send Email
 
Tara scripsit:

> I am preparing a Relax NG compact schema to use as a pivot format.
> The original schema (actually a complex hierarchy) is xsd.
> I am running into trouble with xsd:anyType

The trouble is that anyType means "any simple or complex type", and
RELAX NG doesn't support that; it only supports XSD simple types.
Perhaps you want anySimpleType?

--
Your worships will perhaps be thinking          John Cowan
that it is an easy thing to blow up a dog?      http://www.ccil.org/~cowan
[Or] to write a book?
     --Don Quixote, Introduction                 cowan@...

#1318 From: Tara Athan <taraathan@...>
Date: Wed Feb 9, 2011 8:35 am
Subject: Re: how to specify xsd:anyType
taraathan
Send Email Send Email
 
John Cowan wrote:
 

Tara scripsit:

> I am preparing a Relax NG compact schema to use as a pivot format.
> The original schema (actually a complex hierarchy) is xsd.
> I am running into trouble with xsd:anyType

The trouble is that anyType means "any simple or complex type", and
RELAX NG doesn't support that; it only supports XSD simple types.
Perhaps you want anySimpleType?

Yes, you are right. But I can't get that working either.

I've boiled it down to some simple test cases. Here is a bit of xml code. I want the schema to validate contents of Data elements
based on the explicit type given by the xsi:type attribute.

<?xml version="1.0" encoding="UTF-8"?>
<arg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.taraathan.com/1.0/xsd ../../modules/data_test.xsd"
      xmlns="http://www.taraathan.com/1.0/xsd"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema-datatypes"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <Data xsi:type="xs:dateTime">2010-01-22T10:03:45Z</Data>
    <Data xsi:type="xs:decimal">123.4</Data>
</arg>

This XML schema works as required (in oXygen)

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://www.taraathan.com/1.0/xsd"
    xmlns:xsd="http://www.taraathan.com/1.0/xsd">
  <xs:element name="arg" type="xsd:arg.content"/>
  <xs:complexType name="arg.content">
    <xs:complexContent>
      <xs:extension base="xsd:Data.type"/>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="Data.type">
    <xs:sequence>
      <xs:element ref="xsd:Data"/>
      <xs:element ref="xsd:Data"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="Data" type="xs:anySimpleType"/>
</xs:schema>

I would like to have a Relax NG compact schema which allows this construction. I would be OK if it doesn't perform the datatype validation, but it should at least ignore the xsi:type attribute.  But I can't get that to happen.  A direct attack fails

Data.type = element Data { xsd:anySimpleType }

results in (in oXygen)
[Jing] datatype "anySimpleType" from library "http://www.w3.org/2001/XMLSchema-datatypes" not recognized

A sneak attack fails also:

default namespace = "http://www.taraathan.com/1.0/xsd"
namespace xs="http://www.w3.org/2001/XMLSchema"
namespace xsi="http://www.w3.org/2001/XMLSchema-instance"
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"

anySimpleType =
xsd:duration|
xsd:dateTime|
xsd:time|
xsd:date|
xsd:gYearMonth|
xsd:gYear|
xsd:gMonthDay|
xsd:gDay|
xsd:gMonth|
xsd:boolean|
xsd:base64Binary|
xsd:hexBinary|
xsd:float|
xsd:decimal|
xsd:double|
xsd:anyURI|
xsd:QName|
xsd:NOTATION|
xsd:string

start = arg.type

arg.type = element arg {  arg.content }

arg.content = Data.type,Data.type

Data.type = element Data { anySimpleType }

The schema is OK, but when used to validate the above code I get (in oXygen)
 [Jing] found attribute "xsi:type", but no attributes allowed here.
However when I convert (in oXygen) to xsd, I get a schema which validates the xml, including validating against the explicit type.

Suggestions are greatly appreciated.

Tara


#1319 From: John Cowan <cowan@...>
Date: Mon Feb 14, 2011 4:37 am
Subject: Re: how to specify xsd:anyType
johnwcowan
Send Email Send Email
 
Tara Athan scripsit:

> However when I convert (in oXygen) to xsd, I get a schema which
> validates the xml, including validating against the explicit type.

There's a bug in trang: it doesn't ignore declarations for the xsi:
namespace when converting to XSD.  You have to do a little post-editing.

--
Some people open all the Windows;       John Cowan
wise wives welcome the spring           cowan@...
by moving the Unix.                     http://www.ccil.org/~cowan
   --ad for Unix Book Units (U.K.)
         (see http://cm.bell-labs.com/cm/cs/who/dmr/unix3image.gif)

#1320 From: Tara Athan <taraathan@...>
Date: Mon Feb 14, 2011 7:34 pm
Subject: Re: how to specify xsd:anyType
taraathan
Send Email Send Email
 
John Cowan wrote:
 

Tara Athan scripsit:

> However when I convert (in oXygen) to xsd, I get a schema which
> validates the xml, including validating against the explicit type.

There's a bug in trang: it doesn't ignore declarations for the xsi:
namespace when converting to XSD. You have to do a little post-editing.


Thanks for the tip - I added my vote and a comment to the jing-trang issue #132

At first I was surprised that this was considered a bug in trang rather than a bug in jing. From my perspective, I would rather that the rng validator allow an xsi:type attribute, where appropriate, by default rather than requiring it to be explicitly declared. But I re-read the Relax NG specs, and yes that's what it says :(

This is a big setback for me, because this element is to be part of a core module in a highly user-extensible system. So a little post-editing becomes a big headache and high risk for user-error.


Tara


--
Some people open all the Windows; John Cowan
wise wives welcome the spring cowan@...
by moving the Unix. http://www.ccil.org/~cowan
--ad for Unix Book Units (U.K.)
(see http://cm.bell-labs.com/cm/cs/who/dmr/unix3image.gif)



#1321 From: John Cowan <cowan@...>
Date: Mon Feb 14, 2011 8:44 pm
Subject: Re: how to specify xsd:anyType
johnwcowan
Send Email Send Email
 
Tara Athan scripsit:

> At first I was surprised that this was considered a bug in trang rather
> than a bug in jing. From my perspective, I would rather that the rng
> validator allow an xsi:type attribute, where appropriate, by default
> rather than requiring it to be explicitly declared. But I re-read the
> Relax NG specs, and yes that's what it says :(

In the pure RELAX NG model, the only namespace that is special is xml:,
and that's because it's special in XML as a whole.  Even then, you have
to write patterns for xml: attributes, just like anythying else.  The time
to treat xsi: specially is when you switch to the XSD environment.

> This is a big setback for me, because this element is to be part of a
> core module in a highly user-extensible system. So a little post-editing
> becomes a big headache and high risk for user-error.

Put together a little tool (it's easy with XSLT) to strip it out as part
of your conversion framework.

--
Dream projects long deferred             John Cowan <cowan@...>
usually bite the wax tadpole.            http://www.ccil.org/~cowan
         --James Lileks

#1322 From: Tara Athan <taraathan@...>
Date: Mon Feb 14, 2011 9:49 pm
Subject: Re: how to specify xsd:anyType
taraathan
Send Email Send Email
 
John Cowan wrote:
 

Tara Athan scripsit:

> At first I was surprised that this was considered a bug in trang rather
> than a bug in jing. From my perspective, I would rather that the rng
> validator allow an xsi:type attribute, where appropriate, by default
> rather than requiring it to be explicitly declared. But I re-read the
> Relax NG specs, and yes that's what it says :(

In the pure RELAX NG model, the only namespace that is special is xml:,
and that's because it's special in XML as a whole. Even then, you have
to write patterns for xml: attributes, just like anythying else. The time
to treat xsi: specially is when you switch to the XSD environment.

> This is a big setback for me, because this element is to be part of a
> core module in a highly user-extensible system. So a little post-editing
> becomes a big headache and high risk for user-error.

Put together a little tool (it's easy with XSLT) to strip it out as part
of your conversion framework.

There is no conversion framework. The modules are open source and they are just made available for download or reference by URI, for users to assemble as they wish. Even if we did provide a conversion tool, when the schema are published like this, there is no way to ensure that users will use the tool instead of going directly to oXygen or Trang. 

I took a look at the Trang source code, and with a little advice I might be able to create a patch. Is there a separate rng-dev forum, or does that sort of discussion happen on this list?

Tara


--
Dream projects long deferred John Cowan <cowan@...>
usually bite the wax tadpole. http://www.ccil.org/~cowan
--James Lileks



#1323 From: John Cowan <cowan@...>
Date: Tue Feb 15, 2011 8:05 pm
Subject: Re: how to specify xsd:anyType
johnwcowan
Send Email Send Email
 
Tara Athan scripsit:

> There is no conversion framework. The modules are open source and they
> are just made available for download or reference by URI, for users to
> assemble as they wish. Even if we did provide a conversion tool, when
> the schema are published like this, there is no way to ensure that users
> will use the tool instead of going directly to oXygen or Trang.

No, but you can publish both the source RNG and the slightly edited XSD
versions, so that people who prefer XSD can use it.

>
> I took a look at the Trang source code, and with a little advice I might
> be able to create a patch. Is there a separate rng-dev forum, or does
> that sort of discussion happen on this list?

Here's as good a place as any.

--
All Gaul is divided into three parts: the part          John Cowan
that cooks with lard and goose fat, the part            http://ccil.org/~cowan
that cooks with olive oil, and the part that            cowan@...
cooks with butter. --David Chessler

#1324 From: "arghman" <jmsachs@...>
Date: Fri Feb 18, 2011 7:37 pm
Subject: error: repeat of "string" or "data" element
arghman
Send Email Send Email
 
Help! I'm trying to validate particular text content in an XML file, using jing,
and I get an error:

   error: repeat of "string" or "data" element

Could anyone help me understand why and figure out a workaround? My example .rnc
and .xml files are posted in a StackOverflow question
(http://stackoverflow.com/questions/5044787/relaxng-invalid-schema-definition)
-- I posted there first hoping someone would answer, but  there are very few
RELAX NG questions.

--Jason

#1325 From: Syd Bauman <Syd_Bauman@...>
Date: Fri Feb 18, 2011 8:14 pm
Subject: Re: error: repeat of "string" or "data" element
syd_bauman
Send Email Send Email
 
[Fast and only marginally useful answer, as I don't have time right
now to try to figure out what your trying to do, and thus what a
solution might be.]

Your schema boils down to having

   xsd:token { pattern = "[A-Za-z_][A-Za-z_0-9]*(\.[A-Za-z_][A-Za-z_0-9]*)*" }

in a repeatable choice. That "xsd:token", in the XML syntax, is
represented by a <data> element with type="token". So you end up with

   <zeroOrMore>
     <choice>
       <data type="token">
         <param
name="pattern">[A-Za-z_][A-Za-z_0-9]*(\.[A-Za-z_][A-Za-z_0-9]*)*</param>
       </data>
       <!-- ... -->
     </choice>
   </zeroOrMore>

That puts a <data> element as a descendant of <zeroOrMore> or
<oneOrMore>, which isn't allowed.

> Help! I'm trying to validate particular text content in an XML file, using
jing, and I get an error:
>
>   error: repeat of "string" or "data" element
>
> Could anyone help me understand why and figure out a workaround? My
> example .rnc and .xml files are posted in a StackOverflow question
> (http://stackoverflow.com/questions/5044787/relaxng-invalid-schema-definition)
> -- I posted there first hoping someone would answer, but there are
> very few RELAX NG questions.

#1326 From: John Cowan <cowan@...>
Date: Fri Feb 18, 2011 11:12 pm
Subject: Re: error: repeat of "string" or "data" element
johnwcowan
Send Email Send Email
 
arghman scripsit:

> Help! I'm trying to validate particular text content in an XML file,
> using jing, and I get an error:
>
>   error: repeat of "string" or "data" element
>
> Could anyone help me understand why and figure out a workaround? My
> example .rnc and .xml files are posted in a StackOverflow question
> (http://stackoverflow.com/questions/5044787/relaxng-invalid-schema-definition)
> -- I posted there first hoping someone would answer, but  there are
> very few RELAX NG questions.

You've bumped up against one of RELAX NG's basic limitations: an element's
content can be complex (with text patterns, element patterns, sequence
patterns, interleave patterns, and quantifier patterns) or simple (with
data patterns, value patterns, and list patterns), but not both at the
same time. (Of course, it's possible to have a choice between complex
and simple content.)

You really can't do better than to use text here, and maybe write a
Schematron rule or two.

(I've posted this to stackoverflow as well.)

--
John Cowan              cowan@...          http://www.ccil.org/~cowan
Most people are much more ignorant about language than they are about
[other subjects], but they reckon that because they can talk and read and
write, their opinions about talking and reading and writing are as well
informed as anybody's.  And since I have DNA, I'm entitled to carry on at
length about genetics without bothering to learn anything about it.  Not.
                         --Mark Liberman

#1327 From: James Clark <jjc@...>
Date: Sat Feb 19, 2011 1:06 am
Subject: Re: error: repeat of "string" or "data" element
james_j_clark
Send Email Send Email
 
Try using the

  list { ... }

operator. See the tutorial:


James

On Sat, Feb 19, 2011 at 2:37 AM, arghman <jmsachs@...> wrote:
 

Help! I'm trying to validate particular text content in an XML file, using jing, and I get an error:

error: repeat of "string" or "data" element

Could anyone help me understand why and figure out a workaround? My example .rnc and .xml files are posted in a StackOverflow question
(http://stackoverflow.com/questions/5044787/relaxng-invalid-schema-definition) -- I posted there first hoping someone would answer, but there are very few RELAX NG questions.

--Jason



#1328 From: John Cowan <cowan@...>
Date: Sat Feb 19, 2011 1:54 am
Subject: Re: error: repeat of "string" or "data" element
johnwcowan
Send Email Send Email
 
James Clark scripsit:

> Try using the
>
>   list { ... }
>
> operator. See the tutorial:

It won't help in this case, because there are interleaved child elements,
which mixes complex and simple content.

--
He made the Legislature meet at one-horse       John Cowan
tank-towns out in the alfalfa belt, so that     cowan@...
hardly nobody could get there and most of       http://www.ccil.org/~cowan
the leaders would stay home and let him go      --H.L. Mencken's
to work and do things as he pleased.              Declaration of Independence

#1329 From: James Clark <jjc@...>
Date: Sat Feb 19, 2011 2:04 am
Subject: Re: error: repeat of "string" or "data" element
james_j_clark
Send Email Send Email
 
Ah, I see. I believe it would be feasible to relax the restriction on list {...} sufficiently to this example work. Not sure how useful that would be though.

James

On Sat, Feb 19, 2011 at 8:54 AM, John Cowan <cowan@...> wrote:
 

James Clark scripsit:



> Try using the
>
> list { ... }
>
> operator. See the tutorial:

It won't help in this case, because there are interleaved child elements,
which mixes complex and simple content.

--
He made the Legislature meet at one-horse John Cowan
tank-towns out in the alfalfa belt, so that cowan@...
hardly nobody could get there and most of http://www.ccil.org/~cowan
the leaders would stay home and let him go --H.L. Mencken's
to work and do things as he pleased. Declaration of Independence



#1330 From: "jcbrai" <jcbrai@...>
Date: Tue Feb 22, 2011 9:38 pm
Subject: "Versioning" schemas
jcbrai
Send Email Send Email
 
Hello.

We're in the situation where we need to be able to validate
old versions of documents (written with old "versions" of
schemas). I quote "versions" because they're obviously not
really "versioned", they just have a different number in the
namespace URI.

Anyway. Ideally, we'd have a single schema file that includes
all of the older versions of the schema so that the application
doing the validation doesn't have to map namespaces to schema
files.

Here are two versions:

<?xml version="1.0" encoding="UTF-8"?>
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0"
   xmlns:r1="http://example.com/r1"
   datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
   <rng:start>
     <rng:ref name="r_elem"/>
   </rng:start>
   <rng:define name="r_elem">
     <rng:element name="r1:abcd">
       <rng:element name="r1:efgh"><rng:text/></rng:element>
     </rng:element>
   </rng:define>
</rng:grammar>

---

<?xml version="1.0" encoding="UTF-8"?>
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0"
   xmlns:r2="http://example.com/r2"
   datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
   <rng:start>
     <rng:ref name="r_elem"/>
   </rng:start>
   <rng:define name="r_elem">
     <rng:element name="r2:abcd">
       <rng:element name="r2:efgh"><rng:empty/></rng:element>
     </rng:element>
   </rng:define>
</rng:grammar>

---

Now we have a "main" schema file (for the purposes of in-application
validation):

<?xml version="1.0" encoding="UTF-8"?>
<rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0"
   xmlns:r1="http://example.com/r1"
   xmlns:r2="http://example.com/r2"
   datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

   <rng:include href="r1.rng"/>
   <rng:include href="r2.rng"/>

   <rng:start>
     <rng:ref name="r_elem"/>
   </rng:start>
</rng:grammar>

The problem is obviously immediately apparent: Which r_elem are we
talking about?

$ xmllint --noout --relaxng r.rng r1.xml
r2.rng:7: element ref: Relax-NG parser error : Some <start> element miss the
combine attribute
r.rng:11: element ref: Relax-NG parser error : Some <start> element miss the
combine attribute
r1.rng:10: element define: Relax-NG parser error : Some defines for r_elem needs
the combine attribute
r1.rng:7: element ref: Relax-NG parser error : Found forbidden pattern
start//interleave
r1.rng:10: element define: Relax-NG parser error : Found forbidden pattern
start//interleave
r1.rng:10: element define: Relax-NG parser error : Found forbidden pattern
start//interleave
r1.rng:10: element define: Relax-NG parser error : Found forbidden pattern
start//interleave
Relax-NG schema r.rng failed to compile

Previously, we've encoded version numbers in every single rng:define
name, but this seems clumsy and risky (it's easy to slip up and
put the wrong number in, or forget to do it).

Is there some better solution to this problem?

#1331 From: "nikolai.weibull" <now@...>
Date: Sat Feb 26, 2011 9:39 am
Subject: Why isn’t Jing picking up xml:id for XInclude?
nikolai.weibull
Send Email Send Email
 
Given the following files

a.rnc:

     start = a
     a = element a { b }
     b = element b {
       attribute xml:id { xsd:ID }?,
       attribute xml:base { xsd:ID }?,
       empty
     }

a.xml:

     <a xmlns:xi="http://www.w3.org/2001/XInclude">
       <xi:include href="b.xml" xpointer="element(bid)"/>
     </a>

b.xml:

     <a><b xml:id="bid"/></a>

Why is Jing reporting

     a.xml:1:97: warning: Include operation failed, reverting to fallback.
Resource error reading file as XML (href='b.xml'). Reason: XPointer resolution
unsuccessful.
     a.xml:1:97: fatal: An 'include' failed, and no 'fallback' element was found.

when run as

     java
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.\
XIncludeParserConfiguration -jar jing.jar -c a.rnc a.xml

?

If I change the xpointer attribute to `element(/1/1)` it passes.

This is with the 20091111 of Jing with xercesImpl.jar in the same directory as
jing.jar.

#1332 From: George Cristian Bina <george@...>
Date: Sat Feb 26, 2011 2:45 pm
Subject: Re: "Versioning" schemas
george_bina
Send Email Send Email
 
See the externalRef pattern. Basically the start of the main schema
should be a choice between an external ref to the schemas you want to
support.

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 2/22/11 11:38 PM, jcbrai wrote:
> Hello.
>
> We're in the situation where we need to be able to validate
> old versions of documents (written with old "versions" of
> schemas). I quote "versions" because they're obviously not
> really "versioned", they just have a different number in the
> namespace URI.
>
> Anyway. Ideally, we'd have a single schema file that includes
> all of the older versions of the schema so that the application
> doing the validation doesn't have to map namespaces to schema
> files.
>
> Here are two versions:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0"
>    xmlns:r1="http://example.com/r1"
>    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
>    <rng:start>
>      <rng:ref name="r_elem"/>
>    </rng:start>
>    <rng:define name="r_elem">
>      <rng:element name="r1:abcd">
>        <rng:element name="r1:efgh"><rng:text/></rng:element>
>      </rng:element>
>    </rng:define>
> </rng:grammar>
>
> ---
>
> <?xml version="1.0" encoding="UTF-8"?>
> <rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0"
>    xmlns:r2="http://example.com/r2"
>    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
>    <rng:start>
>      <rng:ref name="r_elem"/>
>    </rng:start>
>    <rng:define name="r_elem">
>      <rng:element name="r2:abcd">
>        <rng:element name="r2:efgh"><rng:empty/></rng:element>
>      </rng:element>
>    </rng:define>
> </rng:grammar>
>
> ---
>
> Now we have a "main" schema file (for the purposes of in-application
> validation):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <rng:grammar xmlns:rng="http://relaxng.org/ns/structure/1.0"
>    xmlns:r1="http://example.com/r1"
>    xmlns:r2="http://example.com/r2"
>    datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
>
>    <rng:include href="r1.rng"/>
>    <rng:include href="r2.rng"/>
>
>    <rng:start>
>      <rng:ref name="r_elem"/>
>    </rng:start>
> </rng:grammar>
>
> The problem is obviously immediately apparent: Which r_elem are we
> talking about?
>
> $ xmllint --noout --relaxng r.rng r1.xml
> r2.rng:7: element ref: Relax-NG parser error : Some<start>  element miss the
combine attribute
> r.rng:11: element ref: Relax-NG parser error : Some<start>  element miss the
combine attribute
> r1.rng:10: element define: Relax-NG parser error : Some defines for r_elem
needs the combine attribute
> r1.rng:7: element ref: Relax-NG parser error : Found forbidden pattern
start//interleave
> r1.rng:10: element define: Relax-NG parser error : Found forbidden pattern
start//interleave
> r1.rng:10: element define: Relax-NG parser error : Found forbidden pattern
start//interleave
> r1.rng:10: element define: Relax-NG parser error : Found forbidden pattern
start//interleave
> Relax-NG schema r.rng failed to compile
>
> Previously, we've encoded version numbers in every single rng:define
> name, but this seems clumsy and risky (it's easy to slip up and
> put the wrong number in, or forget to do it).
>
> Is there some better solution to this problem?
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#1333 From: George Cristian Bina <george@...>
Date: Sat Feb 26, 2011 2:57 pm
Subject: Re: Why isn’t Jing picking up xml:id for XInclude?
george_bina
Send Email Send Email
 
Currently Jing acts like a content handler set on the parser. The
XInclude operation is performed by Xerces earlier, by a component set in
the parser internal pipeline (at Xerces Native Interface level).

On the other hand Xerces should support xml:id and set the ID type for
xml:id attributes. I proposed a patch that we include in oXygen exactly
for being able to use xml:id values as shorthand pointers, you can see
details here:
https://issues.apache.org/jira/browse/XERCESJ-1113

It is possible also to build again at XNI level a component that can
look into a Relax NG schema and set the ID type for anything that the
Relax NG schema defines as ID. I have work in progress with something
like this for adding default values specified in the Relax NG schema
with an a:defaultValue annotation.

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 2/26/11 11:39 AM, nikolai.weibull wrote:
> Given the following files
>
> a.rnc:
>
>      start = a
>      a = element a { b }
>      b = element b {
>        attribute xml:id { xsd:ID }?,
>        attribute xml:base { xsd:ID }?,
>        empty
>      }
>
> a.xml:
>
>      <a xmlns:xi="http://www.w3.org/2001/XInclude">
>        <xi:include href="b.xml" xpointer="element(bid)"/>
>      </a>
>
> b.xml:
>
>      <a><b xml:id="bid"/></a>
>
> Why is Jing reporting
>
>      a.xml:1:97: warning: Include operation failed, reverting to fallback.
Resource error reading file as XML (href='b.xml'). Reason: XPointer resolution
unsuccessful.
>      a.xml:1:97: fatal: An 'include' failed, and no 'fallback' element was
found.
>
> when run as
>
>      java
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.\
XIncludeParserConfiguration -jar jing.jar -c a.rnc a.xml
>
> ?
>
> If I change the xpointer attribute to `element(/1/1)` it passes.
>
> This is with the 20091111 of Jing with xercesImpl.jar in the same directory as
jing.jar.
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#1334 From: Nikolai Weibull <now@...>
Date: Sat Feb 26, 2011 3:07 pm
Subject: Re: Why isn’t Jing picking up xml:id for XInclude?
nikolai.weibull
Send Email Send Email
 
On Sat, Feb 26, 2011 at 15:57, George Cristian Bina
<george@...> wrote:

> On the other hand Xerces should support xml:id and set the ID type for
> xml:id attributes. I proposed a patch that we include in oXygen exactly for
> being able to use xml:id values as shorthand pointers, you can see details
> here:
> https://issues.apache.org/jira/browse/XERCESJ-1113

Ah so it’s a Xerces problem.  And it’s gone unfixed for five and a
half years.  Is there any way of getting around this, short of
patching Xerces?

#1335 From: George Cristian Bina <george@...>
Date: Sat Feb 26, 2011 3:15 pm
Subject: Re: Why isn’t Jing picking up xml:id for XInclude?
george_bina
Send Email Send Email
 
We use the proposed patch in oXygen since then but as you can see in the
issue description there were some concerns related with the value
normalization - however we never received any complains related with
this in these 5 years.

There is a GSoC proposal for implementing xml:id in Xerces so this may
get fixed at the end of this summer.

Alternatively you can just go on and apply the patch provided in the issue.

Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

On 2/26/11 5:07 PM, Nikolai Weibull wrote:
> On Sat, Feb 26, 2011 at 15:57, George Cristian Bina
> <george@...>  wrote:
>
>> On the other hand Xerces should support xml:id and set the ID type for
>> xml:id attributes. I proposed a patch that we include in oXygen exactly for
>> being able to use xml:id values as shorthand pointers, you can see details
>> here:
>> https://issues.apache.org/jira/browse/XERCESJ-1113
>
> Ah so it’s a Xerces problem.  And it’s gone unfixed for five and a
> half years.  Is there any way of getting around this, short of
> patching Xerces?
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#1337 From: Syd Bauman <Syd_Bauman@...>
Date: Sat Mar 12, 2011 4:36 pm
Subject: corrected - student awards for Balisage 2011
syd_bauman
Send Email Send Email
 
Correction: Applications for the Balisage 2011 Student awards are due
   Fri 08 Apr 2011. Full details on the award program and application
   process are at: http://www.balisage.net/special/students.html

#1338 From: Tara Athan <taraathan@...>
Date: Mon Apr 4, 2011 7:47 am
Subject: problem with -s switch on Jing?
taraathan
Send Email Send Email
 
I have run into some problems with implementing an abstract schema where
"notAllowed" is used as a child of an optional element an interleave. As
a simple test case, see element A below. The original idea was that the
"notAllowed" would cause the element it belongs to to fail, but since it
is optional that part of the pattern would just disappear, unless
over-ridden.

This works as planned if the optional pattern itself is abstract (see
example element D below).

And the schema below is valid and works properly as a guidance schema in
the editor.

start = A | D
A = element A { B* & C? }
B = element B { text }
C = element C { E }
D = element D { B* & E?  }
E = notAllowed

I have a highly modular schema, so I run jing -s on it to flatten. This
also prepares the schema for translation into XSD. But when I do that on
the schema above, I get

start = A | D
A = element A { B* & _1? }
D = element D { B* }
B = element B { text }
_1 = element * { notAllowed }

which is invalid, because ' element "B" can occur in more than one
operand of "interleave" '.
The only reason this happens is because of the  element *.
I would have expected to see

start = A | D
A = element A { B* }
D = element D { B* }
B = element B { text }

I think this is a bug - has anyone run into this before?

Thanks, Tara

#1339 From: Tara Athan <taraathan@...>
Date: Wed Apr 13, 2011 5:17 pm
Subject: implementing explicit datatyping in Relax NG - user-defined datatype library?
taraathan
Send Email Send Email
 
Revisiting the issue of xsi attributes ...


I have a situation where I could create the schema my client really wants with an NVDL script, validating against Relax NG for the complex 'datatypes' and using an XSD to bring in the functionality of explicit datatyping, as in

<Data xsi:type = "xs:nonNegativeInteger>5</Data>

But the client is unwilling to buy-in to NVDL at this stage - they are hoping for a completely pure Relax NG solution.

I was able to create a hack which allows the element above to be validated by Relax NG (including the type-checking), but it is unsatisfactory because it assumes the "xs" prefix is used for the namespace of the built-in datatypes.  Here's a section of the code:

Data.type |=
    element Data { anySimpleTypeForElements.datatype.choice }
...
anySimpleTypeForElements.datatype.choice |= nonNegativeInteger.datatype.choice
nonNegativeInteger.datatype.choice =
    attribute xsi:type { "xs:nonNegativeInteger" }?,
    xsd:nonNegativeInteger

...
with similar patterns for all the built-in datatypes.

I was wondering if anyone has implemented explicit datatyping as a user-defined datatype library (as in RELAX NG Datatype API), or if not, would anyone familiar with that feature venture an opinion as to whether it is possible to implement the above with an arbitrary prefix?

If it would not be possible, that is an argument I can give to the client that NVDL is the only way to get this capability.

Thanks, Tara


#1340 From: James Clark <jjc@...>
Date: Thu Apr 14, 2011 2:35 am
Subject: Re: implementing explicit datatyping in Relax NG - user-defined datatype library?
james_j_clark
Send Email Send Email
 
IIRC, you can do something like this (you'll need to declare the xs prefix):

attribute xsi:type { xsd:QName "xs:nonNegativeInteger" }, xsd:nonNegativeInteger

On Thu, Apr 14, 2011 at 12:17 AM, Tara Athan <taraathan@...> wrote:
 

Revisiting the issue of xsi attributes ...


I have a situation where I could create the schema my client really wants with an NVDL script, validating against Relax NG for the complex 'datatypes' and using an XSD to bring in the functionality of explicit datatyping, as in

<Data xsi:type = "xs:nonNegativeInteger>5</Data>

But the client is unwilling to buy-in to NVDL at this stage - they are hoping for a completely pure Relax NG solution.

I was able to create a hack which allows the element above to be validated by Relax NG (including the type-checking), but it is unsatisfactory because it assumes the "xs" prefix is used for the namespace of the built-in datatypes.  Here's a section of the code:

Data.type |=
    element Data { anySimpleTypeForElements.datatype.choice }
...
anySimpleTypeForElements.datatype.choice |= nonNegativeInteger.datatype.choice
nonNegativeInteger.datatype.choice =
    attribute xsi:type { "xs:nonNegativeInteger" }?,
    xsd:nonNegativeInteger

...
with similar patterns for all the built-in datatypes.

I was wondering if anyone has implemented explicit datatyping as a user-defined datatype library (as in RELAX NG Datatype API), or if not, would anyone familiar with that feature venture an opinion as to whether it is possible to implement the above with an arbitrary prefix?

If it would not be possible, that is an argument I can give to the client that NVDL is the only way to get this capability.

Thanks, Tara



#1341 From: "peet54@..." <peetkes@...>
Date: Wed Apr 27, 2011 12:25 pm
Subject: I'm loosing default values for attributes when I convert from rng to dtd
peet54...
Send Email Send Email
 
Hi all,

I'm converting a rng schema into a DTD but all defaulted attributes loose their
defaults and become #REQUIRED attributes.
I've looked into the code and found out that in the module DTDOutput.java there
is a check in method visitAttribute that will always set the attribute to
#REQUIRED if there is only one attribute defined. Is that the right way or is
this a bug?

Best regards,

Peet

#1342 From: Tara Athan <taraathan@...>
Date: Wed Apr 27, 2011 9:41 pm
Subject: Theory Question: sub-grammars and sub-languages
taraathan
Send Email Send Email
 
This question may seem theoretical,  but it affects an application that
I am working on now, using Relax NG to define a lattice of markup languages.

I have discovered that if one follows a few simple patterns in writing
RNC modules, then it is possible to ensure that including a module does
not invalidate any previously valid documents. That is, under certain
conditions a super-grammar is also a super-language, while it is not
true in general. I think it might even be possible to modify the schema
that defines Relax NG itself to check for these conditions.

I am curious if I am re-discovering something that is already
well-known, perhaps published, that I could reference, or whether this
something new?

Tara

#1343 From: "David G. Durand" <modified.dog@...>
Date: Thu Apr 28, 2011 2:14 am
Subject: Re: Theory Question: sub-grammars and sub-languages
dgd23
Send Email Send Email
 
The first place to check, probably, for results like this, is the tree atomata
and applications textbook, available online:

http://tata.gforge.inria.fr/

   -- David

On Apr 27, 2011, at 5:41 PM, Tara Athan wrote:

> This question may seem theoretical,  but it affects an application that
> I am working on now, using Relax NG to define a lattice of markup languages.
>
> I have discovered that if one follows a few simple patterns in writing
> RNC modules, then it is possible to ensure that including a module does
> not invalidate any previously valid documents. That is, under certain
> conditions a super-grammar is also a super-language, while it is not
> true in general. I think it might even be possible to modify the schema
> that defines Relax NG itself to check for these conditions.
>
> I am curious if I am re-discovering something that is already
> well-known, perhaps published, that I could reference, or whether this
> something new?
>
> Tara
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#1344 From: Syd Bauman <Syd_Bauman@...>
Date: Thu Apr 28, 2011 2:34 am
Subject: Re: I'm loosing default values for attributes when I convert from rng to dtd
syd_bauman
Send Email Send Email
 
Just to ensure that the details straight:

* What technology are you using to convert from RNG to DTD (I'll
   guess `trang`; if so, what version?)

* What do you mean by "defaulted attribute"? One key feature (or
   shortcoming, depending on your point of view) of RELAX NG is that
   there is no such thing as a default value. The DTD compatibility
   spec describes a method for adding default attribute value
   information using the annotation namesace (see
   http://relaxng.org/compatibility-20011203.html#default-value) Is
   this what you're using?

> I'm converting a rng schema into a DTD but all defaulted attributes
> loose their defaults and become #REQUIRED attributes. I've looked
> into the code and found out that in the module DTDOutput.java there
> is a check in method visitAttribute that will always set the
> attribute to #REQUIRED if there is only one attribute defined. Is
> that the right way or is this a bug?

#1345 From: MURATA Makoto <EB2M-MRT@...>
Date: Thu Apr 28, 2011 2:38 am
Subject: Re: Theory Question: sub-grammars and sub-languages
mktmurata
Send Email Send Email
 
Tara,

As long as you do not use overriding (children of include statements)
or &=, adding more declarations never invalidates what was valid.
I call this Monotonicity.

2011/4/28 Tara Athan <taraathan@...>:
> This question may seem theoretical,  but it affects an application that
> I am working on now, using Relax NG to define a lattice of markup languages.
>
> I have discovered that if one follows a few simple patterns in writing
> RNC modules, then it is possible to ensure that including a module does
> not invalidate any previously valid documents. That is, under certain
> conditions a super-grammar is also a super-language, while it is not
> true in general. I think it might even be possible to modify the schema
> that defines Relax NG itself to check for these conditions.
>
> I am curious if I am re-discovering something that is already
> well-known, perhaps published, that I could reference, or whether this
> something new?

When I designed RELAX Core, one of the predecessors of RELAX NG,
I did not introduce &= for ensuring monotonicity.  But I never published
any papers about this.

In reality, people use schema customization techniques including
overriding definitions in included modules, especially for allowing more
attributes.  Although theoretically interesting, monotonicity does not
hold always.

Praying for the victims of the Japan Tohoku earthquake

Makoto

#1346 From: Tara Athan <taraathan@...>
Date: Thu Apr 28, 2011 7:50 am
Subject: Re: Theory Question: sub-grammars and sub-languages
taraathan
Send Email Send Email
 
Yes, but it is possible to use &= and still maintain monotonicity,
if &= only appears as
a &= b?
or
a &= empty

although this causes restrictions on further declarations of a.

Tara


MURATA Makoto wrote:
>
> Tara,
>
> As long as you do not use overriding (children of include statements)
> or &=, adding more declarations never invalidates what was valid.
> I call this Monotonicity.
>
> 2011/4/28 Tara Athan <taraathan@... <mailto:taraathan%40gmail.com>>:
> > This question may seem theoretical, but it affects an application that
> > I am working on now, using Relax NG to define a lattice of markup
> languages.
> >
> > I have discovered that if one follows a few simple patterns in writing
> > RNC modules, then it is possible to ensure that including a module does
> > not invalidate any previously valid documents. That is, under certain
> > conditions a super-grammar is also a super-language, while it is not
> > true in general. I think it might even be possible to modify the schema
> > that defines Relax NG itself to check for these conditions.
> >
> > I am curious if I am re-discovering something that is already
> > well-known, perhaps published, that I could reference, or whether this
> > something new?
>
> When I designed RELAX Core, one of the predecessors of RELAX NG,
> I did not introduce &= for ensuring monotonicity. But I never published
> any papers about this.
>
> In reality, people use schema customization techniques including
> overriding definitions in included modules, especially for allowing more
> attributes. Although theoretically interesting, monotonicity does not
> hold always.
>
> Praying for the victims of the Japan Tohoku earthquake
>
> Makoto
>
>

Messages 1316 - 1346 of 1479   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help