[Xml-compile] xsi:type namespace

Mark Overmeer mark at overmeer.net
Wed Mar 3 09:50:15 GMT 2010


* Brendan Knox (knox.brendan at gmail.com) [100303 02:22]:
> I have recently been trying to use some schema that implement xsi:type.
> Unfortunately one of the schema involved does not specify a namespace and I
> believe this is causing some issues with the xsi:type mapping.
> 
> Out of curiosity I modified XML/Compile/Translate.pm line 682 to:
> $altnode->setAttribute(type => "{$ns}$type");

This is the clue to the problem, but not the solution.
XML::Compile does not support translators for types, but only for
elements. Therefore, it generates elements.  On this spot

        my $doc     = $node->ownerDocument;
        my $altnode = $doc->createElementNS(SCHEMA2001, 'element');
        $altnode->setNamespace($ns => $prefix);
        $altnode->setAttribute(name => $name);
        $altnode->setAttribute(type => $type);

generates
   <element xmlns="http://www.w3.org/2001/XMLSchema"
      name="command" type="test_command"/>
Now, it expects "test_command" to be in the schema namespace.

I'll think of a clean solution, but first have to do some work.
-- 
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