Handling of XMLSchema elementFormDefault and attributeFormDefault #2

Closed
bacek opened this Issue Oct 17, 2012 · 2 comments

2 participants

@bacek

According to http://www.w3.org/TR/xmlschema-0/#ref50 elementFormDefault and attributFormDefault are "unqualified". Which should put sub-elements of complexTypes into default namespace.

@bacek

~/work/DCB/W3C-SOAP (master) $ git diff
diff --git a/lib/W3C/SOAP/XSD.pm b/lib/W3C/SOAP/XSD.pm
index 2c9bd3e..d1e7375 100644
--- a/lib/W3C/SOAP/XSD.pm
+++ b/lib/W3C/SOAP/XSD.pm
@@ -171,11 +171,13 @@ sub to_xml {
my $value = ref $self->$name eq 'ARRAY' ? $self->$name : [$self->$name];

     for my $item (@$value) {
  • my $tag = $xml->createElement($xsd_ns_name . ':' . $xml_name);
  • $tag->setAttribute("xmlns:$xsd_ns_name" => $self->xsd_ns) if $self->xsd_ns;
  • my $tag = $xml->createElement($xml_name);
  • if ($item->can('xsd_ns')) {
  • $tag->setNamespace($item->xsd_ns, $item->xsd_ns_name);
  •        }
    
         if ( blessed($item) && $item->can('to_xml') ) {
    
  • $item->xsd_ns_name( $xsd_ns_name ) if !$item->has_xsd_ns_name;
  • #$item->xsd_ns_name( $xsd_ns_name ) if !$item->has_xsd_ns_name; my @children = $item->to_xml($xml); $tag->appendChild($_) for @children; }
@ivanwills
Owner

This should be fixed now (except for attributes which currently are not supported)

@ivanwills ivanwills closed this Aug 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment