XMLSchemas/XsdImportVisitor.pm untested

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 64 CC 2 SCAR 11.5
CC
2
Cov
0%
visitSpecification
6.0
new
2.0
BEGIN
2.0
CRAP 3.1
1
2 #
3 # Interface Definition Language (OMG IDL CORBA v3.0)
4 #
5 # CORBA to WSDL/SOAP Interworking Specification, Version 1.1 February 2005
6 #
7
8 package CORBA::XMLSchemas::XsdImportVisitor;
9
10 use strict;
11 use warnings;
12
13 our $VERSION = '2.60';
14
15 use CORBA::XMLSchemas::XsdVisitor;
16 use base qw(CORBA::XMLSchemas::XsdVisitor);
17
18 sub new {
19 my $proto = shift;
20 my $class = ref($proto) || $proto;
21 my $self = {};
22 bless $self, $class;
23 my ($parser) = @_;
24 $self->{standalone} = undef;
25 $self->{_tns} = 'tns';
26 $self->{tns} = 'tns:';
27 $self->{_xsd} = 'xs';
28 $self->{xsd} = 'xs:';
29 $self->{_corba} = 'corba';
30 $self->{corba} = 'corba:';
31 $self->{symbtab} = $parser->YYData->{symbtab};
32 $self->{root} = $parser->YYData->{root};
33 $self->{done_hash} = {};
34 $self->{num_key} = 'num_inc_xsd';
35 $self->{need_corba} = undef;
36 return $self;
37 }
38
39 sub visitSpecification {
40 my $self = shift;
41 my ($node, $dom_doc, $dom_parent) = @_;
42
43 $self->{dom_doc} = $dom_doc;
44
45 my $schema = $self->{dom_doc}->createElement($self->{xsd} . 'schema');
46 $schema->setAttribute('targetNamespace', 'http://www.omg.org/IDL-Mapped/');
47 $schema->setAttribute('xmlns:' . $self->{_xsd}, 'http://www.w3.org/2001/XMLSchema');
48 $schema->setAttribute('xmlns:' . $self->{_corba}, 'http://www.omg.org/IDL-WSDL/1.0/');
49 $schema->setAttribute('xmlns:' . $self->{_tns}, 'http://www.omg.org/IDL-Mapped/');
50 $schema->setAttribute('elementFormDefault', 'qualified');
51 $schema->setAttribute('attributeFormDefault', 'unqualified');
52 $dom_parent->appendChild($schema);
53
54 if (exists $node->{list_import}) {
55 foreach (@{$node->{list_import}}) {
56 $_->visit($self, $schema);
57 }
58 }
59 foreach (@{$node->{list_decl}}) {
60 $self->_get_defn($_)->visit($self, $schema);
61 }
62 }
63
64 1;
65