[xml-compile] namespace prefixes

Wes Young wes at ren-isac.net
Thu Sep 30 16:37:38 GMT 2010


$ perl test.pl
<iodef:IODEF-Document xmlns:iodef="urn:ietf:params:xml:ns:iodef-1.0"  
version="1.00" lang="en">
   <iodef:Incident purpose="mitigation">
     <iodef:IncidentID name="example.com"/>
     <iodef:ReportTime>1970-01-01T00:20:34Z</iodef:ReportTime>
     <iodef:Assessment>
       <iodef:Impact type="dos"/>
     </iodef:Assessment>
     <iodef:Contact role="irt" type="person">
       <iodef:ContactName>Wes Young</iodef:ContactName>
     </iodef:Contact>
   </iodef:Incident>
</iodef:IODEF-Document>

rock'n... thank you very much!

one more question, when building this sort of thing (off of xsd's), is  
it more "appropriate" to use the XML::Compile::Cache paradigm or is  
that really for when you have multiple possible schema's (or xsd's)  
you're trying to wrap?

This RFC only has a single XSD (and namespace), so it seems to work OK  
with just ::Schema... want to make sure I'm using (/understanding) it  
correctly based on your GML examples...

thanks again!

On Sep 30, 2010, at 12:25 PM, Mark Overmeer wrote:

> * Wes Young (wes at ren-isac.net) [100930 16:08]:
>> why does everything come up as "x0:"
>> $ perl test.pl
>> <x0:IODEF-Document xmlns:x0="urn:ietf:params:xml:ns:iodef-1.0"
>
> The default for XML::Compile is not to use the default empty prefix
> (option use_default_namespace)  When no namespace can be deducted
> for the namespace from the schema, it will start generating them,
> starting with 'x0'.
>
> You can set your preference with
>  $schema->compile(prefixes =>
>      [ mypref => 'urn:ietf:params:xml:ns:iodef-1.0' ]
>    , ...etc.. );
>
> or   ->new(use_default_namespace => 1)
> -- 
>               MarkOv
>
> ------------------------------------------------------------------------
>       Mark Overmeer MSc                                MARKOV  
> Solutions
>       Mark at Overmeer.net                           
> solutions at overmeer.net
> http://Mark.Overmeer.net                   http://solutions.overmeer.net
>

--
Wes
http://claimid.com/wesyoung

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20100930/6a9e233e/PGP.pgp


More information about the Xml-compile mailing list