Skip Menu |

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

Report information
The Basics
Id: 46236
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: Can't coerce GLOB to string in entersub
Date: Wed, 20 May 2009 08:37:39 +0200
To: bug-XML-Compile [...] rt.cpan.org
From: Erich Weigand <erich.weigand [...] nureg.de>
Hello, sorry, but I found another bug in XML::Compile. The error message is. Can't coerce GLOB to string in entersub at /usr/share/perl5/XML/ Compile/Translate/Writer.pm line 790. The perl script producing this error is ################### #!/usr/bin/perl use XML::Compile; use XML::Compile::Schema; my $content = { language => 'de & en', }; 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:attribute name="language" use="required"/> </xs:complexType> </xs:element> </xs:schema> #################### After changing the variable $content to my $content = { language => 'de &amp; en', }; the script works correct. So you can avoid this error by encoding all unsafe characters to entities, but if you change the attribute to an element this is done by the module. I think the encoding of attribute should also be done automatically by the module. Best regards, 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 #46236] error: Can't coerce GLOB to string in entersub
Date: Wed, 20 May 2009 09:36:25 +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:38]: Show quoted text
> Wed May 20 02:38:05 2009: Request 46236 was acted upon. > Transaction: Ticket created by erich.weigand@nureg.de > Queue: XML-Compile > Subject: error: Can't coerce GLOB to string in entersub > > sorry, but I found another bug in XML::Compile. The error message is. > Can't coerce GLOB to string in entersub at /usr/share/perl5/XML/ > Compile/Translate/Writer.pm line 790.
Slightly modified: --- 8< --- my $schema = XML::Compile::Schema->new( <<_S ); <?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:sequence> <xs:element name="a" type="xs:string" /> </xs:sequence> <xs:attribute name="language" use="required"/> </xs:complexType> </xs:element> </xs:schema> _S my $content= { language => 'de & en', a => 'de & en' }; my $write = $schema->compile( WRITER => 'products' ); my $doc = XML::LibXML::Document->new(); my $xml = $write->( $doc, $content ); print $xml->toString(1); --- 8< --- gives me: error : unterminated entity reference en <products language="de "> <a>de &amp; en</a> </products> which means that XML::LibXML does encode elements but not attribute values. Of course, that is not what you want. Seems we need a bug-report lower down in the libraries. The difference in error message is probably caused by different XML::LibXML or libxml2 versions. Which versions do you have? -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
user error