Skip Menu |

This queue is for tickets about the XML-Compile CPAN distribution.

Report information
The Basics
Id: 46212
Status: resolved
Priority: 0/
Queue: XML-Compile

People
Owner: Nobody in particular
Requestors: erich.weigand [...] nureg.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: error: no value for facet `simpleType'
Date: Tue, 19 May 2009 13:56:30 +0200
To: bug-XML-Compile [...] rt.cpan.org
From: Erich Weigand <erich.weigand [...] nureg.de>
Hello, I got problems using the modul XML::Compile. The error message is error: no value for facet `simpleType' at products#facet the perl script is #################### #!/usr/bin/perl use XML::Compile; use XML::Compile::Schema; my $content = { language => 'de', _ => 'Hallo Welt', }; my $schema = XML::Compile::Schema->new( 'test.xsd' ); my $write = $schema->compile( WRITER => 'products' ); my $doc = XML::LibXML::Document->new(); my $xml = $write->( $doc, $content ); print $xml->toString( 1 )."\n"; #################### The xsd-file is #################### <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="products"> <xs:complexType> <xs:simpleContent> <xs:restriction base="xs:anyType"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="1"/> </xs:restriction> </xs:simpleType> <xs:attribute name="language" use="required"/> </xs:restriction> </xs:simpleContent> </xs:complexType> </xs:element> </xs:schema> #################### if you delete the restriction 'minLength' the perl script works just fine. It also works if you delete the attribute language. If you need more information you can reach me at weigand@nureg.de Erich Weigand /// IT/Software-Entwicklung /// NUREG GmbH /// Dorfäckerstraße 31 | 90427 Nürnberg | Germany Tel. +49-911-32002-203 | Fax +49-911-32002-299 Nürnberg HRB 22653 | USt.ID DE 814 685 653 Geschäftsführer: Michael Schmidt, Stefan Boas www.nureg.de
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #46212] error: no value for facet `simpleType'
Date: Tue, 19 May 2009 14:14:03 +0200
To: Erich Weigand via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Erich Weigand via RT (bug-XML-Compile@rt.cpan.org) [090519 11:57]: Show quoted text
> Tue May 19 07:57:00 2009: Request 46212 was acted upon. > Transaction: Ticket created by erich.weigand@nureg.de > Queue: XML-Compile > Subject: error: no value for facet `simpleType' > > I got problems using the modul XML::Compile. The error message is > error: no value for facet `simpleType' at products#facet
I'll investigate it a little further, when I have time, but at least your schema looks broken. You either have a "restriction base" or a "restriction/simpleType", but not both at the samen time. Therefore, the parser thinks that "simpleType" is a facet name. That error message is incorrect. Show quoted text
> <xs:element name="products"> > <xs:complexType> > <xs:simpleContent> > <xs:restriction base="xs:anyType"> > <xs:simpleType> > <xs:restriction base="xs:string"> > <xs:minLength value="1"/> > </xs:restriction> > </xs:simpleType> > <xs:attribute name="language" use="required"/> > </xs:restriction> > </xs:simpleContent> > </xs:complexType> > </xs:element>
-- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #46212] error: no value for facet `simpleType'
Date: Tue, 19 May 2009 14:24:30 +0200
To: bug-XML-Compile [...] rt.cpan.org
From: Erich Weigand <erich.weigand [...] nureg.de>
Hi Mark Am 19.05.2009 um 14:14 schrieb Mark Overmeer via RT: Show quoted text
> I'll investigate it a little further, when I have time, but at > least your schema looks > broken. You either have a "restriction base" or a "restriction/ > simpleType", but not > both at the samen time. Therefore, the parser thinks that > "simpleType" is a facet name. > That error message is incorrect. >
The schema is build using Relax NG. The Relax NG file is #################### element products { attribute language { text }, xsd:string { minLength="1" } } #################### the command line simply trang test.rnc test.xsd Erich Weigand /// IT/Software-Entwicklung /// NUREG GmbH /// Dorfäckerstraße 31 | 90427 Nürnberg | Germany Tel. +49-911-32002-203 | Fax +49-911-32002-299 Nürnberg HRB 22653 | USt.ID DE 814 685 653 Geschäftsführer: Michael Schmidt, Stefan Boas www.nureg.de
Subject: Re: [rt.cpan.org #46212] error: no value for facet `simpleType'
Date: Tue, 19 May 2009 22:22:29 +0200
To: Erich Weigand via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Erich Weigand via RT (bug-XML-Compile@rt.cpan.org) [090519 12:24]: Show quoted text
> Queue: XML-Compile > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=46212 > > > The schema is build using Relax NG. The Relax NG file is > element products { > attribute language { text }, > xsd:string { minLength="1" } > }
I have never used RelaxNG... much simpler ;-) Shouldn't you use xsd:language The produced schema is correct: I have checked the specs. I'll try to fix the XML::Compile implementation ASAP. Probably simply reversing the order of some tests. Desperately looking for spare time. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #46212] error: no value for facet `simpleType'
Date: Wed, 20 May 2009 08:18:13 +0200
To: bug-XML-Compile [...] rt.cpan.org
From: Erich Weigand <erich.weigand [...] nureg.de>
Hi Mark, Am 19.05.2009 um 22:22 schrieb Mark Overmeer via RT: Show quoted text
> I have never used RelaxNG... much simpler ;-)
Yes, much simpler to specify an XML-Structure. You find more on that at http://www.relaxng.org/ http://books.xmlschemata.org/relaxng/page2.html Show quoted text
> The produced schema is correct: I have checked the specs. I'll try to > fix the XML::Compile implementation ASAP. Probably simply reversing > the order of some tests. Desperately looking for spare time.
Many thanks for the very quick reply. The modul is really easy to use. Getting such a prompt reply on an error is even better. I am looking forward for the solution Thanks in advance. Erich Weigand /// IT/Software-Entwicklung /// NUREG GmbH /// Dorfäckerstraße 31 | 90427 Nürnberg | Germany Tel. +49-911-32002-203 | Fax +49-911-32002-299 Nürnberg HRB 22653 | USt.ID DE 814 685 653 Geschäftsführer: Michael Schmidt, Stefan Boas www.nureg.de
Subject: Re: [rt.cpan.org #46212] error: no value for facet `simpleType'
Date: Wed, 20 May 2009 11:02:56 +0200
To: Erich Weigand via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Erich Weigand via RT (bug-XML-Compile@rt.cpan.org) [090520 06:18]: Show quoted text
> Yes, much simpler to specify an XML-Structure. You find more on that at > http://www.relaxng.org/
I know that it exists, but only told you that I have never used it. According what I understand from the specs (they are very hard to read for me), the "simpleType" nested structure takes preference over the type specified by the "base" attribute. So, in XML/Compile/Translate.pm we need to modify "sub simpleContentRestriction($$)" around line 1308 Remove: if(my $basename = $node->getAttribute('base')) { my $typename = $self->rel2abs($where, $node, $basename); $type = $self->blocked($where, simpleType => $type) || $self->typeByName($tree, $typename); } else { my $first = $tree->currentLocal or error __x"no base in complex-restriction, so simpleType required at {where}" , where => $where, _class => 'schema'; $first eq 'simpleType' or error __x"simpleType expected, because there is no base attribute at {where}" , where => $where, _class => 'schema'; $type = $self->simpleType($tree->descend); $tree->nextChild; } Add: my $first = $tree->currentLocal || ''; if($first eq 'simpleType') { $type = $self->simpleType($tree->descend); $tree->nextChild; } elsif(my $basename = $node->getAttribute('base')) { my $typename = $self->rel2abs($where, $node, $basename); $type = $self->blocked($where, simpleType => $type) || $self->typeByName($tree, $typename); } else { error __x"no base in complex-restriction, so simpleType required at {where}" , where => $where, _class => 'schema'; } I have added your test to the regression tests. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
fixed in 1.06