[Xml-compile] XML Compile write with xsd to validate

JOSE RAMON GONZALEZ MARTINEZ joseramon.gonzalez at ext.mpsa.com
Tue Jun 18 06:52:17 GMT 2013


Hello Mark,

First I want to thank your fast response, second yes, you're right. I meant     <prdocc>XXXXX</prdocc> just forgot to delete all x0:.
On the other hand use_default_namespace solved one of my problems getting rid of the x0: but I am lost about how to add this:
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'  xsi:noNamespaceSchemaLocation="variables.xsd"
Finally, I didn't mean to use $schema->template() if that's what you thought when I said: "to generate xml from a hash using a xsd as a kinda template."

Again many thanks for your help.

-----Mensaje original-----
De: Mark Overmeer [mailto:mark at overmeer.net] 
Enviado el: lunes, 17 de junio de 2013 13:49
Para: JOSE RAMON GONZALEZ MARTINEZ - E434999
CC: xml-compile at lists.scsys.co.uk
Asunto: Re: [Xml-compile] XML Compile write with xsd to validate

Hi Jose,

* JOSE RAMON GONZALEZ MARTINEZ (joseramon.gonzalez at ext.mpsa.com) [130617 11:22]:
> <?xml version="1.0" encoding=" UTF-8"?>
> < application xmlns=' http://www.example.org/esquemas/application'
> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> xsi:noNamespaceSchemaLocation="variables.xsd">

This is wrong: there is a big difference between "no namespace"
and "default namespace".

>   < prdocc>XXXXX</x0:prdocc>

You probably mean
    <prdocc>XXXXX</prdocc>

It theory, it is possible to mix elements which have no (target)namespace
with elements which use the default prefix for their namespace.  So, that
is forbidden by a writte rule.  XML::Compile is automated, and can not
predict beforehand whether it will encounter elements without namespace.
Therefore, by default, it will not use a default namespace  However,
with the compile(use_default_namespace) option

You can also set the prefixes globally when you use ::Cache, not ::Schema.

I do not 100% understand your question.  Do you want to use the output
of $schema->template(XML => ) to interpolate your values into?  That is
an extremely bad idea, not supported and not kept backwards-compatible.
I hope I did not understand that correctly.
-- 
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