[Xml-compile] Which elemet produces error: illegal value `' for
type {http://www.w3.org/2001/XMLSchema}float ?
Mark Overmeer
mark at overmeer.net
Tue Nov 19 11:57:57 GMT 2013
* Radek Šťastný (dedkus at gmail.com) [131119 11:43]:
Taken from subject:
error: illegal value `' for type {http://www.w3.org/2001/XMLSchema}float
The full error message contains a path (some kind of location indication) if
there is more to say about it. It seems the element you read only has a type,
not a name. It happens.
Apparently, the message expects a float but find a blank field, hence
validation fails.
> code looks like this (simplified)
>
> my $xsd = 'file.xsd';
> my $schema = XML::Compile::Schema->new();
> $schema->addSchemaDirs('somedir');
> $schema->importDefinitions("$xsd-file");
You do not always need the addSchemaDirs(). Probably this is enough in
your case:
my $schema = XML::Compile::Schema->new("$somedir/$xsd");
Better start with ::Cache
my $schema = XML::Compile::Cache->new("$somedir/$xsd"
, prefixes => [...]
);
> my $xml = "$path/$file";
> my $reader = $schema->compile (
> READER => 'rootelement',
> elements_qualified => 'NONE');
do you really need to overrule the elementFormDefault of the schema?
> my $data=$reader->("$xml");
or directly $reader->("$path/$file");
> thanks for help, documentation is complex and above my understandig a
> little.
XML Schema's are quite large, with too many (mis)features. But you
probably do not need much.
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark at Overmeer.net solutions at overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net
More information about the Xml-compile
mailing list