Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 1 commit
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
14 lib/W3C/SOAP/Document/Node.pm
@@ -48,6 +48,15 @@ has name => (
lazy_build => 1,
);
+has namespace => (
+ is => 'rw',
+ isa => 'Maybe[Str]',
+ predicate => 'has_namespace',
+ builder => '_namespace',
+ lazy_build => 1,
+);
+
+
around BUILDARGS => sub {
my ($orig, $class, @args) = @_;
my $args
@@ -72,6 +81,11 @@ sub _name {
return $self->node->getAttribute('name');
}
+sub _namespace {
+ my ($self) = shift;
+ return $self->node->namespaceURI();
+}
+
sub perl_name {
my ($self) = @_;
my $name = $self->name;
View
11 lib/W3C/SOAP/XSD.pm
@@ -171,11 +171,16 @@ 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('xs_namespace')) {
+ # $tag->setNamespace($item->xs_namespace, $item->xsd_ns_name);
+ #}
+ if ($item->can('meta') && $item->meta->can('xs_namespace')) {
+ $tag->setNamespace($item->meta->xs_namespace, $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;
}
View
15 lib/W3C/SOAP/XSD/Document.pm
@@ -124,6 +124,13 @@ has ns_map => (
lazy_build => 1,
);
+has element_form_default => (
+ is => 'ro',
+ isa => 'Str',
+ builder => '_element_form_default',
+ lazy_build => 1,
+);
+
sub _imports {
my ($self) = @_;
my @imports;
@@ -400,6 +407,14 @@ sub get_module_base {
return $self->ns_module_map->{normalise_ns($ns)};
}
+sub _element_form_default {
+ my ($self) = @_;
+
+ #$self->xml->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema', 'elementFormDefault') // 'unqualified';
+ my ($n) = $self->xpc->findnodes('//xsd:schema/@elementFormDefault');
+ $n ? $n->value : 'unqualified';
+}
+
1;
__END__
View
10 lib/W3C/SOAP/XSD/Document/ComplexType.pm
@@ -85,10 +85,17 @@ sub _get_sequence_elements {
my $group = 1;
for my $node (@nodes) {
+ # Calculate targetNamespace for element
+ #warn $self->document->element_form_default;
+ my $namespace = $self->document->element_form_default eq 'qualified'
+ ? $self->document->target_namespace
+ : '';
+
if ( $node->nodeName =~ /:element$/ ) {
push @sequence, W3C::SOAP::XSD::Document::Element->new(
parent_node => $self,
- node => $node,
+ node => $node,
+ namespace => $namespace,
);
}
elsif ( $node->nodeName =~ /:choice$/ ) {
@@ -98,6 +105,7 @@ sub _get_sequence_elements {
parent_node => $self,
node => $choice,
choice_group => $group,
+ namespace => $namespace,
);
}
$group++;
View
5 lib/W3C/SOAP/XSD/Traits.pm
@@ -47,6 +47,11 @@ has xs_name => (
isa => 'Str',
predicate => 'has_xs_name',
);
+has xs_namespace => (
+ is => 'rw',
+ isa => 'Str',
+ predicate => 'has_xs_namespace',
+);
has xs_type => (
is => 'rw',
isa => 'Str',
View
9 templates/xsd_complex_type.pm.tt
@@ -45,8 +45,15 @@ our $VERSION = version->new('0.0.1');
has '+xsd_ns' => (
default => '[% xsd.target_namespace %]',
- required => 1,
+ is => 'ro',
);
+
+has 'xs_namespace' => (
+ lazy => 1,
+ default => '[% xsd.target_namespace %]',
+ is => 'ro',
+);
+
#has '+xsd_ns_name' => (
# default => '[% ns_name %]',
#);
View
1  templates/xsd_element.pm.tt
@@ -37,6 +37,7 @@ has [% element.perl_name %] => (
xs_perl_module => '[% element.type_module %]',
[%- END %]
xs_name => '[% element.name %]',
+ xs_namespace => '[% element.namespace %]',
xs_type => '[% element.type %]',
xs_min_occurs => '[% element.min_occurs %]',
xs_max_occurs => '[% element.max_occurs == 'unbounded' ? 0 : element.max_occurs %]',

No commit comments for this range

Something went wrong with that request. Please try again.