| 1 | |||
| 2 | # | ||
| 3 | # Interface Definition Language (OMG IDL CORBA v3.0) | ||
| 4 | # | ||
| 5 | |||
| 6 | package CORBA::XMLSchemas::RelaxngImportVisitor; | ||
| 7 | |||
| 8 | use strict; | ||
| 9 | use warnings; | ||
| 10 | |||
| 11 | our $VERSION = '2.60'; | ||
| 12 | |||
| 13 | use CORBA::XMLSchemas::RelaxngVisitor; | ||
| 14 | use base qw(CORBA::XMLSchemas::RelaxngVisitor); | ||
| 15 | |||
| 16 | sub new { | ||
| 17 | my $proto = shift; | ||
| 18 | my $class = ref($proto) || $proto; | ||
| 19 | my $self = {}; | ||
| 20 | bless $self, $class; | ||
| 21 | my ($parser) = @_; | ||
| 22 | $self->{standalone} = undef; | ||
| 23 | $self->{tag_root} = q{}; | ||
| 24 | $self->{_rng} = 'rng'; | ||
| 25 | $self->{rng} = 'rng:'; | ||
| 26 | $self->{_xsd} = 'xs'; | ||
| 27 | $self->{xsd} = 'xs:'; | ||
| 28 | $self->{_corba} = 'corba'; | ||
| 29 | $self->{corba} = 'corba:'; | ||
| 30 | $self->{symbtab} = $parser->YYData->{symbtab}; | ||
| 31 | $self->{root} = $parser->YYData->{root}; | ||
| 32 | $self->{done_hash} = {}; | ||
| 33 | $self->{num_key} = 'num_inc_rng'; | ||
| 34 | $self->{need_corba} = undef; | ||
| 35 | return $self; | ||
| 36 | } | ||
| 37 | |||
| 38 | # | ||
| 39 | # 3.5 OMG IDL Specification | ||
| 40 | # | ||
| 41 | |||
| 42 | sub visitSpecification { | ||
| 43 | my $self = shift; | ||
| 44 | my ($node, $dom_doc, $dom_parent) = @_; | ||
| 45 | |||
| 46 | $self->{dom_doc} = $dom_doc; | ||
| 47 | |||
| 48 | my $grammar = $self->{dom_doc}->createElement($self->{rng} . 'grammar'); | ||
| 49 | $grammar->setAttribute('ns', 'http://www.omg.org/IDL-Mapped/'); | ||
| 50 | $grammar->setAttribute('datatypeLibrary', 'http://www.w3.org/2001/XMLSchema-datatypes'); | ||
| 51 | $grammar->setAttribute('xmlns:' . $self->{_xsd}, 'http://www.w3.org/2001/XMLSchema'); | ||
| 52 | $grammar->setAttribute('xmlns:' . $self->{_rng}, 'http://relaxng.org/ns/structure/1.0'); | ||
| 53 | $grammar->setAttribute('xmlns:' . $self->{_corba}, 'http://www.omg.org/IDL-WSDL/1.0/'); | ||
| 54 | $dom_parent->appendChild($grammar); | ||
| 55 | |||
| 56 | if (exists $node->{list_import}) { | ||
| 57 | foreach (@{$node->{list_import}}) { | ||
| 58 | $_->visit($self, $grammar); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | foreach (@{$node->{list_decl}}) { | ||
| 62 | $self->_get_defn($_)->visit($self, $grammar); | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 | 1; | ||
| 67 |