Hi Mark, Yes that makes the error go away, the compile returns a valid structure. My test is now crashing a little further on, but that's entirely my problem ;)
Thanks for the quick fix, Ciaran -----Original Message----- From: Mark Overmeer [mailto:[email protected]] Sent: mardi 3 septembre 2013 13:41 To: DEIGNAN Ciaran Cc: [email protected] Subject: Re: [Xml-compile] Schema reader doesn't compile but schema writer does? Hi Ciaran, * DEIGNAN Ciaran ([email protected]) [130903 09:36]: > The application can supply the schema for the data it provides. I can > create a writer from a schema, but I can't always create a reader. > I get the following error, and I don't know if the problem is in the > schema or in XML::Compile: > > <xs:element default="false" minOccurs="0" name="vital" nillable="true" > type="xs:boolean"> > > Perhaps it's strange to have a default on an element that's nillable...? I think it is a bug in XML::Compile. It has to do with the preparation to return the default value. The defaults need to follow the rules of their main type here (boolean), so at compile-time they get sent through the same routines as the processing of the element will walk later. Can you please test if this patch is sufficient: lib/XML/Compile/Translate/Reader.pm line 698: sub makeSimpleElement { my ( $self, $path, $tag, $st, undef, undef, $comptype, $is_nillable) = @_; $is_nillable ? sub { my $tree = shift or return $st->(undef); - my $value = $tree->nodeNil ? 'NIL' : $st->($tree); + my $value = ref $tree && $tree->nodeNil ? 'NIL' : $st->($tree); defined $value ? ($tag => $value) : (); } -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions [email protected] [email protected] http://Mark.Overmeer.net http://solutions.overmeer.net _______________________________________________ Xml-compile mailing list [email protected] http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile
