File Coverage

blib/lib/Rinchi/XMLSchema.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package Rinchi::XMLSchema;
2              
3 1     1   41916 use 5.006;
  1         5  
  1         60  
4 1     1   7 use strict;
  1         1  
  1         40  
5 1     1   5 use strict;
  1         9  
  1         38  
6 1     1   5 use Carp;
  1         2  
  1         110  
7 1     1   556 use XML::Parser;
  0            
  0            
8             #use Class::ISA;
9              
10             our @ISA = qw();
11              
12             our @EXPORT = qw();
13             our @EXPORT_OK = qw();
14              
15             our $VERSION = 0.02;
16              
17             =head1 NAME
18              
19             Rinchi::XMLSchema - Module for creating XML Schema objects from XSD files.
20              
21             =head1 SYNOPSIS
22              
23             use Rinchi::XMLSchema;
24              
25             $document = Rinchi::XMLSchema->parse($file);
26              
27             =head1 DESCRIPTION
28              
29             This module parses XML Schema files and produces Perl objects representing
30             them. There is also the capability to compare objects to see if they are the
31             same (not necessarily equal). The intent of this module is to allow the
32             comparison of various schemas to find common constructs between them. A
33             module I intend to release later will allow the production of UML from
34             schema files.
35            
36             Note: Imports and includes are not performed as at this time that would be
37             contrary to the purpose of the module.
38              
39             =head2 EXPORT
40              
41             None by default.
42              
43             =cut
44              
45             my %sax_handlers = (
46             'Init' => \&handle_init,
47             'Final' => \&handle_final,
48             'Start' => \&handle_start,
49             'End' => \&handle_end,
50             'Char' => \&handle_char,
51             'Proc' => \&handle_proc,
52             'Comment' => \&handle_comment,
53             'CdataStart' => \&handle_cdata_start,
54             'CdataEnd' => \&handle_cdata_end,
55             'Default' => \&handle_default,
56             'Unparsed' => \&handle_unparsed,
57             'Notation' => \&handle_notation,
58             'ExternEnt' => \&handle_extern_ent,
59             'ExternEntFin' => \&handle_extern_ent_fin,
60             'Entity' => \&handle_entity,
61             'Element' => \&handle_element,
62             'Attlist' => \&handle_attlist,
63             'Doctype' => \&handle_doctype,
64             'DoctypeFin' => \&handle_doctype_fin,
65             'XMLDecl' => \&handle_xml_decl,
66             );
67              
68             my %sax_start_handlers = (
69             'all' => \&handle_start_all,
70             'annotation' => \&handle_start_annotation,
71             'any' => \&handle_start_any,
72             'anyAttribute' => \&handle_start_anyAttribute,
73             'appinfo' => \&handle_start_appinfo,
74             'attribute' => \&handle_start_attribute,
75             'attributeGroup' => \&handle_start_attributeGroup,
76             'choice' => \&handle_start_choice,
77             'complexContent' => \&handle_start_complexContent,
78             'complexType' => \&handle_start_complexType,
79             'documentation' => \&handle_start_documentation,
80             'element' => \&handle_start_element,
81             'enumeration' => \&handle_start_enumeration,
82             'extension' => \&handle_start_extension,
83             'field' => \&handle_start_field,
84             'fractionDigits' => \&handle_start_fractionDigits,
85             'group' => \&handle_start_group,
86             'import' => \&handle_start_import,
87             'include' => \&handle_start_include,
88             'key' => \&handle_start_key,
89             'keyref' => \&handle_start_keyref,
90             'length' => \&handle_start_length,
91             'list' => \&handle_start_list,
92             'maxExclusive' => \&handle_start_maxExclusive,
93             'maxInclusive' => \&handle_start_maxInclusive,
94             'maxLength' => \&handle_start_maxLength,
95             'minExclusive' => \&handle_start_minExclusive,
96             'minInclusive' => \&handle_start_minInclusive,
97             'minLength' => \&handle_start_minLength,
98             'notation' => \&handle_start_notation,
99             'pattern' => \&handle_start_pattern,
100             'redefine' => \&handle_start_redefine,
101             'restriction' => \&handle_start_restriction,
102             'schema' => \&handle_start_schema,
103             'selector' => \&handle_start_selector,
104             'sequence' => \&handle_start_sequence,
105             'simpleContent' => \&handle_start_simpleContent,
106             'simpleType' => \&handle_start_simpleType,
107             'totalDigits' => \&handle_start_totalDigits,
108             'union' => \&handle_start_union,
109             'unique' => \&handle_start_unique,
110             'whiteSpace' => \&handle_start_whiteSpace,
111             );
112              
113             my %sax_end_handlers = (
114             'all' => \&handle_end_all,
115             'annotation' => \&handle_end_annotation,
116             'any' => \&handle_end_any,
117             'anyAttribute' => \&handle_end_anyAttribute,
118             'appinfo' => \&handle_end_appinfo,
119             'attribute' => \&handle_end_attribute,
120             'attributeGroup' => \&handle_end_attributeGroup,
121             'choice' => \&handle_end_choice,
122             'complexContent' => \&handle_end_complexContent,
123             'complexType' => \&handle_end_complexType,
124             'documentation' => \&handle_end_documentation,
125             'element' => \&handle_end_element,
126             'enumeration' => \&handle_end_enumeration,
127             'extension' => \&handle_end_extension,
128             'field' => \&handle_end_field,
129             'fractionDigits' => \&handle_end_fractionDigits,
130             'group' => \&handle_end_group,
131             'import' => \&handle_end_import,
132             'include' => \&handle_end_include,
133             'key' => \&handle_end_key,
134             'keyref' => \&handle_end_keyref,
135             'length' => \&handle_end_length,
136             'list' => \&handle_end_list,
137             'maxExclusive' => \&handle_end_maxExclusive,
138             'maxInclusive' => \&handle_end_maxInclusive,
139             'maxLength' => \&handle_end_maxLength,
140             'minExclusive' => \&handle_end_minExclusive,
141             'minInclusive' => \&handle_end_minInclusive,
142             'minLength' => \&handle_end_minLength,
143             'notation' => \&handle_end_notation,
144             'pattern' => \&handle_end_pattern,
145             'redefine' => \&handle_end_redefine,
146             'restriction' => \&handle_end_restriction,
147             'schema' => \&handle_end_schema,
148             'selector' => \&handle_end_selector,
149             'sequence' => \&handle_end_sequence,
150             'simpleContent' => \&handle_end_simpleContent,
151             'simpleType' => \&handle_end_simpleType,
152             'totalDigits' => \&handle_end_totalDigits,
153             'union' => \&handle_end_union,
154             'unique' => \&handle_end_unique,
155             'whiteSpace' => \&handle_end_whiteSpace,
156             );
157              
158             my %namespaces;
159             my %namespace_prefixes;
160             my @elem_stack;
161             my @namespace_stack;
162              
163             my $Document;
164              
165             my $schema_namespace='http://www.w3.org/2001/XMLSchema';
166              
167             #===============================================================================
168              
169             =item $Object = Rinchi::XMLSchema::?Class?->new();
170              
171             Create an object of the appropriate class, based on the local name of the element
172             being represented.
173              
174             Local Name Class;
175             all Rinchi::XMLSchema::All;
176             annotation Rinchi::XMLSchema::Annotation;
177             any Rinchi::XMLSchema::Any;
178             anyAttribute Rinchi::XMLSchema::AnyAttribute;
179             appinfo Rinchi::XMLSchema::Appinfo;
180             attribute Rinchi::XMLSchema::Attribute;
181             attributeGroup Rinchi::XMLSchema::AttributeGroup;
182             choice Rinchi::XMLSchema::Choice;
183             complexContent Rinchi::XMLSchema::ComplexContent;
184             complexType Rinchi::XMLSchema::ComplexType;
185             documentation Rinchi::XMLSchema::Documentation;
186             element Rinchi::XMLSchema::Element;
187             enumeration Rinchi::XMLSchema::Enumeration;
188             extension Rinchi::XMLSchema::Extension;
189             field Rinchi::XMLSchema::Field;
190             fractionDigits Rinchi::XMLSchema::FractionDigits;
191             group Rinchi::XMLSchema::Group;
192             import Rinchi::XMLSchema::Import;
193             include Rinchi::XMLSchema::Include;
194             key Rinchi::XMLSchema::Key;
195             keyref Rinchi::XMLSchema::Keyref;
196             length Rinchi::XMLSchema::Length;
197             list Rinchi::XMLSchema::List;
198             maxExclusive Rinchi::XMLSchema::MaxExclusive;
199             maxInclusive Rinchi::XMLSchema::MaxInclusive;
200             maxLength Rinchi::XMLSchema::MaxLength;
201             minExclusive Rinchi::XMLSchema::MinExclusive;
202             minInclusive Rinchi::XMLSchema::MinInclusive;
203             minLength Rinchi::XMLSchema::MinLength;
204             notation Rinchi::XMLSchema::Notation;
205             pattern Rinchi::XMLSchema::Pattern;
206             redefine Rinchi::XMLSchema::Redefine;
207             restriction Rinchi::XMLSchema::Restriction;
208             schema Rinchi::XMLSchema::Schema;
209             selector Rinchi::XMLSchema::Selector;
210             sequence Rinchi::XMLSchema::Sequence;
211             simpleContent Rinchi::XMLSchema::SimpleContent;
212             simpleType Rinchi::XMLSchema::SimpleType;
213             totalDigits Rinchi::XMLSchema::TotalDigits;
214             union Rinchi::XMLSchema::Union;
215             unique Rinchi::XMLSchema::Unique;
216             whiteSpace Rinchi::XMLSchema::WhiteSpace;
217              
218             =cut
219              
220             sub new() {
221             my $class = shift;
222             $class = ref($class) || $class;
223             my $self = {};
224             bless($self,$class);
225             $self->{'_content_'} = [];
226             return $self;
227             }
228              
229             #=================================================================
230              
231             =item $Document = Rinchi::XMLSchema->parsefile($path);
232              
233             Calls XML::Parser->parsefile with the given path and the Rinchi::XMLSchema
234             handlers. Objects are created for the namespaces with available handlers,
235             arrays with the tags and attributes. A tree of the objects and arrays is
236             returned, with children accessible as @{$Object->{'_content_'}}.
237              
238             Open FILE for reading, then call parse with the open handle. The
239             file is closed no matter how parse returns. Returns what parse
240             returns.
241              
242             =cut
243              
244             sub parsefile($) {
245             my $self = shift @_;
246             my $source = shift @_;
247              
248             my $Parser = new XML::Parser('Handlers' => \%sax_handlers);
249             $Parser->parsefile($source);
250             return $Document;
251             }
252              
253             #=================================================================
254              
255             =item $nsdef = Rinchi::XMLSchema->namespace_def();
256              
257             Returns a hash reference containing the following key-value pairs:
258              
259             Start Hash reference to SAX Start event handlers
260             End Hash reference to SAX End event handlers
261             Namespace Namespace URI
262              
263             =cut
264              
265             sub namespace_def() {
266             my $self = shift @_;
267            
268             return {'Start'=>\%sax_start_handlers,'End'=>\%sax_end_handlers, 'Namespace'=>$schema_namespace};
269             }
270              
271             #=================================================================
272              
273             =item $Document = Rinchi::XMLSchema->add_namespace($nsdef);
274              
275             Adds the namespace and handlers to the list of routines called by
276             the parser to create objects of the specified classes. For example:
277              
278             use Rinchi::XMLSchema::HFP;
279             my $nsdef = Rinchi::HFP->namespace_def();
280             $nsdef->{'Prefix'} = 'hfp';
281             Rinchi::XMLSchema->add_namespace($nsdef);
282             my $Document = Rinchi::XMLSchema->parsefile('datatypes.xsd');
283              
284             This will cause Rinchi::HFP subclassed objects from the namespace
285             'http://www.w3.org/2001/XMLSchema-hasFacetAndProperty' to be created
286             as well as those from the XMLSchema namespace.
287            
288              
289             =cut
290              
291             sub add_namespace($) {
292             my $self = shift @_;
293             my $nsdef = shift @_;
294            
295             my $namespace = $nsdef->{'Namespace'};
296             my $prefix = $nsdef->{'Prefix'};
297             # print "add_namespace $prefix $namespace\n";
298             $namespaces{$namespace} = $nsdef;
299             push @{$namespace_prefixes{$prefix}},$namespace;
300             }
301              
302             #=================================================================
303              
304             sub check_xmlns($) {
305             my $attrs = shift @_;
306             my $prefix;
307              
308             foreach my $attr (keys %{$attrs}) {
309             if ($attr =~/^xmlns:([A-Za-z][0-9A-Za-z_]*)$/) {
310             my $p = $1;
311             # print "$attr $p $attrs->{$attr} $schema_namespace\n";
312             if($attrs->{$attr} eq $schema_namespace) {
313             $prefix = $p;
314             }
315             }
316             }
317              
318             $prefix = 'xs' unless(defined($prefix));
319            
320             if(defined($prefix)) {
321             my $nsdef={'Start'=>\%sax_start_handlers,'End'=>\%sax_end_handlers,'Prefix'=>$prefix,'Namespace'=>$schema_namespace};
322             Rinchi::XMLSchema->add_namespace($nsdef);
323             push @namespace_stack,$nsdef;
324             }
325              
326             }
327             #=================================================================
328              
329             # Init (Expat)
330             sub handle_init() {
331             my ($expat) = @_;
332             }
333              
334             #=================================================================
335              
336             # Final (Expat)
337             sub handle_final() {
338             my ($expat) = @_;
339             }
340              
341             #=================================================================
342              
343             # Start (Expat, Tag [, Attr, Val [,...]])
344             sub handle_start() {
345             my ($expat, $tag, %attrs) = @_;
346              
347             check_xmlns(\%attrs) unless (@elem_stack);
348             my $prefix;
349             my $local;
350            
351             if ($tag =~ /^([A-Za-z]+):([A-Za-z]+)$/) {
352             $prefix = $1;
353             $local = $2;
354             } else {
355             $local = $tag;
356             }
357              
358             # print "$prefix $local\n";
359             my $Element;
360             if (defined($prefix)) {
361             if(exists($namespace_prefixes{$prefix})) {
362             my $namespace = $namespace_prefixes{$prefix}[-1];
363             # print "$prefix $local $namespace\n";
364             }
365             if(exists($namespace_prefixes{$prefix})
366             and defined($namespace_prefixes{$prefix}->[0])
367             and exists($namespaces{$namespace_prefixes{$prefix}->[-1]})
368             and exists($namespaces{$namespace_prefixes{$prefix}->[-1]}->{'Start'})
369             and exists($namespaces{$namespace_prefixes{$prefix}->[-1]}->{'Start'}{$local})
370             ) {
371             $Element = $namespaces{$namespace_prefixes{$prefix}->[-1]}->{'Start'}{$local}(@_);
372             }
373             } elsif(@namespace_stack
374             and exists($namespace_stack[-1]->{'Start'})
375             and exists($namespace_stack[-1]->{'Start'}{$local})
376             ) {
377             $Element = $namespace_stack[-1]->{'Start'}{$local}(@_);
378             }
379             unless(defined($Element)) {
380             $Element = {'_tag' => $tag, };
381              
382             foreach my $attr (keys %attrs) {
383             $Element->{$attr} = $attrs{$attr};
384             }
385              
386             }
387             push @{$elem_stack[-1]->{'_content_'}}, $Element if(@elem_stack);
388             push @elem_stack,$Element;
389             }
390              
391             #=================================================================
392              
393             # End (Expat, Tag)
394             sub handle_end() {
395             my ($expat, $tag) = @_;
396             my $prefix;
397             my $local;
398            
399             if ($tag =~ /^([A-Za-z]+):([A-Za-z]+)$/) {
400             $prefix = $1;
401             $local = $2;
402             } else {
403             $local = $tag;
404             }
405              
406             my $Element;
407             if (defined($prefix)) {
408             if(exists($namespace_prefixes{$prefix})
409             and defined($namespace_prefixes{$prefix}->[0])
410             and exists($namespaces{$namespace_prefixes{$prefix}->[-1]})
411             and exists($namespaces{$namespace_prefixes{$prefix}->[-1]}->{'End'})
412             and exists($namespaces{$namespace_prefixes{$prefix}->[-1]}->{'End'}{$local})
413             ) {
414             $namespaces{$namespace_prefixes{$prefix}->[-1]}->{'End'}{$local}(@_,$elem_stack[-1]);
415             }
416             } elsif(@namespace_stack
417             and exists($namespace_stack[-1]->{'End'})
418             and exists($namespace_stack[-1]->{'End'}{$local})
419             ) {
420             $namespace_stack[-1]->{'End'}{$local}(@_,$elem_stack[-1]);
421             }
422             $Document = pop @elem_stack;
423             }
424              
425             #=================================================================
426              
427             # Char (Expat, String)
428             sub handle_char() {
429             my ($expat, $string) = @_;
430             $elem_stack[-1]->{'_text'} .= $string unless (ref($elem_stack[-1]) =~ /^Rinchi::XMLSchema/);
431             }
432              
433             #=================================================================
434              
435             # Proc (Expat, Target, Data)
436             sub handle_proc() {
437             my ($expat, $target, $data) = @_;
438             }
439              
440             #=================================================================
441              
442             # Comment (Expat, Data)
443             sub handle_comment() {
444             my ($expat, $data) = @_;
445             }
446              
447             #=================================================================
448              
449             # CdataStart (Expat)
450             sub handle_cdata_start() {
451             my ($expat) = @_;
452             }
453              
454             #=================================================================
455              
456             # CdataEnd (Expat)
457             sub handle_cdata_end() {
458             my ($expat) = @_;
459             }
460              
461             #=================================================================
462              
463             # Default (Expat, String)
464             sub handle_default() {
465             my ($expat, $string) = @_;
466             }
467              
468             #=================================================================
469              
470             # Unparsed (Expat, Entity, Base, Sysid, Pubid, Notation)
471             sub handle_unparsed() {
472             my ($expat, $entity, $base, $sysid, $pubid, $notation) = @_;
473             }
474              
475             #=================================================================
476              
477             # Notation (Expat, Notation, Base, Sysid, Pubid)
478             sub handle_notation() {
479             my ($expat, $notation, $base, $sysid, $pubid) = @_;
480             }
481              
482             #=================================================================
483              
484             # ExternEnt (Expat, Base, Sysid, Pubid)
485             sub handle_extern_ent() {
486             my ($expat, $base, $sysid, $pubid) = @_;
487             }
488              
489             #=================================================================
490              
491             # ExternEntFin (Expat)
492             sub handle_extern_ent_fin() {
493             my ($expat) = @_;
494             }
495              
496             #=================================================================
497              
498             # Entity (Expat, Name, Val, Sysid, Pubid, Ndata, IsParam)
499             sub handle_entity() {
500             my ($expat, $name, $val, $sysid, $pubid, $ndata, $isParam) = @_;
501             }
502              
503             #=================================================================
504              
505             # Element (Expat, Name, Model)
506             sub handle_element() {
507             my ($expat, $name, $model) = @_;
508             }
509              
510             #=================================================================
511              
512             # Attlist (Expat, Elname, Attname, Type, Default, Fixed)
513             sub handle_attlist() {
514             my ($expat, $elname, $attname, $type, $default, $fixed) = @_;
515             }
516              
517             #=================================================================
518              
519             # Doctype (Expat, Name, Sysid, Pubid, Internal)
520             sub handle_doctype() {
521             my ($expat, $name, $sysid, $pubid, $internal) = @_;
522             }
523              
524             #=================================================================
525              
526             # DoctypeFin (Expat)
527             sub handle_doctype_fin() {
528             my ($expat) = @_;
529             }
530              
531             #=================================================================
532              
533             # XMLDecl (Expat, Version, Encoding, Standalone)
534             sub handle_xml_decl() {
535             my ($expat, $version, $encoding, $standalone) = @_;
536             }
537              
538             #===============================================================================
539              
540             sub handle_start_all() {
541             my ($expat,$tag,%attrs) = @_;
542             my $All = Rinchi::XMLSchema::All->new();
543              
544             if (exists($attrs{'id'})) {
545             $All->id($attrs{'id'});
546             }
547              
548             if (exists($attrs{'maxOccurs'})) {
549             $All->maxOccurs($attrs{'maxOccurs'});
550             }
551              
552             if (exists($attrs{'minOccurs'})) {
553             $All->minOccurs($attrs{'minOccurs'});
554             }
555              
556             return $All;
557             }
558              
559             #===============================================================================
560              
561             sub handle_end_all() {
562             my ($expat,$tag,$All) = @_;
563             }
564              
565             #===============================================================================
566              
567             sub handle_start_annotation() {
568             my ($expat,$tag,%attrs) = @_;
569             my $Annotation = Rinchi::XMLSchema::Annotation->new();
570              
571             return $Annotation;
572             }
573              
574             #===============================================================================
575              
576             sub handle_end_annotation() {
577             my ($expat,$tag,$Annotation) = @_;
578             }
579              
580             #===============================================================================
581              
582             sub handle_start_any() {
583             my ($expat,$tag,%attrs) = @_;
584             my $Any = Rinchi::XMLSchema::Any->new();
585              
586             if (exists($attrs{'id'})) {
587             $Any->id($attrs{'id'});
588             }
589              
590             if (exists($attrs{'maxOccurs'})) {
591             $Any->maxOccurs($attrs{'maxOccurs'});
592             }
593              
594             if (exists($attrs{'minOccurs'})) {
595             $Any->minOccurs($attrs{'minOccurs'});
596             }
597              
598             if (exists($attrs{'namespace'})) {
599             $Any->namespace($attrs{'namespace'});
600             }
601              
602             if (exists($attrs{'processContents'})) {
603             $Any->processContents($attrs{'processContents'});
604             }
605              
606             return $Any;
607             }
608              
609             #===============================================================================
610              
611             sub handle_end_any() {
612             my ($expat,$tag,$Any) = @_;
613             }
614              
615             #===============================================================================
616              
617             sub handle_start_anyAttribute() {
618             my ($expat,$tag,%attrs) = @_;
619             my $AnyAttribute = Rinchi::XMLSchema::AnyAttribute->new();
620              
621             if (exists($attrs{'id'})) {
622             $AnyAttribute->id($attrs{'id'});
623             }
624              
625             if (exists($attrs{'namespace'})) {
626             $AnyAttribute->namespace($attrs{'namespace'});
627             }
628              
629             if (exists($attrs{'processContents'})) {
630             $AnyAttribute->processContents($attrs{'processContents'});
631             }
632              
633             return $AnyAttribute;
634             }
635              
636             #===============================================================================
637              
638             sub handle_end_anyAttribute() {
639             my ($expat,$tag,$AnyAttribute) = @_;
640             }
641              
642             #===============================================================================
643              
644             sub handle_start_appinfo() {
645             my ($expat,$tag,%attrs) = @_;
646             my $Appinfo = Rinchi::XMLSchema::Appinfo->new();
647              
648             if (exists($attrs{'id'})) {
649             $Appinfo->id($attrs{'id'});
650             }
651              
652             if (exists($attrs{'source'})) {
653             $Appinfo->source($attrs{'source'});
654             }
655              
656             return $Appinfo;
657             }
658              
659             #===============================================================================
660              
661             sub handle_end_appinfo() {
662             my ($expat,$tag,$Appinfo) = @_;
663             }
664              
665             #===============================================================================
666              
667             sub handle_start_attribute() {
668             my ($expat,$tag,%attrs) = @_;
669             my $Attribute = Rinchi::XMLSchema::Attribute->new();
670              
671             if (exists($attrs{'default'})) {
672             $Attribute->default($attrs{'default'});
673             }
674              
675             if (exists($attrs{'fixed'})) {
676             $Attribute->fixed($attrs{'fixed'});
677             }
678              
679             if (exists($attrs{'form'})) {
680             $Attribute->form($attrs{'form'});
681             }
682              
683             if (exists($attrs{'id'})) {
684             $Attribute->id($attrs{'id'});
685             }
686              
687             if (exists($attrs{'name'})) {
688             $Attribute->name($attrs{'name'});
689             }
690              
691             if (exists($attrs{'ref'})) {
692             $Attribute->ref($attrs{'ref'});
693             }
694              
695             if (exists($attrs{'type'})) {
696             $Attribute->type($attrs{'type'});
697             }
698              
699             if (exists($attrs{'use'})) {
700             $Attribute->use($attrs{'use'});
701             }
702              
703             return $Attribute;
704             }
705              
706             #===============================================================================
707              
708             sub handle_end_attribute() {
709             my ($expat,$tag,$Attribute) = @_;
710             }
711              
712             #===============================================================================
713              
714             sub handle_start_attributeGroup() {
715             my ($expat,$tag,%attrs) = @_;
716             my $AttributeGroup = Rinchi::XMLSchema::AttributeGroup->new();
717              
718             if (exists($attrs{'id'})) {
719             $AttributeGroup->id($attrs{'id'});
720             }
721              
722             if (exists($attrs{'name'})) {
723             $AttributeGroup->name($attrs{'name'});
724             }
725              
726             if (exists($attrs{'ref'})) {
727             $AttributeGroup->ref($attrs{'ref'});
728             }
729              
730             return $AttributeGroup;
731             }
732              
733             #===============================================================================
734              
735             sub handle_end_attributeGroup() {
736             my ($expat,$tag,$AttributeGroup) = @_;
737             }
738              
739             #===============================================================================
740              
741             sub handle_start_choice() {
742             my ($expat,$tag,%attrs) = @_;
743             my $Choice = Rinchi::XMLSchema::Choice->new();
744              
745             if (exists($attrs{'id'})) {
746             $Choice->id($attrs{'id'});
747             }
748              
749             if (exists($attrs{'maxOccurs'})) {
750             $Choice->maxOccurs($attrs{'maxOccurs'});
751             }
752              
753             if (exists($attrs{'minOccurs'})) {
754             $Choice->minOccurs($attrs{'minOccurs'});
755             }
756              
757             return $Choice;
758             }
759              
760             #===============================================================================
761              
762             sub handle_end_choice() {
763             my ($expat,$tag,$Choice) = @_;
764             }
765              
766             #===============================================================================
767              
768             sub handle_start_complexContent() {
769             my ($expat,$tag,%attrs) = @_;
770             my $ComplexContent = Rinchi::XMLSchema::ComplexContent->new();
771              
772             if (exists($attrs{'id'})) {
773             $ComplexContent->id($attrs{'id'});
774             }
775              
776             if (exists($attrs{'mixed'})) {
777             $ComplexContent->mixed($attrs{'mixed'});
778             }
779              
780             return $ComplexContent;
781             }
782              
783             #===============================================================================
784              
785             sub handle_end_complexContent() {
786             my ($expat,$tag,$ComplexContent) = @_;
787             }
788              
789             #===============================================================================
790              
791             sub handle_start_complexType() {
792             my ($expat,$tag,%attrs) = @_;
793             my $ComplexType = Rinchi::XMLSchema::ComplexType->new();
794              
795             if (exists($attrs{'abstract'})) {
796             $ComplexType->abstract($attrs{'abstract'});
797             }
798              
799             if (exists($attrs{'block'})) {
800             $ComplexType->block($attrs{'block'});
801             }
802              
803             if (exists($attrs{'final'})) {
804             $ComplexType->final($attrs{'final'});
805             }
806              
807             if (exists($attrs{'id'})) {
808             $ComplexType->id($attrs{'id'});
809             }
810              
811             if (exists($attrs{'mixed'})) {
812             $ComplexType->mixed($attrs{'mixed'});
813             }
814              
815             if (exists($attrs{'name'})) {
816             $ComplexType->name($attrs{'name'});
817             }
818              
819             return $ComplexType;
820             }
821              
822             #===============================================================================
823              
824             sub handle_end_complexType() {
825             my ($expat,$tag,$ComplexType) = @_;
826             }
827              
828             #===============================================================================
829              
830             sub handle_start_documentation() {
831             my ($expat,$tag,%attrs) = @_;
832             my $Documentation = Rinchi::XMLSchema::Documentation->new();
833              
834             if (exists($attrs{'id'})) {
835             $Documentation->id($attrs{'id'});
836             }
837              
838             if (exists($attrs{'source'})) {
839             $Documentation->source($attrs{'source'});
840             }
841              
842             if (exists($attrs{'xml:lang'})) {
843             $Documentation->xml_lang($attrs{'xml:lang'});
844             }
845              
846             return $Documentation;
847             }
848              
849             #===============================================================================
850              
851             sub handle_end_documentation() {
852             my ($expat,$tag,$Documentation) = @_;
853             # my $Documentation = $elem_stack[-1];
854             }
855              
856             #===============================================================================
857              
858             sub handle_start_element() {
859             my ($expat,$tag,%attrs) = @_;
860             my $Element = Rinchi::XMLSchema::Element->new();
861              
862             if (exists($attrs{'abstract'})) {
863             $Element->abstract($attrs{'abstract'});
864             }
865              
866             if (exists($attrs{'block'})) {
867             $Element->block($attrs{'block'});
868             }
869              
870             if (exists($attrs{'default'})) {
871             $Element->default($attrs{'default'});
872             }
873              
874             if (exists($attrs{'final'})) {
875             $Element->final($attrs{'final'});
876             }
877              
878             if (exists($attrs{'fixed'})) {
879             $Element->fixed($attrs{'fixed'});
880             }
881              
882             if (exists($attrs{'form'})) {
883             $Element->form($attrs{'form'});
884             }
885              
886             if (exists($attrs{'id'})) {
887             $Element->id($attrs{'id'});
888             }
889              
890             if (exists($attrs{'maxOccurs'})) {
891             $Element->maxOccurs($attrs{'maxOccurs'});
892             }
893              
894             if (exists($attrs{'minOccurs'})) {
895             $Element->minOccurs($attrs{'minOccurs'});
896             }
897              
898             if (exists($attrs{'name'})) {
899             $Element->name($attrs{'name'});
900             }
901              
902             if (exists($attrs{'nillable'})) {
903             $Element->nillable($attrs{'nillable'});
904             }
905              
906             if (exists($attrs{'ref'})) {
907             $Element->ref($attrs{'ref'});
908             }
909              
910             if (exists($attrs{'substitutionGroup'})) {
911             $Element->substitutionGroup($attrs{'substitutionGroup'});
912             }
913              
914             if (exists($attrs{'type'})) {
915             $Element->type($attrs{'type'});
916             }
917              
918             return $Element;
919             }
920              
921             #===============================================================================
922              
923             sub handle_end_element() {
924             my ($expat,$tag,$Element) = @_;
925             }
926              
927             #===============================================================================
928              
929             sub handle_start_enumeration() {
930             my ($expat,$tag,%attrs) = @_;
931             my $Enumeration = Rinchi::XMLSchema::Enumeration->new();
932              
933             if (exists($attrs{'id'})) {
934             $Enumeration->id($attrs{'id'});
935             }
936              
937             if (exists($attrs{'value'})) {
938             $Enumeration->value($attrs{'value'});
939             }
940              
941             return $Enumeration;
942             }
943              
944             #===============================================================================
945              
946             sub handle_end_enumeration() {
947             my ($expat,$tag,$Enumeration) = @_;
948             }
949              
950             #===============================================================================
951              
952             sub handle_start_extension() {
953             my ($expat,$tag,%attrs) = @_;
954             my $Extension = Rinchi::XMLSchema::Extension->new();
955              
956             if (exists($attrs{'base'})) {
957             $Extension->base($attrs{'base'});
958             }
959              
960             if (exists($attrs{'id'})) {
961             $Extension->id($attrs{'id'});
962             }
963              
964             return $Extension;
965             }
966              
967             #===============================================================================
968              
969             sub handle_end_extension() {
970             my ($expat,$tag,$Extension) = @_;
971             }
972              
973             #===============================================================================
974              
975             sub handle_start_field() {
976             my ($expat,$tag,%attrs) = @_;
977             my $Field = Rinchi::XMLSchema::Field->new();
978              
979             if (exists($attrs{'id'})) {
980             $Field->id($attrs{'id'});
981             }
982              
983             if (exists($attrs{'xpath'})) {
984             $Field->xpath($attrs{'xpath'});
985             }
986              
987             return $Field;
988             }
989              
990             #===============================================================================
991              
992             sub handle_end_field() {
993             my ($expat,$tag,$Field) = @_;
994             }
995              
996             #===============================================================================
997              
998             sub handle_start_fractionDigits() {
999             my ($expat,$tag,%attrs) = @_;
1000             my $FractionDigits = Rinchi::XMLSchema::FractionDigits->new();
1001              
1002             if (exists($attrs{'fixed'})) {
1003             $FractionDigits->fixed($attrs{'fixed'});
1004             }
1005              
1006             if (exists($attrs{'id'})) {
1007             $FractionDigits->id($attrs{'id'});
1008             }
1009              
1010             if (exists($attrs{'value'})) {
1011             $FractionDigits->value($attrs{'value'});
1012             }
1013              
1014             return $FractionDigits;
1015             }
1016              
1017             #===============================================================================
1018              
1019             sub handle_end_fractionDigits() {
1020             my ($expat,$tag,$FractionDigits) = @_;
1021             }
1022              
1023             #===============================================================================
1024              
1025             sub handle_start_group() {
1026             my ($expat,$tag,%attrs) = @_;
1027             my $Group = Rinchi::XMLSchema::Group->new();
1028              
1029             if (exists($attrs{'id'})) {
1030             $Group->id($attrs{'id'});
1031             }
1032              
1033             if (exists($attrs{'maxOccurs'})) {
1034             $Group->maxOccurs($attrs{'maxOccurs'});
1035             }
1036              
1037             if (exists($attrs{'minOccurs'})) {
1038             $Group->minOccurs($attrs{'minOccurs'});
1039             }
1040              
1041             if (exists($attrs{'name'})) {
1042             $Group->name($attrs{'name'});
1043             }
1044              
1045             if (exists($attrs{'ref'})) {
1046             $Group->ref($attrs{'ref'});
1047             }
1048              
1049             return $Group;
1050             }
1051              
1052             #===============================================================================
1053              
1054             sub handle_end_group() {
1055             my ($expat,$tag,$Group) = @_;
1056             }
1057              
1058             #===============================================================================
1059              
1060             sub handle_start_import() {
1061             my ($expat,$tag,%attrs) = @_;
1062             my $Import = Rinchi::XMLSchema::Import->new();
1063              
1064             if (exists($attrs{'id'})) {
1065             $Import->id($attrs{'id'});
1066             }
1067              
1068             if (exists($attrs{'namespace'})) {
1069             $Import->namespace($attrs{'namespace'});
1070             }
1071              
1072             if (exists($attrs{'schemaLocation'})) {
1073             $Import->schemaLocation($attrs{'schemaLocation'});
1074             }
1075              
1076             return $Import;
1077             }
1078              
1079             #===============================================================================
1080              
1081             sub handle_end_import() {
1082             my ($expat,$tag,$Import) = @_;
1083             }
1084              
1085             #===============================================================================
1086              
1087             sub handle_start_include() {
1088             my ($expat,$tag,%attrs) = @_;
1089             my $Include = Rinchi::XMLSchema::Include->new();
1090              
1091             if (exists($attrs{'id'})) {
1092             $Include->id($attrs{'id'});
1093             }
1094              
1095             if (exists($attrs{'schemaLocation'})) {
1096             $Include->schemaLocation($attrs{'schemaLocation'});
1097             }
1098              
1099             return $Include;
1100             }
1101              
1102             #===============================================================================
1103              
1104             sub handle_end_include() {
1105             my ($expat,$tag,$Include) = @_;
1106             }
1107              
1108             #===============================================================================
1109              
1110             sub handle_start_key() {
1111             my ($expat,$tag,%attrs) = @_;
1112             my $Key = Rinchi::XMLSchema::Key->new();
1113              
1114             if (exists($attrs{'id'})) {
1115             $Key->id($attrs{'id'});
1116             }
1117              
1118             if (exists($attrs{'name'})) {
1119             $Key->name($attrs{'name'});
1120             }
1121              
1122             return $Key;
1123             }
1124              
1125             #===============================================================================
1126              
1127             sub handle_end_key() {
1128             my ($expat,$tag,$Key) = @_;
1129             }
1130              
1131             #===============================================================================
1132              
1133             sub handle_start_keyref() {
1134             my ($expat,$tag,%attrs) = @_;
1135             my $Keyref = Rinchi::XMLSchema::Keyref->new();
1136              
1137             if (exists($attrs{'id'})) {
1138             $Keyref->id($attrs{'id'});
1139             }
1140              
1141             if (exists($attrs{'name'})) {
1142             $Keyref->name($attrs{'name'});
1143             }
1144              
1145             if (exists($attrs{'refer'})) {
1146             $Keyref->refer($attrs{'refer'});
1147             }
1148              
1149             return $Keyref;
1150             }
1151              
1152             #===============================================================================
1153              
1154             sub handle_end_keyref() {
1155             my ($expat,$tag,$Keyref) = @_;
1156             }
1157              
1158             #===============================================================================
1159              
1160             sub handle_start_length() {
1161             my ($expat,$tag,%attrs) = @_;
1162             my $Length = Rinchi::XMLSchema::Length->new();
1163              
1164             if (exists($attrs{'fixed'})) {
1165             $Length->fixed($attrs{'fixed'});
1166             }
1167              
1168             if (exists($attrs{'id'})) {
1169             $Length->id($attrs{'id'});
1170             }
1171              
1172             if (exists($attrs{'value'})) {
1173             $Length->value($attrs{'value'});
1174             }
1175              
1176             return $Length;
1177             }
1178              
1179             #===============================================================================
1180              
1181             sub handle_end_length() {
1182             my ($expat,$tag,$Length) = @_;
1183             }
1184              
1185             #===============================================================================
1186              
1187             sub handle_start_list() {
1188             my ($expat,$tag,%attrs) = @_;
1189             my $List = Rinchi::XMLSchema::List->new();
1190              
1191             if (exists($attrs{'id'})) {
1192             $List->id($attrs{'id'});
1193             }
1194              
1195             if (exists($attrs{'itemType'})) {
1196             $List->itemType($attrs{'itemType'});
1197             }
1198              
1199             return $List;
1200             }
1201              
1202             #===============================================================================
1203              
1204             sub handle_end_list() {
1205             my ($expat,$tag,$List) = @_;
1206             }
1207              
1208             #===============================================================================
1209              
1210             sub handle_start_maxExclusive() {
1211             my ($expat,$tag,%attrs) = @_;
1212             my $MaxExclusive = Rinchi::XMLSchema::MaxExclusive->new();
1213              
1214             if (exists($attrs{'fixed'})) {
1215             $MaxExclusive->fixed($attrs{'fixed'});
1216             }
1217              
1218             if (exists($attrs{'id'})) {
1219             $MaxExclusive->id($attrs{'id'});
1220             }
1221              
1222             if (exists($attrs{'value'})) {
1223             $MaxExclusive->value($attrs{'value'});
1224             }
1225              
1226             return $MaxExclusive;
1227             }
1228              
1229             #===============================================================================
1230              
1231             sub handle_end_maxExclusive() {
1232             my ($expat,$tag,$MaxExclusive) = @_;
1233             }
1234              
1235             #===============================================================================
1236              
1237             sub handle_start_maxInclusive() {
1238             my ($expat,$tag,%attrs) = @_;
1239             my $MaxInclusive = Rinchi::XMLSchema::MaxInclusive->new();
1240              
1241             if (exists($attrs{'fixed'})) {
1242             $MaxInclusive->fixed($attrs{'fixed'});
1243             }
1244              
1245             if (exists($attrs{'id'})) {
1246             $MaxInclusive->id($attrs{'id'});
1247             }
1248              
1249             if (exists($attrs{'value'})) {
1250             $MaxInclusive->value($attrs{'value'});
1251             }
1252              
1253             return $MaxInclusive;
1254             }
1255              
1256             #===============================================================================
1257              
1258             sub handle_end_maxInclusive() {
1259             my ($expat,$tag,$MaxInclusive) = @_;
1260             }
1261              
1262             #===============================================================================
1263              
1264             sub handle_start_maxLength() {
1265             my ($expat,$tag,%attrs) = @_;
1266             my $MaxLength = Rinchi::XMLSchema::MaxLength->new();
1267              
1268             if (exists($attrs{'fixed'})) {
1269             $MaxLength->fixed($attrs{'fixed'});
1270             }
1271              
1272             if (exists($attrs{'id'})) {
1273             $MaxLength->id($attrs{'id'});
1274             }
1275              
1276             if (exists($attrs{'value'})) {
1277             $MaxLength->value($attrs{'value'});
1278             }
1279              
1280             return $MaxLength;
1281             }
1282              
1283             #===============================================================================
1284              
1285             sub handle_end_maxLength() {
1286             my ($expat,$tag,$MaxLength) = @_;
1287             }
1288              
1289             #===============================================================================
1290              
1291             sub handle_start_minExclusive() {
1292             my ($expat,$tag,%attrs) = @_;
1293             my $MinExclusive = Rinchi::XMLSchema::MinExclusive->new();
1294              
1295             if (exists($attrs{'fixed'})) {
1296             $MinExclusive->fixed($attrs{'fixed'});
1297             }
1298              
1299             if (exists($attrs{'id'})) {
1300             $MinExclusive->id($attrs{'id'});
1301             }
1302              
1303             if (exists($attrs{'value'})) {
1304             $MinExclusive->value($attrs{'value'});
1305             }
1306              
1307             return $MinExclusive;
1308             }
1309              
1310             #===============================================================================
1311              
1312             sub handle_end_minExclusive() {
1313             my ($expat,$tag,$MinExclusive) = @_;
1314             }
1315              
1316             #===============================================================================
1317              
1318             sub handle_start_minInclusive() {
1319             my ($expat,$tag,%attrs) = @_;
1320             my $MinInclusive = Rinchi::XMLSchema::MinInclusive->new();
1321              
1322             if (exists($attrs{'fixed'})) {
1323             $MinInclusive->fixed($attrs{'fixed'});
1324             }
1325              
1326             if (exists($attrs{'id'})) {
1327             $MinInclusive->id($attrs{'id'});
1328             }
1329              
1330             if (exists($attrs{'value'})) {
1331             $MinInclusive->value($attrs{'value'});
1332             }
1333              
1334             return $MinInclusive;
1335             }
1336              
1337             #===============================================================================
1338              
1339             sub handle_end_minInclusive() {
1340             my ($expat,$tag,$MinInclusive) = @_;
1341             }
1342              
1343             #===============================================================================
1344              
1345             sub handle_start_minLength() {
1346             my ($expat,$tag,%attrs) = @_;
1347             my $MinLength = Rinchi::XMLSchema::MinLength->new();
1348              
1349             if (exists($attrs{'fixed'})) {
1350             $MinLength->fixed($attrs{'fixed'});
1351             }
1352              
1353             if (exists($attrs{'id'})) {
1354             $MinLength->id($attrs{'id'});
1355             }
1356              
1357             if (exists($attrs{'value'})) {
1358             $MinLength->value($attrs{'value'});
1359             }
1360              
1361             return $MinLength;
1362             }
1363              
1364             #===============================================================================
1365              
1366             sub handle_end_minLength() {
1367             my ($expat,$tag,$MinLength) = @_;
1368             }
1369              
1370             #===============================================================================
1371              
1372             sub handle_start_notation() {
1373             my ($expat,$tag,%attrs) = @_;
1374             my $Notation = Rinchi::XMLSchema::Notation->new();
1375              
1376             if (exists($attrs{'id'})) {
1377             $Notation->id($attrs{'id'});
1378             }
1379              
1380             if (exists($attrs{'name'})) {
1381             $Notation->name($attrs{'name'});
1382             }
1383              
1384             if (exists($attrs{'public'})) {
1385             $Notation->public($attrs{'public'});
1386             }
1387              
1388             if (exists($attrs{'system'})) {
1389             $Notation->system($attrs{'system'});
1390             }
1391              
1392             return $Notation;
1393             }
1394              
1395             #===============================================================================
1396              
1397             sub handle_end_notation() {
1398             my ($expat,$tag,$Notation) = @_;
1399             }
1400              
1401             #===============================================================================
1402              
1403             sub handle_start_pattern() {
1404             my ($expat,$tag,%attrs) = @_;
1405             my $Pattern = Rinchi::XMLSchema::Pattern->new();
1406              
1407             if (exists($attrs{'id'})) {
1408             $Pattern->id($attrs{'id'});
1409             }
1410              
1411             if (exists($attrs{'value'})) {
1412             $Pattern->value($attrs{'value'});
1413             }
1414              
1415             return $Pattern;
1416             }
1417              
1418             #===============================================================================
1419              
1420             sub handle_end_pattern() {
1421             my ($expat,$tag,$Pattern) = @_;
1422             }
1423              
1424             #===============================================================================
1425              
1426             sub handle_start_redefine() {
1427             my ($expat,$tag,%attrs) = @_;
1428             my $Redefine = Rinchi::XMLSchema::Redefine->new();
1429              
1430             if (exists($attrs{'id'})) {
1431             $Redefine->id($attrs{'id'});
1432             }
1433              
1434             if (exists($attrs{'schemaLocation'})) {
1435             $Redefine->schemaLocation($attrs{'schemaLocation'});
1436             }
1437              
1438             return $Redefine;
1439             }
1440              
1441             #===============================================================================
1442              
1443             sub handle_end_redefine() {
1444             my ($expat,$tag,$Redefine) = @_;
1445             }
1446              
1447             #===============================================================================
1448              
1449             sub handle_start_restriction() {
1450             my ($expat,$tag,%attrs) = @_;
1451             my $Restriction = Rinchi::XMLSchema::Restriction->new();
1452              
1453             if (exists($attrs{'base'})) {
1454             $Restriction->base($attrs{'base'});
1455             }
1456              
1457             if (exists($attrs{'id'})) {
1458             $Restriction->id($attrs{'id'});
1459             }
1460              
1461             return $Restriction;
1462             }
1463              
1464             #===============================================================================
1465              
1466             sub handle_end_restriction() {
1467             my ($expat,$tag,$Restriction) = @_;
1468             }
1469              
1470             #===============================================================================
1471              
1472             sub handle_start_schema() {
1473             my ($expat,$tag,%attrs) = @_;
1474             my $Schema = Rinchi::XMLSchema::Schema->new();
1475              
1476             if (exists($attrs{'attributeFormDefault'})) {
1477             $Schema->attributeFormDefault($attrs{'attributeFormDefault'});
1478             }
1479              
1480             if (exists($attrs{'blockDefault'})) {
1481             $Schema->blockDefault($attrs{'blockDefault'});
1482             }
1483              
1484             if (exists($attrs{'elementFormDefault'})) {
1485             $Schema->elementFormDefault($attrs{'elementFormDefault'});
1486             }
1487              
1488             if (exists($attrs{'finalDefault'})) {
1489             $Schema->finalDefault($attrs{'finalDefault'});
1490             }
1491              
1492             if (exists($attrs{'id'})) {
1493             $Schema->id($attrs{'id'});
1494             }
1495              
1496             if (exists($attrs{'targetNamespace'})) {
1497             $Schema->targetNamespace($attrs{'targetNamespace'});
1498             }
1499              
1500             if (exists($attrs{'version'})) {
1501             $Schema->version($attrs{'version'});
1502             }
1503              
1504             if (exists($attrs{'xml:lang'})) {
1505             $Schema->xml_lang($attrs{'xml:lang'});
1506             }
1507              
1508             if (exists($attrs{'xmlns'})) {
1509             $Schema->xmlns($attrs{'xmlns'});
1510             }
1511              
1512             if (exists($attrs{'xmlns:xs'})) {
1513             $Schema->xmlns_xs($attrs{'xmlns:xs'});
1514             }
1515              
1516             return $Schema;
1517             }
1518              
1519             #===============================================================================
1520              
1521             sub handle_end_schema() {
1522             my ($expat,$tag,$Schema) = @_;
1523             }
1524              
1525             #===============================================================================
1526              
1527             sub handle_start_selector() {
1528             my ($expat,$tag,%attrs) = @_;
1529             my $Selector = Rinchi::XMLSchema::Selector->new();
1530              
1531             if (exists($attrs{'id'})) {
1532             $Selector->id($attrs{'id'});
1533             }
1534              
1535             if (exists($attrs{'xpath'})) {
1536             $Selector->xpath($attrs{'xpath'});
1537             }
1538              
1539             return $Selector;
1540             }
1541              
1542             #===============================================================================
1543              
1544             sub handle_end_selector() {
1545             my ($expat,$tag,$Selector) = @_;
1546             }
1547              
1548             #===============================================================================
1549              
1550             sub handle_start_sequence() {
1551             my ($expat,$tag,%attrs) = @_;
1552             my $Sequence = Rinchi::XMLSchema::Sequence->new();
1553              
1554             if (exists($attrs{'id'})) {
1555             $Sequence->id($attrs{'id'});
1556             }
1557              
1558             if (exists($attrs{'maxOccurs'})) {
1559             $Sequence->maxOccurs($attrs{'maxOccurs'});
1560             }
1561              
1562             if (exists($attrs{'minOccurs'})) {
1563             $Sequence->minOccurs($attrs{'minOccurs'});
1564             }
1565              
1566             return $Sequence;
1567             }
1568              
1569             #===============================================================================
1570              
1571             sub handle_end_sequence() {
1572             my ($expat,$tag,$Sequence) = @_;
1573             }
1574              
1575             #===============================================================================
1576              
1577             sub handle_start_simpleContent() {
1578             my ($expat,$tag,%attrs) = @_;
1579             my $SimpleContent = Rinchi::XMLSchema::SimpleContent->new();
1580              
1581             if (exists($attrs{'id'})) {
1582             $SimpleContent->id($attrs{'id'});
1583             }
1584              
1585             return $SimpleContent;
1586             }
1587              
1588             #===============================================================================
1589              
1590             sub handle_end_simpleContent() {
1591             my ($expat,$tag,$SimpleContent) = @_;
1592             }
1593              
1594             #===============================================================================
1595              
1596             sub handle_start_simpleType() {
1597             my ($expat,$tag,%attrs) = @_;
1598             my $SimpleType = Rinchi::XMLSchema::SimpleType->new();
1599              
1600             if (exists($attrs{'final'})) {
1601             $SimpleType->final($attrs{'final'});
1602             }
1603              
1604             if (exists($attrs{'id'})) {
1605             $SimpleType->id($attrs{'id'});
1606             }
1607              
1608             if (exists($attrs{'name'})) {
1609             $SimpleType->name($attrs{'name'});
1610             }
1611              
1612             return $SimpleType;
1613             }
1614              
1615             #===============================================================================
1616              
1617             sub handle_end_simpleType() {
1618             my ($expat,$tag,$SimpleType) = @_;
1619             }
1620              
1621             #===============================================================================
1622              
1623             sub handle_start_totalDigits() {
1624             my ($expat,$tag,%attrs) = @_;
1625             my $TotalDigits = Rinchi::XMLSchema::TotalDigits->new();
1626              
1627             if (exists($attrs{'fixed'})) {
1628             $TotalDigits->fixed($attrs{'fixed'});
1629             }
1630              
1631             if (exists($attrs{'id'})) {
1632             $TotalDigits->id($attrs{'id'});
1633             }
1634              
1635             if (exists($attrs{'value'})) {
1636             $TotalDigits->value($attrs{'value'});
1637             }
1638              
1639             return $TotalDigits;
1640             }
1641              
1642             #===============================================================================
1643              
1644             sub handle_end_totalDigits() {
1645             my ($expat,$tag,$TotalDigits) = @_;
1646             }
1647              
1648             #===============================================================================
1649              
1650             sub handle_start_union() {
1651             my ($expat,$tag,%attrs) = @_;
1652             my $Union = Rinchi::XMLSchema::Union->new();
1653              
1654             if (exists($attrs{'id'})) {
1655             $Union->id($attrs{'id'});
1656             }
1657              
1658             if (exists($attrs{'memberTypes'})) {
1659             $Union->memberTypes($attrs{'memberTypes'});
1660             }
1661              
1662             return $Union;
1663             }
1664              
1665             #===============================================================================
1666              
1667             sub handle_end_union() {
1668             my ($expat,$tag,$Union) = @_;
1669             }
1670              
1671             #===============================================================================
1672              
1673             sub handle_start_unique() {
1674             my ($expat,$tag,%attrs) = @_;
1675             my $Unique = Rinchi::XMLSchema::Unique->new();
1676              
1677             if (exists($attrs{'id'})) {
1678             $Unique->id($attrs{'id'});
1679             }
1680              
1681             if (exists($attrs{'name'})) {
1682             $Unique->name($attrs{'name'});
1683             }
1684              
1685             return $Unique;
1686             }
1687              
1688             #===============================================================================
1689              
1690             sub handle_end_unique() {
1691             my ($expat,$tag,$Unique) = @_;
1692             }
1693              
1694             #===============================================================================
1695              
1696             sub handle_start_whiteSpace() {
1697             my ($expat,$tag,%attrs) = @_;
1698             my $WhiteSpace = Rinchi::XMLSchema::WhiteSpace->new();
1699              
1700             if (exists($attrs{'fixed'})) {
1701             $WhiteSpace->fixed($attrs{'fixed'});
1702             }
1703              
1704             if (exists($attrs{'id'})) {
1705             $WhiteSpace->id($attrs{'id'});
1706             }
1707              
1708             if (exists($attrs{'value'})) {
1709             $WhiteSpace->value($attrs{'value'});
1710             }
1711              
1712             return $WhiteSpace;
1713             }
1714              
1715             #===============================================================================
1716              
1717             sub handle_end_whiteSpace() {
1718             my ($expat,$tag,$WhiteSpace) = @_;
1719             }
1720              
1721             #===============================================================================
1722             # Rinchi::XMLSchema::sameAs
1723              
1724             =item $value = $Object->sameAs($other);
1725              
1726             Compares self to other returning 1 if they are the same, 0 otherwise;
1727              
1728             =cut
1729              
1730             sub sameAs() {
1731             my $self = shift @_;
1732             my $other = shift @_;
1733            
1734             return 0 unless (ref($other) eq ref($self));
1735            
1736             return 1;
1737             }
1738              
1739             #===============================================================================
1740             sub _find_identityConstraints() {
1741             my $self = shift;
1742             my $root = shift;
1743            
1744             foreach my $c (@{$self->{'_content_'}}) {
1745             my $cref = ref($c);
1746             # print "ref $cref\n";
1747             if ($cref eq 'Rinchi::XMLSchema::All') {
1748             }
1749             elsif ($cref eq 'Rinchi::XMLSchema::Annotation') {
1750             }
1751             elsif ($cref eq 'Rinchi::XMLSchema::Any') {
1752             }
1753             elsif ($cref eq 'Rinchi::XMLSchema::AnyAttribute') {
1754             }
1755             elsif ($cref eq 'Rinchi::XMLSchema::Appinfo') {
1756             }
1757             elsif ($cref eq 'Rinchi::XMLSchema::Attribute') {
1758             }
1759             elsif ($cref eq 'Rinchi::XMLSchema::AttributeGroup') {
1760             }
1761             elsif ($cref eq 'Rinchi::XMLSchema::Choice') {
1762             }
1763             elsif ($cref eq 'Rinchi::XMLSchema::ComplexContent') {
1764             }
1765             elsif ($cref eq 'Rinchi::XMLSchema::ComplexType') {
1766             }
1767             elsif ($cref eq 'Rinchi::XMLSchema::Documentation') {
1768             }
1769             elsif ($cref eq 'Rinchi::XMLSchema::Element') {
1770             $c->_find_identityConstraints($root);
1771             }
1772             elsif ($cref eq 'Rinchi::XMLSchema::Enumeration') {
1773             }
1774             elsif ($cref eq 'Rinchi::XMLSchema::Extension') {
1775             }
1776             elsif ($cref eq 'Rinchi::XMLSchema::Field') {
1777             }
1778             elsif ($cref eq 'Rinchi::XMLSchema::FractionDigits') {
1779             }
1780             elsif ($cref eq 'Rinchi::XMLSchema::Group') {
1781             }
1782             elsif ($cref eq 'Rinchi::XMLSchema::Import') {
1783             }
1784             elsif ($cref eq 'Rinchi::XMLSchema::Include') {
1785             }
1786             elsif ($cref eq 'Rinchi::XMLSchema::Key') {
1787             $root->{'_identityConstraints'}{$c->name()} = $c;
1788             }
1789             elsif ($cref eq 'Rinchi::XMLSchema::Keyref') {
1790             $root->{'_identityConstraints'}{$c->name()} = $c;
1791             }
1792             elsif ($cref eq 'Rinchi::XMLSchema::Length') {
1793             }
1794             elsif ($cref eq 'Rinchi::XMLSchema::List') {
1795             }
1796             elsif ($cref eq 'Rinchi::XMLSchema::MaxExclusive') {
1797             }
1798             elsif ($cref eq 'Rinchi::XMLSchema::MaxInclusive') {
1799             }
1800             elsif ($cref eq 'Rinchi::XMLSchema::MaxLength') {
1801             }
1802             elsif ($cref eq 'Rinchi::XMLSchema::MinExclusive') {
1803             }
1804             elsif ($cref eq 'Rinchi::XMLSchema::MinInclusive') {
1805             }
1806             elsif ($cref eq 'Rinchi::XMLSchema::MinLength') {
1807             }
1808             elsif ($cref eq 'Rinchi::XMLSchema::Notation') {
1809             }
1810             elsif ($cref eq 'Rinchi::XMLSchema::Pattern') {
1811             }
1812             elsif ($cref eq 'Rinchi::XMLSchema::Redefine') {
1813             }
1814             elsif ($cref eq 'Rinchi::XMLSchema::Restriction') {
1815             }
1816             elsif ($cref eq 'Rinchi::XMLSchema::Schema') {
1817             }
1818             elsif ($cref eq 'Rinchi::XMLSchema::Selector') {
1819             }
1820             elsif ($cref eq 'Rinchi::XMLSchema::Sequence') {
1821             }
1822             elsif ($cref eq 'Rinchi::XMLSchema::SimpleContent') {
1823             }
1824             elsif ($cref eq 'Rinchi::XMLSchema::SimpleType') {
1825             }
1826             elsif ($cref eq 'Rinchi::XMLSchema::TotalDigits') {
1827             }
1828             elsif ($cref eq 'Rinchi::XMLSchema::Union') {
1829             }
1830             elsif ($cref eq 'Rinchi::XMLSchema::Unique') {
1831             $root->{'_identityConstraints'}{$c->name()} = $c;
1832             }
1833             elsif ($cref eq 'Rinchi::XMLSchema::WhiteSpace') {
1834             }
1835             }
1836             }
1837              
1838             #===============================================================================
1839              
1840             package Rinchi::XMLSchema::All;
1841              
1842             use Carp;
1843              
1844             our @ISA = qw(Rinchi::XMLSchema);
1845              
1846             our @EXPORT = qw();
1847             our @EXPORT_OK = qw();
1848              
1849             =head1 DESCRIPTION of All class
1850              
1851             Rinchi::XMLSchema::All is used for creating XML Schema All objects.
1852              
1853             id = ID
1854             maxOccurs = 1 : 1
1855             minOccurs = (0 | 1) : 1
1856             {any attributes with non-schema namespace ...}>
1857             Content: (annotation?, element*)
1858              
1859             =cut
1860              
1861             #===============================================================================
1862              
1863             =item $Object = Rinchi::XMLSchema::All->new();
1864              
1865             Create a new Rinchi::XMLSchema::All object.
1866              
1867             =cut
1868              
1869             sub new() {
1870             my $class = shift;
1871             $class = ref($class) || $class;
1872             my $self = {};
1873             bless($self,$class);
1874             $self->{'_content_'} = [];
1875             return $self;
1876             }
1877              
1878             #===============================================================================
1879             # Rinchi::XMLSchema::All::id
1880              
1881             =item $value = $Object->id([$new_value]);
1882              
1883             Set or get value of the 'id' attribute.
1884              
1885             =cut
1886              
1887             sub id() {
1888             my $self = shift;
1889             if (@_) {
1890             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
1891             $self->{'_id'} = shift;
1892             } else {
1893             carp 'Found value \'' . $_[0] . '\', expecting ID.'
1894             }
1895             }
1896             return $self->{'_id'};
1897             }
1898              
1899             #===============================================================================
1900             # Rinchi::XMLSchema::All::maxOccurs
1901              
1902             =item $value = $Object->maxOccurs([$new_value]);
1903              
1904             Set or get value of the 'maxOccurs' attribute.
1905              
1906             =cut
1907              
1908             sub maxOccurs() {
1909             my $self = shift;
1910             if (@_) {
1911             $self->{'_maxOccurs'} = shift;
1912             }
1913             return $self->{'_maxOccurs'};
1914             }
1915              
1916             #===============================================================================
1917             # Rinchi::XMLSchema::All::minOccurs
1918              
1919             =item $value = $Object->minOccurs([$new_value]);
1920              
1921             Set or get value of the 'minOccurs' attribute.
1922              
1923             =cut
1924              
1925             sub minOccurs() {
1926             my $self = shift;
1927             if (@_) {
1928             $self->{'_minOccurs'} = shift;
1929             }
1930             return $self->{'_minOccurs'};
1931             }
1932              
1933             #===============================================================================
1934             # Rinchi::XMLSchema::All::sameAs
1935              
1936             =item $value = $Object->sameAs($other);
1937              
1938             Compares self to other returning 1 if they are the same, 0 otherwise;
1939              
1940             =cut
1941              
1942             sub sameAs() {
1943             my $self = shift @_;
1944             my $other = shift @_;
1945              
1946             return 0 unless (ref($other) eq ref($self));
1947              
1948             if (exists($self->{'_maxOccurs'})) {
1949             if (exists($other->{'_maxOccurs'})) {
1950             return 0 unless ($self->{'_maxOccurs'} eq $other->{'_maxOccurs'});
1951             } else {
1952             return 0;
1953             }
1954             } else {
1955             return 0 if (exists($other->{'_maxOccurs'}));
1956             }
1957              
1958             if (exists($self->{'_minOccurs'})) {
1959             if (exists($other->{'_minOccurs'})) {
1960             return 0 unless ($self->{'_minOccurs'} eq $other->{'_minOccurs'});
1961             } else {
1962             return 0;
1963             }
1964             } else {
1965             return 0 if (exists($other->{'_minOccurs'}));
1966             }
1967              
1968             my @self_cont = @{$self->{'_content_'}};
1969             my @other_cont = @{$other->{'_content_'}};
1970             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
1971             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
1972              
1973             if (@self_cont) {
1974             if (@other_cont) {
1975             while (@self_cont and @other_cont) {
1976             my $sc = shift @self_cont;
1977             my $oc = shift @other_cont;
1978             return 0 unless($sc->sameAs($oc));
1979             }
1980             return (0) if (@self_cont or @other_cont);
1981             } else {
1982             return 0;
1983             }
1984             } else {
1985             return 0 if (@other_cont);
1986             }
1987              
1988             return 1;
1989             }
1990              
1991             #===============================================================================
1992              
1993             package Rinchi::XMLSchema::Annotation;
1994              
1995             use Carp;
1996              
1997             our @ISA = qw(Rinchi::XMLSchema);
1998              
1999             our @EXPORT = qw();
2000             our @EXPORT_OK = qw();
2001              
2002             =head1 DESCRIPTION of Annotation class
2003              
2004             Rinchi::XMLSchema::Annotation is used for creating XML Schema Annotation objects.
2005              
2006             id = ID
2007             {any attributes with non-schema namespace ...}>
2008             Content: (appinfo | documentation)*
2009              
2010             =cut
2011              
2012             #===============================================================================
2013              
2014             =item $Object = Rinchi::XMLSchema::Annotation->new();
2015              
2016             Create a new Rinchi::XMLSchema::Annotation object.
2017              
2018             =cut
2019              
2020             sub new() {
2021             my $class = shift;
2022             $class = ref($class) || $class;
2023             my $self = {};
2024             bless($self,$class);
2025             $self->{'_content_'} = [];
2026             return $self;
2027             }
2028              
2029             #===============================================================================
2030              
2031             package Rinchi::XMLSchema::Any;
2032              
2033             use Carp;
2034              
2035             our @ISA = qw(Rinchi::XMLSchema);
2036              
2037             our @EXPORT = qw();
2038             our @EXPORT_OK = qw();
2039              
2040             =head1 DESCRIPTION of Any class
2041              
2042             Rinchi::XMLSchema::Any is used for creating XML Schema Any objects.
2043              
2044             id = ID
2045             maxOccurs = (nonNegativeInteger | unbounded) : 1
2046             minOccurs = nonNegativeInteger : 1
2047             namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) ) : ##any
2048             processContents = (lax | skip | strict) : strict
2049             {any attributes with non-schema namespace ...}>
2050             Content: (annotation?)
2051              
2052             =cut
2053              
2054             #===============================================================================
2055              
2056             =item $Object = Rinchi::XMLSchema::Any->new();
2057              
2058             Create a new Rinchi::XMLSchema::Any object.
2059              
2060             =cut
2061              
2062             sub new() {
2063             my $class = shift;
2064             $class = ref($class) || $class;
2065             my $self = {};
2066             bless($self,$class);
2067             $self->{'_content_'} = [];
2068             return $self;
2069             }
2070              
2071             #===============================================================================
2072             # Rinchi::XMLSchema::Any::id
2073              
2074             =item $value = $Object->id([$new_value]);
2075              
2076             Set or get value of the 'id' attribute.
2077              
2078             =cut
2079              
2080             sub id() {
2081             my $self = shift;
2082             if (@_) {
2083             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
2084             $self->{'_id'} = shift;
2085             } else {
2086             carp 'Found value \'' . $_[0] . '\', expecting ID.'
2087             }
2088             }
2089             return $self->{'_id'};
2090             }
2091              
2092             #===============================================================================
2093             # Rinchi::XMLSchema::Any::maxOccurs
2094              
2095             =item $value = $Object->maxOccurs([$new_value]);
2096              
2097             Set or get value of the 'maxOccurs' attribute.
2098              
2099             =cut
2100              
2101             sub maxOccurs() {
2102             my $self = shift;
2103             if (@_) {
2104             $self->{'_maxOccurs'} = shift;
2105             }
2106             return $self->{'_maxOccurs'};
2107             }
2108              
2109             #===============================================================================
2110             # Rinchi::XMLSchema::Any::minOccurs
2111              
2112             =item $value = $Object->minOccurs([$new_value]);
2113              
2114             Set or get value of the 'minOccurs' attribute.
2115              
2116             =cut
2117              
2118             sub minOccurs() {
2119             my $self = shift;
2120             if (@_) {
2121             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
2122             $self->{'_minOccurs'} = shift;
2123             } else {
2124             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
2125             }
2126             }
2127             return $self->{'_minOccurs'};
2128             }
2129              
2130             #===============================================================================
2131             # Rinchi::XMLSchema::Any::namespace
2132              
2133             =item $value = $Object->namespace([$new_value]);
2134              
2135             Set or get value of the 'namespace' attribute.
2136              
2137             =cut
2138              
2139             sub namespace() {
2140             my $self = shift;
2141             if (@_) {
2142             $self->{'_namespace'} = shift;
2143             }
2144             return $self->{'_namespace'};
2145             }
2146              
2147             #===============================================================================
2148             # Rinchi::XMLSchema::Any::processContents
2149              
2150             =item $value = $Object->processContents([$new_value]);
2151              
2152             Set or get value of the 'processContents' attribute.
2153              
2154             =cut
2155              
2156             sub processContents() {
2157             my $self = shift;
2158             if (@_) {
2159             if ($_[0] =~ /^skip|lax|strict$/) {
2160             $self->{'_processContents'} = shift;
2161             } else {
2162             carp 'Found value \'' . $_[0] . '\', expecting value \'skip | lax | strict\'.'
2163             }
2164             }
2165             return $self->{'_processContents'};
2166             }
2167              
2168             #===============================================================================
2169             # Rinchi::XMLSchema::Any::sameAs
2170              
2171             =item $value = $Object->sameAs($other);
2172              
2173             Compares self to other returning 1 if they are the same, 0 otherwise;
2174              
2175             =cut
2176              
2177             sub sameAs() {
2178             my $self = shift @_;
2179             my $other = shift @_;
2180              
2181             return 0 unless (ref($other) eq ref($self));
2182              
2183             if (exists($self->{'_maxOccurs'})) {
2184             if (exists($other->{'_maxOccurs'})) {
2185             return 0 unless ($self->{'_maxOccurs'} eq $other->{'_maxOccurs'});
2186             } else {
2187             return 0;
2188             }
2189             } else {
2190             return 0 if (exists($other->{'_maxOccurs'}));
2191             }
2192              
2193             if (exists($self->{'_minOccurs'})) {
2194             if (exists($other->{'_minOccurs'})) {
2195             return 0 unless ($self->{'_minOccurs'} eq $other->{'_minOccurs'});
2196             } else {
2197             return 0;
2198             }
2199             } else {
2200             return 0 if (exists($other->{'_minOccurs'}));
2201             }
2202              
2203             if (exists($self->{'_namespace'})) {
2204             if (exists($other->{'_namespace'})) {
2205             return 0 unless ($self->{'_namespace'} eq $other->{'_namespace'});
2206             } else {
2207             return 0;
2208             }
2209             } else {
2210             return 0 if (exists($other->{'_namespace'}));
2211             }
2212              
2213             if (exists($self->{'_processContents'})) {
2214             if (exists($other->{'_processContents'})) {
2215             return 0 unless ($self->{'_processContents'} eq $other->{'_processContents'});
2216             } else {
2217             return 0;
2218             }
2219             } else {
2220             return 0 if (exists($other->{'_processContents'}));
2221             }
2222              
2223             my @self_cont = @{$self->{'_content_'}};
2224             my @other_cont = @{$other->{'_content_'}};
2225             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
2226             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
2227              
2228             if (@self_cont) {
2229             if (@other_cont) {
2230             while (@self_cont and @other_cont) {
2231             my $sc = shift @self_cont;
2232             my $oc = shift @other_cont;
2233             return 0 unless($sc->sameAs($oc));
2234             }
2235             return (0) if (@self_cont or @other_cont);
2236             } else {
2237             return 0;
2238             }
2239             } else {
2240             return 0 if (@other_cont);
2241             }
2242              
2243             return 1;
2244             }
2245              
2246             #===============================================================================
2247              
2248             package Rinchi::XMLSchema::AnyAttribute;
2249              
2250             use Carp;
2251              
2252             our @ISA = qw(Rinchi::XMLSchema);
2253              
2254             our @EXPORT = qw();
2255             our @EXPORT_OK = qw();
2256              
2257             =head1 DESCRIPTION of AnyAttribute class
2258              
2259             Rinchi::XMLSchema::AnyAttribute is used for creating XML Schema AnyAttribute objects.
2260              
2261             =cut
2262              
2263             #===============================================================================
2264              
2265             =item $Object = Rinchi::XMLSchema::AnyAttribute->new();
2266              
2267             Create a new Rinchi::XMLSchema::AnyAttribute object.
2268              
2269             =cut
2270              
2271             sub new() {
2272             my $class = shift;
2273             $class = ref($class) || $class;
2274             my $self = {};
2275             bless($self,$class);
2276             $self->{'_content_'} = [];
2277             return $self;
2278             }
2279              
2280             #===============================================================================
2281             # Rinchi::XMLSchema::AnyAttribute::id
2282              
2283             =item $value = $Object->id([$new_value]);
2284              
2285             Set or get value of the 'id' attribute.
2286              
2287             =cut
2288              
2289             sub id() {
2290             my $self = shift;
2291             if (@_) {
2292             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
2293             $self->{'_id'} = shift;
2294             } else {
2295             carp 'Found value \'' . $_[0] . '\', expecting ID.'
2296             }
2297             }
2298             return $self->{'_id'};
2299             }
2300              
2301             #===============================================================================
2302             # Rinchi::XMLSchema::AnyAttribute::namespace
2303              
2304             =item $value = $Object->namespace([$new_value]);
2305              
2306             Set or get value of the 'namespace' attribute.
2307              
2308             =cut
2309              
2310             sub namespace() {
2311             my $self = shift;
2312             if (@_) {
2313             $self->{'_namespace'} = shift;
2314             }
2315             return $self->{'_namespace'};
2316             }
2317              
2318             #===============================================================================
2319             # Rinchi::XMLSchema::AnyAttribute::processContents
2320              
2321             =item $value = $Object->processContents([$new_value]);
2322              
2323             Set or get value of the 'processContents' attribute.
2324              
2325             =cut
2326              
2327             sub processContents() {
2328             my $self = shift;
2329             if (@_) {
2330             if ($_[0] =~ /^skip|lax|strict$/) {
2331             $self->{'_processContents'} = shift;
2332             } else {
2333             carp 'Found value \'' . $_[0] . '\', expecting value \'skip | lax | strict\'.'
2334             }
2335             }
2336             return $self->{'_processContents'};
2337             }
2338              
2339             #===============================================================================
2340             # Rinchi::XMLSchema::AnyAttribute::sameAs
2341              
2342             =item $value = $Object->sameAs($other);
2343              
2344             Compares self to other returning 1 if they are the same, 0 otherwise;
2345              
2346             =cut
2347              
2348             sub sameAs() {
2349             my $self = shift @_;
2350             my $other = shift @_;
2351              
2352             return 0 unless (ref($other) eq ref($self));
2353              
2354             if (exists($self->{'_namespace'})) {
2355             if (exists($other->{'_namespace'})) {
2356             return 0 unless ($self->{'_namespace'} eq $other->{'_namespace'});
2357             } else {
2358             return 0;
2359             }
2360             } else {
2361             return 0 if (exists($other->{'_namespace'}));
2362             }
2363              
2364             if (exists($self->{'_processContents'})) {
2365             if (exists($other->{'_processContents'})) {
2366             return 0 unless ($self->{'_processContents'} eq $other->{'_processContents'});
2367             } else {
2368             return 0;
2369             }
2370             } else {
2371             return 0 if (exists($other->{'_processContents'}));
2372             }
2373              
2374             return 1;
2375             }
2376              
2377             #===============================================================================
2378              
2379             package Rinchi::XMLSchema::Appinfo;
2380              
2381             use Carp;
2382              
2383             our @ISA = qw(Rinchi::XMLSchema);
2384              
2385             our @EXPORT = qw();
2386             our @EXPORT_OK = qw();
2387              
2388             =head1 DESCRIPTION of Appinfo class
2389              
2390             Rinchi::XMLSchema::Appinfo is used for creating XML Schema Appinfo objects.
2391              
2392             source = anyURI
2393             {any attributes with non-schema namespace ...}>
2394             Content: ({any})*
2395              
2396             =cut
2397              
2398             #===============================================================================
2399              
2400             =item $Object = Rinchi::XMLSchema::Appinfo->new();
2401              
2402             Create a new Rinchi::XMLSchema::Appinfo object.
2403              
2404             =cut
2405              
2406             sub new() {
2407             my $class = shift;
2408             $class = ref($class) || $class;
2409             my $self = {};
2410             bless($self,$class);
2411             $self->{'_content_'} = [];
2412             return $self;
2413             }
2414              
2415             #===============================================================================
2416             # Rinchi::XMLSchema::Appinfo::id
2417              
2418             =item $value = $Object->id([$new_value]);
2419              
2420             Set or get value of the 'id' attribute.
2421              
2422             =cut
2423              
2424             sub id() {
2425             my $self = shift;
2426             if (@_) {
2427             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
2428             $self->{'_id'} = shift;
2429             } else {
2430             carp 'Found value \'' . $_[0] . '\', expecting ID.'
2431             }
2432             }
2433             return $self->{'_id'};
2434             }
2435              
2436             #===============================================================================
2437             # Rinchi::XMLSchema::Appinfo::source
2438              
2439             =item $value = $Object->source([$new_value]);
2440              
2441             Set or get value of the 'source' attribute.
2442              
2443             =cut
2444              
2445             sub source() {
2446             my $self = shift;
2447             if (@_) {
2448             $self->{'_source'} = shift;
2449             }
2450             return $self->{'_source'};
2451             }
2452              
2453             #===============================================================================
2454              
2455             package Rinchi::XMLSchema::Attribute;
2456              
2457             use Carp;
2458              
2459             our @ISA = qw(Rinchi::XMLSchema);
2460              
2461             our @EXPORT = qw();
2462             our @EXPORT_OK = qw();
2463              
2464             =head1 DESCRIPTION of Attribute class
2465              
2466             Rinchi::XMLSchema::Attribute is used for creating XML Schema Attribute objects.
2467              
2468             default = string
2469             fixed = string
2470             form = (qualified | unqualified)
2471             id = ID
2472             name = NCName
2473             ref = QName
2474             type = QName
2475             use = (optional | prohibited | required) : optional
2476             {any attributes with non-schema namespace ...}>
2477             Content: (annotation?, simpleType?)
2478              
2479             =cut
2480              
2481             #===============================================================================
2482              
2483             =item $Object = Rinchi::XMLSchema::Attribute->new();
2484              
2485             Create a new Rinchi::XMLSchema::Attribute object.
2486              
2487             =cut
2488              
2489             sub new() {
2490             my $class = shift;
2491             $class = ref($class) || $class;
2492             my $self = {};
2493             bless($self,$class);
2494             $self->{'_content_'} = [];
2495             return $self;
2496             }
2497              
2498             #===============================================================================
2499             # Rinchi::XMLSchema::Attribute::default
2500              
2501             =item $value = $Object->default([$new_value]);
2502              
2503             Set or get value of the 'default' attribute.
2504              
2505             =cut
2506              
2507             sub default() {
2508             my $self = shift;
2509             if (@_) {
2510             $self->{'_default'} = shift;
2511             }
2512             return $self->{'_default'};
2513             }
2514              
2515             #===============================================================================
2516             # Rinchi::XMLSchema::Attribute::fixed
2517              
2518             =item $value = $Object->fixed([$new_value]);
2519              
2520             Set or get value of the 'fixed' attribute.
2521              
2522             =cut
2523              
2524             sub fixed() {
2525             my $self = shift;
2526             if (@_) {
2527             $self->{'_fixed'} = shift;
2528             }
2529             return $self->{'_fixed'};
2530             }
2531              
2532             #===============================================================================
2533             # Rinchi::XMLSchema::Attribute::form
2534              
2535             =item $value = $Object->form([$new_value]);
2536              
2537             Set or get value of the 'form' attribute.
2538              
2539             =cut
2540              
2541             sub form() {
2542             my $self = shift;
2543             if (@_) {
2544             if ($_[0] =~ /^qualified|unqualified$/) {
2545             $self->{'_form'} = shift;
2546             } else {
2547             carp 'Found value \'' . $_[0] . '\', expecting value \'qualified | unqualified\'.'
2548             }
2549             }
2550             return $self->{'_form'};
2551             }
2552              
2553             #===============================================================================
2554             # Rinchi::XMLSchema::Attribute::id
2555              
2556             =item $value = $Object->id([$new_value]);
2557              
2558             Set or get value of the 'id' attribute.
2559              
2560             =cut
2561              
2562             sub id() {
2563             my $self = shift;
2564             if (@_) {
2565             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
2566             $self->{'_id'} = shift;
2567             } else {
2568             carp 'Found value \'' . $_[0] . '\', expecting ID.'
2569             }
2570             }
2571             return $self->{'_id'};
2572             }
2573              
2574             #===============================================================================
2575             # Rinchi::XMLSchema::Attribute::name
2576              
2577             =item $value = $Object->name([$new_value]);
2578              
2579             Set or get value of the 'name' attribute.
2580              
2581             =cut
2582              
2583             sub name() {
2584             my $self = shift;
2585             if (@_) {
2586             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
2587             $self->{'_name'} = shift;
2588             } else {
2589             carp 'Found value \'' . $_[0] . '\', expecting an XML name.'
2590             }
2591             }
2592             return $self->{'_name'};
2593             }
2594              
2595             #===============================================================================
2596             # Rinchi::XMLSchema::Attribute::ref
2597              
2598             =item $value = $Object->ref([$new_value]);
2599              
2600             Set or get value of the 'ref' attribute.
2601              
2602             =cut
2603              
2604             sub ref() {
2605             my $self = shift;
2606             if (@_) {
2607             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
2608             $self->{'_ref'} = shift;
2609             } else {
2610             carp 'Found value \'' . $_[0] . '\', expecting an XML name.'
2611             }
2612             }
2613             return $self->{'_ref'};
2614             }
2615              
2616             #===============================================================================
2617             # Rinchi::XMLSchema::Attribute::type
2618              
2619             =item $value = $Object->type([$new_value]);
2620              
2621             Set or get value of the 'type' attribute.
2622              
2623             =cut
2624              
2625             sub type() {
2626             my $self = shift;
2627             if (@_) {
2628             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
2629             $self->{'_type'} = shift;
2630             } else {
2631             carp 'Found value \'' . $_[0] . '\', expecting an XML name.'
2632             }
2633             }
2634             return $self->{'_type'};
2635             }
2636              
2637             #===============================================================================
2638             # Rinchi::XMLSchema::Attribute::use
2639              
2640             =item $value = $Object->use([$new_value]);
2641              
2642             Set or get value of the 'use' attribute.
2643              
2644             =cut
2645              
2646             sub use() {
2647             my $self = shift;
2648             if (@_) {
2649             if ($_[0] =~ /^prohibited|optional|required$/) {
2650             $self->{'_use'} = shift;
2651             } else {
2652             carp 'Found value \'' . $_[0] . '\', expecting value \'prohibited | optional | required\'.'
2653             }
2654             }
2655             return $self->{'_use'};
2656             }
2657              
2658             #===============================================================================
2659             # Rinchi::XMLSchema::Attribute::sameAs
2660              
2661             =item $value = $Object->sameAs($other);
2662              
2663             Compares self to other returning 1 if they are the same, 0 otherwise;
2664              
2665             =cut
2666              
2667             sub sameAs() {
2668             my $self = shift @_;
2669             my $other = shift @_;
2670              
2671             return 0 unless (CORE::ref($other) eq CORE::ref($self));
2672              
2673             if (exists($self->{'_default'})) {
2674             if (exists($other->{'_default'})) {
2675             return 0 unless ($self->{'_default'} eq $other->{'_default'});
2676             } else {
2677             return 0;
2678             }
2679             } else {
2680             return 0 if (exists($other->{'_default'}));
2681             }
2682              
2683             if (exists($self->{'_fixed'})) {
2684             if (exists($other->{'_fixed'})) {
2685             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
2686             } else {
2687             return 0;
2688             }
2689             } else {
2690             return 0 if (exists($other->{'_fixed'}));
2691             }
2692              
2693             if (exists($self->{'_form'})) {
2694             if (exists($other->{'_form'})) {
2695             return 0 unless ($self->{'_form'} eq $other->{'_form'});
2696             } else {
2697             return 0;
2698             }
2699             } else {
2700             return 0 if (exists($other->{'_form'}));
2701             }
2702              
2703             if (exists($self->{'_name'})) {
2704             if (exists($other->{'_name'})) {
2705             return 0 unless ($self->{'_name'} eq $other->{'_name'});
2706             } else {
2707             return 0;
2708             }
2709             } else {
2710             return 0 if (exists($other->{'_name'}));
2711             }
2712              
2713             if (exists($self->{'_ref'})) {
2714             if (exists($other->{'_ref'})) {
2715             return 0 unless ($self->{'_ref'} eq $other->{'_ref'});
2716             } else {
2717             return 0;
2718             }
2719             } else {
2720             return 0 if (exists($other->{'_ref'}));
2721             }
2722              
2723             if (exists($self->{'_type'})) {
2724             if (exists($other->{'_type'})) {
2725             return 0 unless ($self->{'_type'} eq $other->{'_type'});
2726             } else {
2727             return 0;
2728             }
2729             } else {
2730             return 0 if (exists($other->{'_type'}));
2731             }
2732              
2733             if (exists($self->{'_use'})) {
2734             if (exists($other->{'_use'})) {
2735             return 0 unless ($self->{'_use'} eq $other->{'_use'});
2736             } else {
2737             return 0;
2738             }
2739             } else {
2740             return 0 if (exists($other->{'_use'}));
2741             }
2742              
2743             my @self_cont = @{$self->{'_content_'}};
2744             my @other_cont = @{$other->{'_content_'}};
2745             shift @self_cont while(@self_cont and CORE::ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
2746             shift @other_cont while(@other_cont and CORE::ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
2747              
2748             if (@self_cont) {
2749             if (@other_cont) {
2750             while (@self_cont and @other_cont) {
2751             my $sc = shift @self_cont;
2752             my $oc = shift @other_cont;
2753             return 0 unless($sc->sameAs($oc));
2754             }
2755             return (0) if (@self_cont or @other_cont);
2756             } else {
2757             return 0;
2758             }
2759             } else {
2760             return 0 if (@other_cont);
2761             }
2762              
2763             return 1;
2764             }
2765              
2766             #===============================================================================
2767              
2768             package Rinchi::XMLSchema::AttributeGroup;
2769              
2770             use Carp;
2771              
2772             our @ISA = qw(Rinchi::XMLSchema);
2773              
2774             our @EXPORT = qw();
2775             our @EXPORT_OK = qw();
2776              
2777             =head1 DESCRIPTION of AttributeGroup class
2778              
2779             Rinchi::XMLSchema::AttributeGroup is used for creating XML Schema AttributeGroup objects.
2780              
2781             id = ID
2782             name = NCName
2783             ref = QName
2784             {any attributes with non-schema namespace ...}>
2785             Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?))
2786              
2787             =cut
2788              
2789             #===============================================================================
2790              
2791             =item $Object = Rinchi::XMLSchema::AttributeGroup->new();
2792              
2793             Create a new Rinchi::XMLSchema::AttributeGroup object.
2794              
2795             =cut
2796              
2797             sub new() {
2798             my $class = shift;
2799             $class = ref($class) || $class;
2800             my $self = {};
2801             bless($self,$class);
2802             $self->{'_content_'} = [];
2803             return $self;
2804             }
2805              
2806             #===============================================================================
2807             # Rinchi::XMLSchema::AttributeGroup::id
2808              
2809             =item $value = $Object->id([$new_value]);
2810              
2811             Set or get value of the 'id' attribute.
2812              
2813             =cut
2814              
2815             sub id() {
2816             my $self = shift;
2817             if (@_) {
2818             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
2819             $self->{'_id'} = shift;
2820             } else {
2821             carp 'Found value \'' . $_[0] . '\', expecting ID.'
2822             }
2823             }
2824             return $self->{'_id'};
2825             }
2826              
2827             #===============================================================================
2828             # Rinchi::XMLSchema::AttributeGroup::name
2829              
2830             =item $value = $Object->name([$new_value]);
2831              
2832             Set or get value of the 'name' attribute.
2833              
2834             =cut
2835              
2836             sub name() {
2837             my $self = shift;
2838             if (@_) {
2839             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
2840             $self->{'_name'} = shift;
2841             } else {
2842             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
2843             }
2844             }
2845             return $self->{'_name'};
2846             }
2847              
2848             #===============================================================================
2849             # Rinchi::XMLSchema::AttributeGroup::ref
2850              
2851             =item $value = $Object->ref([$new_value]);
2852              
2853             Set or get value of the 'ref' attribute.
2854              
2855             =cut
2856              
2857             sub ref() {
2858             my $self = shift;
2859             if (@_) {
2860             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
2861             $self->{'_ref'} = shift;
2862             } else {
2863             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
2864             }
2865             }
2866             return $self->{'_ref'};
2867             }
2868              
2869             #===============================================================================
2870             # Rinchi::XMLSchema::AttributeGroup::sameAs
2871              
2872             =item $value = $Object->sameAs($other);
2873              
2874             Compares self to other returning 1 if they are the same, 0 otherwise;
2875              
2876             =cut
2877              
2878             sub sameAs() {
2879             my $self = shift @_;
2880             my $other = shift @_;
2881              
2882             return 0 unless (CORE::ref($other) eq CORE::ref($self));
2883              
2884             if (exists($self->{'_name'})) {
2885             if (exists($other->{'_name'})) {
2886             return 0 unless ($self->{'_name'} eq $other->{'_name'});
2887             } else {
2888             return 0;
2889             }
2890             } else {
2891             return 0 if (exists($other->{'_name'}));
2892             }
2893              
2894             if (exists($self->{'_ref'})) {
2895             if (exists($other->{'_ref'})) {
2896             return 0 unless ($self->{'_ref'} eq $other->{'_ref'});
2897             } else {
2898             return 0;
2899             }
2900             } else {
2901             return 0 if (exists($other->{'_ref'}));
2902             }
2903              
2904             my @self_cont = @{$self->{'_content_'}};
2905             my @other_cont = @{$other->{'_content_'}};
2906             shift @self_cont while(@self_cont and CORE::ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
2907             shift @other_cont while(@other_cont and CORE::ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
2908              
2909             if (@self_cont) {
2910             if (@other_cont) {
2911             while (@self_cont and @other_cont) {
2912             my $sc = shift @self_cont;
2913             my $oc = shift @other_cont;
2914             return 0 unless($sc->sameAs($oc));
2915             }
2916             return (0) if (@self_cont or @other_cont);
2917             } else {
2918             return 0;
2919             }
2920             } else {
2921             return 0 if (@other_cont);
2922             }
2923              
2924             return 1;
2925             }
2926              
2927             #===============================================================================
2928              
2929             package Rinchi::XMLSchema::Choice;
2930              
2931             use Carp;
2932              
2933             our @ISA = qw(Rinchi::XMLSchema);
2934              
2935             our @EXPORT = qw();
2936             our @EXPORT_OK = qw();
2937              
2938             =head1 DESCRIPTION of Choice class
2939              
2940             Rinchi::XMLSchema::Choice is used for creating XML Schema Choice objects.
2941              
2942             id = ID
2943             maxOccurs = (nonNegativeInteger | unbounded) : 1
2944             minOccurs = nonNegativeInteger : 1
2945             {any attributes with non-schema namespace ...}>
2946             Content: (annotation?, (element | group | choice | sequence | any)*)
2947              
2948             =cut
2949              
2950             #===============================================================================
2951              
2952             =item $Object = Rinchi::XMLSchema::Choice->new();
2953              
2954             Create a new Rinchi::XMLSchema::Choice object.
2955              
2956             =cut
2957              
2958             sub new() {
2959             my $class = shift;
2960             $class = ref($class) || $class;
2961             my $self = {};
2962             bless($self,$class);
2963             $self->{'_content_'} = [];
2964             return $self;
2965             }
2966              
2967             #===============================================================================
2968             # Rinchi::XMLSchema::Choice::id
2969              
2970             =item $value = $Object->id([$new_value]);
2971              
2972             Set or get value of the 'id' attribute.
2973              
2974             =cut
2975              
2976             sub id() {
2977             my $self = shift;
2978             if (@_) {
2979             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
2980             $self->{'_id'} = shift;
2981             } else {
2982             carp 'Found value \'' . $_[0] . '\', expecting ID.'
2983             }
2984             }
2985             return $self->{'_id'};
2986             }
2987              
2988             #===============================================================================
2989             # Rinchi::XMLSchema::Choice::maxOccurs
2990              
2991             =item $value = $Object->maxOccurs([$new_value]);
2992              
2993             Set or get value of the 'maxOccurs' attribute.
2994              
2995             =cut
2996              
2997             sub maxOccurs() {
2998             my $self = shift;
2999             if (@_) {
3000             $self->{'_maxOccurs'} = shift;
3001             }
3002             return $self->{'_maxOccurs'};
3003             }
3004              
3005             #===============================================================================
3006             # Rinchi::XMLSchema::Choice::minOccurs
3007              
3008             =item $value = $Object->minOccurs([$new_value]);
3009              
3010             Set or get value of the 'minOccurs' attribute.
3011              
3012             =cut
3013              
3014             sub minOccurs() {
3015             my $self = shift;
3016             if (@_) {
3017             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
3018             $self->{'_minOccurs'} = shift;
3019             } else {
3020             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
3021             }
3022             }
3023             return $self->{'_minOccurs'};
3024             }
3025              
3026             #===============================================================================
3027             # Rinchi::XMLSchema::Choice::sameAs
3028              
3029             =item $value = $Object->sameAs($other);
3030              
3031             Compares self to other returning 1 if they are the same, 0 otherwise;
3032              
3033             =cut
3034              
3035             sub sameAs() {
3036             my $self = shift @_;
3037             my $other = shift @_;
3038              
3039             return 0 unless (ref($other) eq ref($self));
3040              
3041             if (exists($self->{'_maxOccurs'})) {
3042             if (exists($other->{'_maxOccurs'})) {
3043             return 0 unless ($self->{'_maxOccurs'} eq $other->{'_maxOccurs'});
3044             } else {
3045             return 0;
3046             }
3047             } else {
3048             return 0 if (exists($other->{'_maxOccurs'}));
3049             }
3050              
3051             if (exists($self->{'_minOccurs'})) {
3052             if (exists($other->{'_minOccurs'})) {
3053             return 0 unless ($self->{'_minOccurs'} eq $other->{'_minOccurs'});
3054             } else {
3055             return 0;
3056             }
3057             } else {
3058             return 0 if (exists($other->{'_minOccurs'}));
3059             }
3060              
3061             my @self_cont = @{$self->{'_content_'}};
3062             my @other_cont = @{$other->{'_content_'}};
3063             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
3064             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
3065              
3066             if (@self_cont) {
3067             if (@other_cont) {
3068             while (@self_cont and @other_cont) {
3069             my $sc = shift @self_cont;
3070             my $oc = shift @other_cont;
3071             return 0 unless($sc->sameAs($oc));
3072             }
3073             return (0) if (@self_cont or @other_cont);
3074             } else {
3075             return 0;
3076             }
3077             } else {
3078             return 0 if (@other_cont);
3079             }
3080              
3081             return 1;
3082             }
3083              
3084             #===============================================================================
3085              
3086             package Rinchi::XMLSchema::ComplexContent;
3087              
3088             use Carp;
3089              
3090             our @ISA = qw(Rinchi::XMLSchema);
3091              
3092             our @EXPORT = qw();
3093             our @EXPORT_OK = qw();
3094              
3095             =head1 DESCRIPTION of ComplexContent class
3096              
3097             Rinchi::XMLSchema::ComplexContent is used for creating XML Schema ComplexContent objects.
3098              
3099             =cut
3100              
3101             #===============================================================================
3102              
3103             =item $Object = Rinchi::XMLSchema::ComplexContent->new();
3104              
3105             Create a new Rinchi::XMLSchema::ComplexContent object.
3106              
3107             =cut
3108              
3109             sub new() {
3110             my $class = shift;
3111             $class = ref($class) || $class;
3112             my $self = {};
3113             bless($self,$class);
3114             $self->{'_content_'} = [];
3115             return $self;
3116             }
3117              
3118             #===============================================================================
3119             # Rinchi::XMLSchema::ComplexContent::id
3120              
3121             =item $value = $Object->id([$new_value]);
3122              
3123             Set or get value of the 'id' attribute.
3124              
3125             =cut
3126              
3127             sub id() {
3128             my $self = shift;
3129             if (@_) {
3130             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
3131             $self->{'_id'} = shift;
3132             } else {
3133             carp 'Found value \'' . $_[0] . '\', expecting ID.'
3134             }
3135             }
3136             return $self->{'_id'};
3137             }
3138              
3139             #===============================================================================
3140             # Rinchi::XMLSchema::ComplexContent::mixed
3141              
3142             =item $value = $Object->mixed([$new_value]);
3143              
3144             Set or get value of the 'mixed' attribute.
3145              
3146             =cut
3147              
3148             sub mixed() {
3149             my $self = shift;
3150             if (@_) {
3151             if ($_[0] =~ /^true|false$/) {
3152             $self->{'_mixed'} = shift;
3153             } else {
3154             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
3155             }
3156             }
3157             return $self->{'_mixed'};
3158             }
3159              
3160             #===============================================================================
3161             # Rinchi::XMLSchema::ComplexContent::sameAs
3162              
3163             =item $value = $Object->sameAs($other);
3164              
3165             Compares self to other returning 1 if they are the same, 0 otherwise;
3166              
3167             =cut
3168              
3169             sub sameAs() {
3170             my $self = shift @_;
3171             my $other = shift @_;
3172              
3173             return 0 unless (ref($other) eq ref($self));
3174              
3175             if (exists($self->{'_mixed'})) {
3176             if (exists($other->{'_mixed'})) {
3177             return 0 unless ($self->{'_mixed'} eq $other->{'_mixed'});
3178             } else {
3179             return 0;
3180             }
3181             } else {
3182             return 0 if (exists($other->{'_mixed'}));
3183             }
3184              
3185             my @self_cont = @{$self->{'_content_'}};
3186             my @other_cont = @{$other->{'_content_'}};
3187             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
3188             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
3189              
3190             if (@self_cont) {
3191             if (@other_cont) {
3192             while (@self_cont and @other_cont) {
3193             my $sc = shift @self_cont;
3194             my $oc = shift @other_cont;
3195             return 0 unless($sc->sameAs($oc));
3196             }
3197             return (0) if (@self_cont or @other_cont);
3198             } else {
3199             return 0;
3200             }
3201             } else {
3202             return 0 if (@other_cont);
3203             }
3204              
3205             return 1;
3206             }
3207              
3208             #===============================================================================
3209              
3210             package Rinchi::XMLSchema::ComplexType;
3211              
3212             use Carp;
3213              
3214             our @ISA = qw(Rinchi::XMLSchema);
3215              
3216             our @EXPORT = qw();
3217             our @EXPORT_OK = qw();
3218              
3219             =head1 DESCRIPTION of ComplexType class
3220              
3221             Rinchi::XMLSchema::ComplexType is used for creating XML Schema ComplexType objects.
3222              
3223             abstract = boolean : false
3224             block = (#all | List of (extension | restriction))
3225             final = (#all | List of (extension | restriction))
3226             id = ID
3227             mixed = boolean : false
3228             name = NCName
3229             {any attributes with non-schema namespace ...}>
3230             Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))
3231              
3232             =cut
3233              
3234             #===============================================================================
3235              
3236             =item $Object = Rinchi::XMLSchema::ComplexType->new();
3237              
3238             Create a new Rinchi::XMLSchema::ComplexType object.
3239              
3240             =cut
3241              
3242             sub new() {
3243             my $class = shift;
3244             $class = ref($class) || $class;
3245             my $self = {};
3246             bless($self,$class);
3247             $self->{'_content_'} = [];
3248             return $self;
3249             }
3250              
3251             #===============================================================================
3252             # Rinchi::XMLSchema::ComplexType::abstract
3253              
3254             =item $value = $Object->abstract([$new_value]);
3255              
3256             Set or get value of the 'abstract' attribute.
3257              
3258             =cut
3259              
3260             sub abstract() {
3261             my $self = shift;
3262             if (@_) {
3263             if ($_[0] =~ /^true|false$/) {
3264             $self->{'_abstract'} = shift;
3265             } else {
3266             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
3267             }
3268             }
3269             return $self->{'_abstract'};
3270             }
3271              
3272             #===============================================================================
3273             # Rinchi::XMLSchema::ComplexType::block
3274              
3275             =item $value = $Object->block([$new_value]);
3276              
3277             Set or get value of the 'block' attribute.
3278              
3279             =cut
3280              
3281             sub block() {
3282             my $self = shift;
3283             if (@_) {
3284             $self->{'_block'} = shift;
3285             }
3286             return $self->{'_block'};
3287             }
3288              
3289             #===============================================================================
3290             # Rinchi::XMLSchema::ComplexType::final
3291              
3292             =item $value = $Object->final([$new_value]);
3293              
3294             Set or get value of the 'final' attribute.
3295              
3296             =cut
3297              
3298             sub final() {
3299             my $self = shift;
3300             if (@_) {
3301             $self->{'_final'} = shift;
3302             }
3303             return $self->{'_final'};
3304             }
3305              
3306             #===============================================================================
3307             # Rinchi::XMLSchema::ComplexType::id
3308              
3309             =item $value = $Object->id([$new_value]);
3310              
3311             Set or get value of the 'id' attribute.
3312              
3313             =cut
3314              
3315             sub id() {
3316             my $self = shift;
3317             if (@_) {
3318             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
3319             $self->{'_id'} = shift;
3320             } else {
3321             carp 'Found value \'' . $_[0] . '\', expecting ID.'
3322             }
3323             }
3324             return $self->{'_id'};
3325             }
3326              
3327             #===============================================================================
3328             # Rinchi::XMLSchema::ComplexType::mixed
3329              
3330             =item $value = $Object->mixed([$new_value]);
3331              
3332             Set or get value of the 'mixed' attribute.
3333              
3334             =cut
3335              
3336             sub mixed() {
3337             my $self = shift;
3338             if (@_) {
3339             if ($_[0] =~ /^true|false$/) {
3340             $self->{'_mixed'} = shift;
3341             } else {
3342             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
3343             }
3344             }
3345             return $self->{'_mixed'};
3346             }
3347              
3348             #===============================================================================
3349             # Rinchi::XMLSchema::ComplexType::name
3350              
3351             =item $value = $Object->name([$new_value]);
3352              
3353             Set or get value of the 'name' attribute.
3354              
3355             =cut
3356              
3357             sub name() {
3358             my $self = shift;
3359             if (@_) {
3360             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
3361             $self->{'_name'} = shift;
3362             } else {
3363             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
3364             }
3365             }
3366             return $self->{'_name'};
3367             }
3368              
3369             #===============================================================================
3370             # Rinchi::XMLSchema::ComplexType::sameAs
3371              
3372             =item $value = $Object->sameAs($other);
3373              
3374             Compares self to other returning 1 if they are the same, 0 otherwise;
3375              
3376             =cut
3377              
3378             sub sameAs() {
3379             my $self = shift @_;
3380             my $other = shift @_;
3381            
3382             return 0 unless (ref($other) eq ref($self));
3383              
3384             if (exists($self->{'_abstract'})) {
3385             if (exists($other->{'_abstract'})) {
3386             return 0 unless ($self->{'_abstract'} eq $other->{'_abstract'});
3387             } else {
3388             return 0;
3389             }
3390             } else {
3391             return 0 if (exists($other->{'_abstract'}));
3392             }
3393              
3394             if (exists($self->{'_block'})) {
3395             if (exists($other->{'_block'})) {
3396             return 0 unless ($self->{'_block'} eq $other->{'_block'});
3397             } else {
3398             return 0;
3399             }
3400             } else {
3401             return 0 if (exists($other->{'_block'}));
3402             }
3403              
3404             if (exists($self->{'_final'})) {
3405             if (exists($other->{'_final'})) {
3406             return 0 unless ($self->{'_final'} eq $other->{'_final'});
3407             } else {
3408             return 0;
3409             }
3410             } else {
3411             return 0 if (exists($other->{'_final'}));
3412             }
3413              
3414             if (exists($self->{'_mixed'})) {
3415             if (exists($other->{'_mixed'})) {
3416             return 0 unless ($self->{'_mixed'} eq $other->{'_mixed'});
3417             } else {
3418             return 0;
3419             }
3420             } else {
3421             return 0 if (exists($other->{'_mixed'}));
3422             }
3423              
3424             if (exists($self->{'_name'})) {
3425             if (exists($other->{'_name'})) {
3426             return 0 unless ($self->{'_name'} eq $other->{'_name'});
3427             } else {
3428             return 0;
3429             }
3430             } else {
3431             return 0 if (exists($other->{'_name'}));
3432             }
3433              
3434             my @self_cont = @{$self->{'_content_'}};
3435             my @other_cont = @{$other->{'_content_'}};
3436            
3437             shift @self_cont if(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
3438             shift @other_cont if(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
3439            
3440             if (@self_cont) {
3441             if (@other_cont) {
3442             while (@self_cont and @other_cont) {
3443             my $sc = shift @self_cont;
3444             my $oc = shift @other_cont;
3445            
3446             return 0 unless($sc->sameAs($oc));
3447             }
3448             return (0) if (@self_cont or @other_cont);
3449             } else {
3450             return 0;
3451             }
3452             } else {
3453             return 0 if (@other_cont);
3454             }
3455            
3456             return 1;
3457             }
3458              
3459             #===============================================================================
3460              
3461             package Rinchi::XMLSchema::Documentation;
3462              
3463             use Carp;
3464              
3465             our @ISA = qw(Rinchi::XMLSchema);
3466              
3467             our @EXPORT = qw();
3468             our @EXPORT_OK = qw();
3469              
3470             =head1 DESCRIPTION of Documentation class
3471              
3472             Rinchi::XMLSchema::Documentation is used for creating XML Schema Documentation objects.
3473              
3474             source = anyURI
3475             xml:lang = language
3476             {any attributes with non-schema namespace ...}>
3477             Content: ({any})*
3478              
3479             =cut
3480              
3481             #===============================================================================
3482              
3483             =item $Object = Rinchi::XMLSchema::Documentation->new();
3484              
3485             Create a new Rinchi::XMLSchema::Documentation object.
3486              
3487             =cut
3488              
3489             sub new() {
3490             my $class = shift;
3491             $class = ref($class) || $class;
3492             my $self = {};
3493             bless($self,$class);
3494             $self->{'_content_'} = [];
3495             return $self;
3496             }
3497              
3498             #===============================================================================
3499             # Rinchi::XMLSchema::Documentation::id
3500              
3501             =item $value = $Object->id([$new_value]);
3502              
3503             Set or get value of the 'id' attribute.
3504              
3505             =cut
3506              
3507             sub id() {
3508             my $self = shift;
3509             if (@_) {
3510             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
3511             $self->{'_id'} = shift;
3512             } else {
3513             carp 'Found value \'' . $_[0] . '\', expecting ID.'
3514             }
3515             }
3516             return $self->{'_id'};
3517             }
3518              
3519             #===============================================================================
3520             # Rinchi::XMLSchema::Documentation::source
3521              
3522             =item $value = $Object->source([$new_value]);
3523              
3524             Set or get value of the 'source' attribute.
3525              
3526             =cut
3527              
3528             sub source() {
3529             my $self = shift;
3530             if (@_) {
3531             $self->{'_source'} = shift;
3532             }
3533             return $self->{'_source'};
3534             }
3535              
3536             #===============================================================================
3537             # Rinchi::XMLSchema::Documentation::xml:lang
3538              
3539             =item $value = $Object->xml_lang([$new_value]);
3540              
3541             Set or get value of the 'xml:lang' attribute.
3542              
3543             =cut
3544              
3545             sub xml_lang() {
3546             my $self = shift;
3547             if (@_) {
3548             $self->{'_xml:lang'} = shift;
3549             }
3550             return $self->{'_xml:lang'};
3551             }
3552              
3553             #===============================================================================
3554              
3555             package Rinchi::XMLSchema::Element;
3556              
3557             use Carp;
3558              
3559             our @ISA = qw(Rinchi::XMLSchema);
3560              
3561             our @EXPORT = qw();
3562             our @EXPORT_OK = qw();
3563              
3564             =head1 DESCRIPTION of Element class
3565              
3566             Rinchi::XMLSchema::Element is used for creating XML Schema Element objects.
3567              
3568             abstract = boolean : false
3569             block = (#all | List of (extension | restriction | substitution))
3570             default = string
3571             final = (#all | List of (extension | restriction))
3572             fixed = string
3573             form = (qualified | unqualified)
3574             id = ID
3575             maxOccurs = (nonNegativeInteger | unbounded) : 1
3576             minOccurs = nonNegativeInteger : 1
3577             name = NCName
3578             nillable = boolean : false
3579             ref = QName
3580             substitutionGroup = QName
3581             type = QName
3582             {any attributes with non-schema namespace ...}>
3583             Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))
3584              
3585             =cut
3586              
3587             #===============================================================================
3588              
3589             =item $Object = Rinchi::XMLSchema::Element->new();
3590              
3591             Create a new Rinchi::XMLSchema::Element object.
3592              
3593             =cut
3594              
3595             sub new() {
3596             my $class = shift;
3597             $class = ref($class) || $class;
3598             my $self = {};
3599             bless($self,$class);
3600             $self->{'_content_'} = [];
3601             return $self;
3602             }
3603              
3604             #===============================================================================
3605             # Rinchi::XMLSchema::Element::abstract
3606              
3607             =item $value = $Object->abstract([$new_value]);
3608              
3609             Set or get value of the 'abstract' attribute.
3610              
3611             =cut
3612              
3613             sub abstract() {
3614             my $self = shift;
3615             if (@_) {
3616             if ($_[0] =~ /^true|false$/) {
3617             $self->{'_abstract'} = shift;
3618             } else {
3619             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
3620             }
3621             }
3622             return $self->{'_abstract'};
3623             }
3624              
3625             #===============================================================================
3626             # Rinchi::XMLSchema::Element::block
3627              
3628             =item $value = $Object->block([$new_value]);
3629              
3630             Set or get value of the 'block' attribute.
3631              
3632             =cut
3633              
3634             sub block() {
3635             my $self = shift;
3636             if (@_) {
3637             $self->{'_block'} = shift;
3638             }
3639             return $self->{'_block'};
3640             }
3641              
3642             #===============================================================================
3643             # Rinchi::XMLSchema::Element::default
3644              
3645             =item $value = $Object->default([$new_value]);
3646              
3647             Set or get value of the 'default' attribute.
3648              
3649             =cut
3650              
3651             sub default() {
3652             my $self = shift;
3653             if (@_) {
3654             $self->{'_default'} = shift;
3655             }
3656             return $self->{'_default'};
3657             }
3658              
3659             #===============================================================================
3660             # Rinchi::XMLSchema::Element::final
3661              
3662             =item $value = $Object->final([$new_value]);
3663              
3664             Set or get value of the 'final' attribute.
3665              
3666             =cut
3667              
3668             sub final() {
3669             my $self = shift;
3670             if (@_) {
3671             $self->{'_final'} = shift;
3672             }
3673             return $self->{'_final'};
3674             }
3675              
3676             #===============================================================================
3677             # Rinchi::XMLSchema::Element::fixed
3678              
3679             =item $value = $Object->fixed([$new_value]);
3680              
3681             Set or get value of the 'fixed' attribute.
3682              
3683             =cut
3684              
3685             sub fixed() {
3686             my $self = shift;
3687             if (@_) {
3688             $self->{'_fixed'} = shift;
3689             }
3690             return $self->{'_fixed'};
3691             }
3692              
3693             #===============================================================================
3694             # Rinchi::XMLSchema::Element::form
3695              
3696             =item $value = $Object->form([$new_value]);
3697              
3698             Set or get value of the 'form' attribute.
3699              
3700             =cut
3701              
3702             sub form() {
3703             my $self = shift;
3704             if (@_) {
3705             if ($_[0] =~ /^qualified|unqualified$/) {
3706             $self->{'_form'} = shift;
3707             } else {
3708             carp 'Found value \'' . $_[0] . '\', expecting value \'qualified | unqualified\'.'
3709             }
3710             }
3711             return $self->{'_form'};
3712             }
3713              
3714             #===============================================================================
3715             # Rinchi::XMLSchema::Element::id
3716              
3717             =item $value = $Object->id([$new_value]);
3718              
3719             Set or get value of the 'id' attribute.
3720              
3721             =cut
3722              
3723             sub id() {
3724             my $self = shift;
3725             if (@_) {
3726             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
3727             $self->{'_id'} = shift;
3728             } else {
3729             carp 'Found value \'' . $_[0] . '\', expecting ID.'
3730             }
3731             }
3732             return $self->{'_id'};
3733             }
3734              
3735             #===============================================================================
3736             # Rinchi::XMLSchema::Element::maxOccurs
3737              
3738             =item $value = $Object->maxOccurs([$new_value]);
3739              
3740             Set or get value of the 'maxOccurs' attribute.
3741              
3742             =cut
3743              
3744             sub maxOccurs() {
3745             my $self = shift;
3746             if (@_) {
3747             $self->{'_maxOccurs'} = shift;
3748             }
3749             return $self->{'_maxOccurs'};
3750             }
3751              
3752             #===============================================================================
3753             # Rinchi::XMLSchema::Element::minOccurs
3754              
3755             =item $value = $Object->minOccurs([$new_value]);
3756              
3757             Set or get value of the 'minOccurs' attribute.
3758              
3759             =cut
3760              
3761             sub minOccurs() {
3762             my $self = shift;
3763             if (@_) {
3764             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
3765             $self->{'_minOccurs'} = shift;
3766             } else {
3767             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
3768             }
3769             }
3770             return $self->{'_minOccurs'};
3771             }
3772              
3773             #===============================================================================
3774             # Rinchi::XMLSchema::Element::name
3775              
3776             =item $value = $Object->name([$new_value]);
3777              
3778             Set or get value of the 'name' attribute.
3779              
3780             =cut
3781              
3782             sub name() {
3783             my $self = shift;
3784             if (@_) {
3785             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
3786             $self->{'_name'} = shift;
3787             } else {
3788             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
3789             }
3790             }
3791             return $self->{'_name'};
3792             }
3793              
3794             #===============================================================================
3795             # Rinchi::XMLSchema::Element::nillable
3796              
3797             =item $value = $Object->nillable([$new_value]);
3798              
3799             Set or get value of the 'nillable' attribute.
3800              
3801             =cut
3802              
3803             sub nillable() {
3804             my $self = shift;
3805             if (@_) {
3806             if ($_[0] =~ /^true|false$/) {
3807             $self->{'_nillable'} = shift;
3808             } else {
3809             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
3810             }
3811             }
3812             return $self->{'_nillable'};
3813             }
3814              
3815             #===============================================================================
3816             # Rinchi::XMLSchema::Element::ref
3817              
3818             =item $value = $Object->ref([$new_value]);
3819              
3820             Set or get value of the 'ref' attribute.
3821              
3822             =cut
3823              
3824             sub ref() {
3825             my $self = shift;
3826             if (@_) {
3827             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
3828             $self->{'_ref'} = shift;
3829             } else {
3830             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
3831             }
3832             }
3833             return $self->{'_ref'};
3834             }
3835              
3836             #===============================================================================
3837             # Rinchi::XMLSchema::Element::substitutionGroup
3838              
3839             =item $value = $Object->substitutionGroup([$new_value]);
3840              
3841             Set or get value of the 'substitutionGroup' attribute.
3842              
3843             =cut
3844              
3845             sub substitutionGroup() {
3846             my $self = shift;
3847             if (@_) {
3848             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
3849             $self->{'_substitutionGroup'} = shift;
3850             } else {
3851             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
3852             }
3853             }
3854             return $self->{'_substitutionGroup'};
3855             }
3856              
3857             #===============================================================================
3858             # Rinchi::XMLSchema::Element::type
3859              
3860             =item $value = $Object->type([$new_value]);
3861              
3862             Set or get value of the 'type' attribute.
3863              
3864             =cut
3865              
3866             sub type() {
3867             my $self = shift;
3868             if (@_) {
3869             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
3870             $self->{'_type'} = shift;
3871             } else {
3872             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
3873             }
3874             }
3875             return $self->{'_type'};
3876             }
3877              
3878             #===============================================================================
3879             # Rinchi::XMLSchema::Element::sameAs
3880              
3881             =item $value = $Object->sameAs($other);
3882              
3883             Compares self to other returning 1 if they are the same, 0 otherwise;
3884              
3885             =cut
3886              
3887             sub sameAs() {
3888             my $self = shift @_;
3889             my $other = shift @_;
3890              
3891             return 0 unless (CORE::ref($other) eq CORE::ref($self));
3892              
3893             if (exists($self->{'_abstract'})) {
3894             if (exists($other->{'_abstract'})) {
3895             return 0 unless ($self->{'_abstract'} eq $other->{'_abstract'});
3896             } else {
3897             return 0;
3898             }
3899             } else {
3900             return 0 if (exists($other->{'_abstract'}));
3901             }
3902              
3903             if (exists($self->{'_block'})) {
3904             if (exists($other->{'_block'})) {
3905             return 0 unless ($self->{'_block'} eq $other->{'_block'});
3906             } else {
3907             return 0;
3908             }
3909             } else {
3910             return 0 if (exists($other->{'_block'}));
3911             }
3912              
3913             if (exists($self->{'_default'})) {
3914             if (exists($other->{'_default'})) {
3915             return 0 unless ($self->{'_default'} eq $other->{'_default'});
3916             } else {
3917             return 0;
3918             }
3919             } else {
3920             return 0 if (exists($other->{'_default'}));
3921             }
3922              
3923             if (exists($self->{'_final'})) {
3924             if (exists($other->{'_final'})) {
3925             return 0 unless ($self->{'_final'} eq $other->{'_final'});
3926             } else {
3927             return 0;
3928             }
3929             } else {
3930             return 0 if (exists($other->{'_final'}));
3931             }
3932              
3933             if (exists($self->{'_fixed'})) {
3934             if (exists($other->{'_fixed'})) {
3935             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
3936             } else {
3937             return 0;
3938             }
3939             } else {
3940             return 0 if (exists($other->{'_fixed'}));
3941             }
3942              
3943             if (exists($self->{'_form'})) {
3944             if (exists($other->{'_form'})) {
3945             return 0 unless ($self->{'_form'} eq $other->{'_form'});
3946             } else {
3947             return 0;
3948             }
3949             } else {
3950             return 0 if (exists($other->{'_form'}));
3951             }
3952              
3953             if (exists($self->{'_maxOccurs'})) {
3954             if (exists($other->{'_maxOccurs'})) {
3955             return 0 unless ($self->{'_maxOccurs'} eq $other->{'_maxOccurs'});
3956             } else {
3957             return 0;
3958             }
3959             } else {
3960             return 0 if (exists($other->{'_maxOccurs'}));
3961             }
3962              
3963             if (exists($self->{'_minOccurs'})) {
3964             if (exists($other->{'_minOccurs'})) {
3965             return 0 unless ($self->{'_minOccurs'} eq $other->{'_minOccurs'});
3966             } else {
3967             return 0;
3968             }
3969             } else {
3970             return 0 if (exists($other->{'_minOccurs'}));
3971             }
3972              
3973             if (exists($self->{'_name'})) {
3974             if (exists($other->{'_name'})) {
3975             return 0 unless ($self->{'_name'} eq $other->{'_name'});
3976             } else {
3977             return 0;
3978             }
3979             } else {
3980             return 0 if (exists($other->{'_name'}));
3981             }
3982              
3983             if (exists($self->{'_nillable'})) {
3984             if (exists($other->{'_nillable'})) {
3985             return 0 unless ($self->{'_nillable'} eq $other->{'_nillable'});
3986             } else {
3987             return 0;
3988             }
3989             } else {
3990             return 0 if (exists($other->{'_nillable'}));
3991             }
3992              
3993             if (exists($self->{'_ref'})) {
3994             if (exists($other->{'_ref'})) {
3995             return 0 unless ($self->{'_ref'} eq $other->{'_ref'});
3996             } else {
3997             return 0;
3998             }
3999             } else {
4000             return 0 if (exists($other->{'_ref'}));
4001             }
4002              
4003             if (exists($self->{'_substitutionGroup'})) {
4004             if (exists($other->{'_substitutionGroup'})) {
4005             return 0 unless ($self->{'_substitutionGroup'} eq $other->{'_substitutionGroup'});
4006             } else {
4007             return 0;
4008             }
4009             } else {
4010             return 0 if (exists($other->{'_substitutionGroup'}));
4011             }
4012              
4013             if (exists($self->{'_type'})) {
4014             if (exists($other->{'_type'})) {
4015             return 0 unless ($self->{'_type'} eq $other->{'_type'});
4016             } else {
4017             return 0;
4018             }
4019             } else {
4020             return 0 if (exists($other->{'_type'}));
4021             }
4022              
4023             my @self_cont = @{$self->{'_content_'}};
4024             my @other_cont = @{$other->{'_content_'}};
4025             shift @self_cont while(@self_cont and CORE::ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
4026             shift @other_cont while(@other_cont and CORE::ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
4027              
4028             if (@self_cont) {
4029             if (@other_cont) {
4030             while (@self_cont and @other_cont) {
4031             my $sc = shift @self_cont;
4032             my $oc = shift @other_cont;
4033             return 0 unless($sc->sameAs($oc));
4034             }
4035             return (0) if (@self_cont or @other_cont);
4036             } else {
4037             return 0;
4038             }
4039             } else {
4040             return 0 if (@other_cont);
4041             }
4042              
4043             return 1;
4044             }
4045              
4046             #===============================================================================
4047              
4048             package Rinchi::XMLSchema::Enumeration;
4049              
4050             use Carp;
4051              
4052             our @ISA = qw(Rinchi::XMLSchema);
4053              
4054             our @EXPORT = qw();
4055             our @EXPORT_OK = qw();
4056              
4057             =head1 DESCRIPTION of Enumeration class
4058              
4059             Rinchi::XMLSchema::Enumeration is used for creating XML Schema Enumeration objects.
4060              
4061             =cut
4062              
4063             #===============================================================================
4064              
4065             =item $Object = Rinchi::XMLSchema::Enumeration->new();
4066              
4067             Create a new Rinchi::XMLSchema::Enumeration object.
4068              
4069             =cut
4070              
4071             sub new() {
4072             my $class = shift;
4073             $class = ref($class) || $class;
4074             my $self = {};
4075             bless($self,$class);
4076             $self->{'_content_'} = [];
4077             return $self;
4078             }
4079              
4080             #===============================================================================
4081             # Rinchi::XMLSchema::Enumeration::id
4082              
4083             =item $value = $Object->id([$new_value]);
4084              
4085             Set or get value of the 'id' attribute.
4086              
4087             =cut
4088              
4089             sub id() {
4090             my $self = shift;
4091             if (@_) {
4092             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
4093             $self->{'_id'} = shift;
4094             } else {
4095             carp 'Found value \'' . $_[0] . '\', expecting ID.'
4096             }
4097             }
4098             return $self->{'_id'};
4099             }
4100              
4101             #===============================================================================
4102             # Rinchi::XMLSchema::Enumeration::value
4103              
4104             =item $value = $Object->value([$new_value]);
4105              
4106             Set or get value of the 'value' attribute.
4107              
4108             =cut
4109              
4110             sub value() {
4111             my $self = shift;
4112             if (@_) {
4113             $self->{'_value'} = shift;
4114             }
4115             return $self->{'_value'};
4116             }
4117              
4118             #===============================================================================
4119             # Rinchi::XMLSchema::Enumeration::sameAs
4120              
4121             =item $value = $Object->sameAs($other);
4122              
4123             Compares self to other returning 1 if they are the same, 0 otherwise;
4124              
4125             =cut
4126              
4127             sub sameAs() {
4128             my $self = shift @_;
4129             my $other = shift @_;
4130              
4131             return 0 unless (ref($other) eq ref($self));
4132              
4133             if (exists($self->{'_value'})) {
4134             if (exists($other->{'_value'})) {
4135             return 0 unless ($self->{'_value'} eq $other->{'_value'});
4136             } else {
4137             return 0;
4138             }
4139             } else {
4140             return 0 if (exists($other->{'_value'}));
4141             }
4142              
4143             return 1;
4144             }
4145              
4146             #===============================================================================
4147              
4148             package Rinchi::XMLSchema::Extension;
4149              
4150             use Carp;
4151              
4152             our @ISA = qw(Rinchi::XMLSchema);
4153              
4154             our @EXPORT = qw();
4155             our @EXPORT_OK = qw();
4156              
4157             =head1 DESCRIPTION of Extension class
4158              
4159             Rinchi::XMLSchema::Extension is used for creating XML Schema Extension objects.
4160              
4161             =cut
4162              
4163             #===============================================================================
4164              
4165             =item $Object = Rinchi::XMLSchema::Extension->new();
4166              
4167             Create a new Rinchi::XMLSchema::Extension object.
4168              
4169             =cut
4170              
4171             sub new() {
4172             my $class = shift;
4173             $class = ref($class) || $class;
4174             my $self = {};
4175             bless($self,$class);
4176             $self->{'_content_'} = [];
4177             return $self;
4178             }
4179              
4180             #===============================================================================
4181             # Rinchi::XMLSchema::Extension::base
4182              
4183             =item $value = $Object->base([$new_value]);
4184              
4185             Set or get value of the 'base' attribute.
4186              
4187             =cut
4188              
4189             sub base() {
4190             my $self = shift;
4191             if (@_) {
4192             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
4193             $self->{'_base'} = shift;
4194             } else {
4195             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
4196             }
4197             }
4198             return $self->{'_base'};
4199             }
4200              
4201             #===============================================================================
4202             # Rinchi::XMLSchema::Extension::id
4203              
4204             =item $value = $Object->id([$new_value]);
4205              
4206             Set or get value of the 'id' attribute.
4207              
4208             =cut
4209              
4210             sub id() {
4211             my $self = shift;
4212             if (@_) {
4213             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
4214             $self->{'_id'} = shift;
4215             } else {
4216             carp 'Found value \'' . $_[0] . '\', expecting ID.'
4217             }
4218             }
4219             return $self->{'_id'};
4220             }
4221              
4222             #===============================================================================
4223             # Rinchi::XMLSchema::Extension::sameAs
4224              
4225             =item $value = $Object->sameAs($other);
4226              
4227             Compares self to other returning 1 if they are the same, 0 otherwise;
4228              
4229             =cut
4230              
4231             sub sameAs() {
4232             my $self = shift @_;
4233             my $other = shift @_;
4234              
4235             return 0 unless (ref($other) eq ref($self));
4236              
4237             if (exists($self->{'_base'})) {
4238             if (exists($other->{'_base'})) {
4239             return 0 unless ($self->{'_base'} eq $other->{'_base'});
4240             } else {
4241             return 0;
4242             }
4243             } else {
4244             return 0 if (exists($other->{'_base'}));
4245             }
4246              
4247             my @self_cont = @{$self->{'_content_'}};
4248             my @other_cont = @{$other->{'_content_'}};
4249             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
4250             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
4251              
4252             if (@self_cont) {
4253             if (@other_cont) {
4254             while (@self_cont and @other_cont) {
4255             my $sc = shift @self_cont;
4256             my $oc = shift @other_cont;
4257             return 0 unless($sc->sameAs($oc));
4258             }
4259             return (0) if (@self_cont or @other_cont);
4260             } else {
4261             return 0;
4262             }
4263             } else {
4264             return 0 if (@other_cont);
4265             }
4266              
4267             return 1;
4268             }
4269              
4270             #===============================================================================
4271              
4272             package Rinchi::XMLSchema::Field;
4273              
4274             use Carp;
4275              
4276             our @ISA = qw(Rinchi::XMLSchema);
4277              
4278             our @EXPORT = qw();
4279             our @EXPORT_OK = qw();
4280              
4281             =head1 DESCRIPTION of Field class
4282              
4283             Rinchi::XMLSchema::Field is used for creating XML Schema Field objects.
4284              
4285             id = ID
4286             xpath = a subset of XPath expression, see below
4287             {any attributes with non-schema namespace ...}>
4288             Content: (annotation?)
4289              
4290             =cut
4291              
4292             #===============================================================================
4293              
4294             =item $Object = Rinchi::XMLSchema::Field->new();
4295              
4296             Create a new Rinchi::XMLSchema::Field object.
4297              
4298             =cut
4299              
4300             sub new() {
4301             my $class = shift;
4302             $class = ref($class) || $class;
4303             my $self = {};
4304             bless($self,$class);
4305             $self->{'_content_'} = [];
4306             return $self;
4307             }
4308              
4309             #===============================================================================
4310             # Rinchi::XMLSchema::Field::id
4311              
4312             =item $value = $Object->id([$new_value]);
4313              
4314             Set or get value of the 'id' attribute.
4315              
4316             =cut
4317              
4318             sub id() {
4319             my $self = shift;
4320             if (@_) {
4321             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
4322             $self->{'_id'} = shift;
4323             } else {
4324             carp 'Found value \'' . $_[0] . '\', expecting ID.'
4325             }
4326             }
4327             return $self->{'_id'};
4328             }
4329              
4330             #===============================================================================
4331             # Rinchi::XMLSchema::Field::xpath
4332              
4333             =item $value = $Object->xpath([$new_value]);
4334              
4335             Set or get value of the 'xpath' attribute.
4336              
4337             =cut
4338              
4339             sub xpath() {
4340             my $self = shift;
4341             if (@_) {
4342             $self->{'_xpath'} = shift;
4343             }
4344             return $self->{'_xpath'};
4345             }
4346              
4347             #===============================================================================
4348             # Rinchi::XMLSchema::Field::sameAs
4349              
4350             =item $value = $Object->sameAs($other);
4351              
4352             Compares self to other returning 1 if they are the same, 0 otherwise;
4353              
4354             =cut
4355              
4356             sub sameAs() {
4357             my $self = shift @_;
4358             my $other = shift @_;
4359              
4360             return 0 unless (ref($other) eq ref($self));
4361              
4362             if (exists($self->{'_xpath'})) {
4363             if (exists($other->{'_xpath'})) {
4364             return 0 unless ($self->{'_xpath'} eq $other->{'_xpath'});
4365             } else {
4366             return 0;
4367             }
4368             } else {
4369             return 0 if (exists($other->{'_xpath'}));
4370             }
4371              
4372             return 1;
4373             }
4374              
4375             #===============================================================================
4376              
4377             package Rinchi::XMLSchema::FractionDigits;
4378              
4379             use Carp;
4380              
4381             our @ISA = qw(Rinchi::XMLSchema);
4382              
4383             our @EXPORT = qw();
4384             our @EXPORT_OK = qw();
4385              
4386             =head1 DESCRIPTION of FractionDigits class
4387              
4388             Rinchi::XMLSchema::FractionDigits is used for creating XML Schema FractionDigits objects.
4389              
4390             =cut
4391              
4392             #===============================================================================
4393              
4394             =item $Object = Rinchi::XMLSchema::FractionDigits->new();
4395              
4396             Create a new Rinchi::XMLSchema::FractionDigits object.
4397              
4398             =cut
4399              
4400             sub new() {
4401             my $class = shift;
4402             $class = ref($class) || $class;
4403             my $self = {};
4404             bless($self,$class);
4405             $self->{'_content_'} = [];
4406             return $self;
4407             }
4408              
4409             #===============================================================================
4410             # Rinchi::XMLSchema::FractionDigits::fixed
4411              
4412             =item $value = $Object->fixed([$new_value]);
4413              
4414             Set or get value of the 'fixed' attribute.
4415              
4416             =cut
4417              
4418             sub fixed() {
4419             my $self = shift;
4420             if (@_) {
4421             if ($_[0] =~ /^true|false$/) {
4422             $self->{'_fixed'} = shift;
4423             } else {
4424             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
4425             }
4426             }
4427             return $self->{'_fixed'};
4428             }
4429              
4430             #===============================================================================
4431             # Rinchi::XMLSchema::FractionDigits::id
4432              
4433             =item $value = $Object->id([$new_value]);
4434              
4435             Set or get value of the 'id' attribute.
4436              
4437             =cut
4438              
4439             sub id() {
4440             my $self = shift;
4441             if (@_) {
4442             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
4443             $self->{'_id'} = shift;
4444             } else {
4445             carp 'Found value \'' . $_[0] . '\', expecting ID.'
4446             }
4447             }
4448             return $self->{'_id'};
4449             }
4450              
4451             #===============================================================================
4452             # Rinchi::XMLSchema::FractionDigits::value
4453              
4454             =item $value = $Object->value([$new_value]);
4455              
4456             Set or get value of the 'value' attribute.
4457              
4458             =cut
4459              
4460             sub value() {
4461             my $self = shift;
4462             if (@_) {
4463             $self->{'_value'} = shift;
4464             }
4465             return $self->{'_value'};
4466             }
4467              
4468             #===============================================================================
4469             # Rinchi::XMLSchema::FractionDigits::sameAs
4470              
4471             =item $value = $Object->sameAs($other);
4472              
4473             Compares self to other returning 1 if they are the same, 0 otherwise;
4474              
4475             =cut
4476              
4477             sub sameAs() {
4478             my $self = shift @_;
4479             my $other = shift @_;
4480              
4481             return 0 unless (ref($other) eq ref($self));
4482              
4483             if (exists($self->{'_fixed'})) {
4484             if (exists($other->{'_fixed'})) {
4485             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
4486             } else {
4487             return 0;
4488             }
4489             } else {
4490             return 0 if (exists($other->{'_fixed'}));
4491             }
4492              
4493             if (exists($self->{'_value'})) {
4494             if (exists($other->{'_value'})) {
4495             return 0 unless ($self->{'_value'} eq $other->{'_value'});
4496             } else {
4497             return 0;
4498             }
4499             } else {
4500             return 0 if (exists($other->{'_value'}));
4501             }
4502              
4503             return 1;
4504             }
4505              
4506             #===============================================================================
4507              
4508             package Rinchi::XMLSchema::Group;
4509              
4510             use Carp;
4511              
4512             our @ISA = qw(Rinchi::XMLSchema);
4513              
4514             our @EXPORT = qw();
4515             our @EXPORT_OK = qw();
4516              
4517             =head1 DESCRIPTION of Group class
4518              
4519             Rinchi::XMLSchema::Group is used for creating XML Schema Group objects.
4520              
4521             id = ID
4522             maxOccurs = (nonNegativeInteger | unbounded) : 1
4523             minOccurs = nonNegativeInteger : 1
4524             name = NCName
4525             ref = QName
4526             {any attributes with non-schema namespace ...}>
4527             Content: (annotation?, (all | choice | sequence)?)
4528              
4529             =cut
4530              
4531             #===============================================================================
4532              
4533             =item $Object = Rinchi::XMLSchema::Group->new();
4534              
4535             Create a new Rinchi::XMLSchema::Group object.
4536              
4537             =cut
4538              
4539             sub new() {
4540             my $class = shift;
4541             $class = ref($class) || $class;
4542             my $self = {};
4543             bless($self,$class);
4544             $self->{'_content_'} = [];
4545             return $self;
4546             }
4547              
4548             #===============================================================================
4549             # Rinchi::XMLSchema::Group::id
4550              
4551             =item $value = $Object->id([$new_value]);
4552              
4553             Set or get value of the 'id' attribute.
4554              
4555             =cut
4556              
4557             sub id() {
4558             my $self = shift;
4559             if (@_) {
4560             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
4561             $self->{'_id'} = shift;
4562             } else {
4563             carp 'Found value \'' . $_[0] . '\', expecting ID.'
4564             }
4565             }
4566             return $self->{'_id'};
4567             }
4568              
4569             #===============================================================================
4570             # Rinchi::XMLSchema::Group::maxOccurs
4571              
4572             =item $value = $Object->maxOccurs([$new_value]);
4573              
4574             Set or get value of the 'maxOccurs' attribute.
4575              
4576             =cut
4577              
4578             sub maxOccurs() {
4579             my $self = shift;
4580             if (@_) {
4581             $self->{'_maxOccurs'} = shift;
4582             }
4583             return $self->{'_maxOccurs'};
4584             }
4585              
4586             #===============================================================================
4587             # Rinchi::XMLSchema::Group::minOccurs
4588              
4589             =item $value = $Object->minOccurs([$new_value]);
4590              
4591             Set or get value of the 'minOccurs' attribute.
4592              
4593             =cut
4594              
4595             sub minOccurs() {
4596             my $self = shift;
4597             if (@_) {
4598             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
4599             $self->{'_minOccurs'} = shift;
4600             } else {
4601             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
4602             }
4603             }
4604             return $self->{'_minOccurs'};
4605             }
4606              
4607             #===============================================================================
4608             # Rinchi::XMLSchema::Group::name
4609              
4610             =item $value = $Object->name([$new_value]);
4611              
4612             Set or get value of the 'name' attribute.
4613              
4614             =cut
4615              
4616             sub name() {
4617             my $self = shift;
4618             if (@_) {
4619             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
4620             $self->{'_name'} = shift;
4621             } else {
4622             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
4623             }
4624             }
4625             return $self->{'_name'};
4626             }
4627              
4628             #===============================================================================
4629             # Rinchi::XMLSchema::Group::ref
4630              
4631             =item $value = $Object->ref([$new_value]);
4632              
4633             Set or get value of the 'ref' attribute.
4634              
4635             =cut
4636              
4637             sub ref() {
4638             my $self = shift;
4639             if (@_) {
4640             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
4641             $self->{'_ref'} = shift;
4642             } else {
4643             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
4644             }
4645             }
4646             return $self->{'_ref'};
4647             }
4648              
4649             #===============================================================================
4650             # Rinchi::XMLSchema::Group::sameAs
4651              
4652             =item $value = $Object->sameAs($other);
4653              
4654             Compares self to other returning 1 if they are the same, 0 otherwise;
4655              
4656             =cut
4657              
4658             sub sameAs() {
4659             my $self = shift @_;
4660             my $other = shift @_;
4661              
4662             return 0 unless (CORE::ref($other) eq CORE::ref($self));
4663              
4664             if (exists($self->{'_maxOccurs'})) {
4665             if (exists($other->{'_maxOccurs'})) {
4666             return 0 unless ($self->{'_maxOccurs'} eq $other->{'_maxOccurs'});
4667             } else {
4668             return 0;
4669             }
4670             } else {
4671             return 0 if (exists($other->{'_maxOccurs'}));
4672             }
4673              
4674             if (exists($self->{'_minOccurs'})) {
4675             if (exists($other->{'_minOccurs'})) {
4676             return 0 unless ($self->{'_minOccurs'} eq $other->{'_minOccurs'});
4677             } else {
4678             return 0;
4679             }
4680             } else {
4681             return 0 if (exists($other->{'_minOccurs'}));
4682             }
4683              
4684             if (exists($self->{'_name'})) {
4685             if (exists($other->{'_name'})) {
4686             return 0 unless ($self->{'_name'} eq $other->{'_name'});
4687             } else {
4688             return 0;
4689             }
4690             } else {
4691             return 0 if (exists($other->{'_name'}));
4692             }
4693              
4694             if (exists($self->{'_ref'})) {
4695             if (exists($other->{'_ref'})) {
4696             return 0 unless ($self->{'_ref'} eq $other->{'_ref'});
4697             } else {
4698             return 0;
4699             }
4700             } else {
4701             return 0 if (exists($other->{'_ref'}));
4702             }
4703              
4704             my @self_cont = @{$self->{'_content_'}};
4705             my @other_cont = @{$other->{'_content_'}};
4706             shift @self_cont while(@self_cont and CORE::ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
4707             shift @other_cont while(@other_cont and CORE::ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
4708              
4709             if (@self_cont) {
4710             if (@other_cont) {
4711             while (@self_cont and @other_cont) {
4712             my $sc = shift @self_cont;
4713             my $oc = shift @other_cont;
4714             return 0 unless($sc->sameAs($oc));
4715             }
4716             return (0) if (@self_cont or @other_cont);
4717             } else {
4718             return 0;
4719             }
4720             } else {
4721             return 0 if (@other_cont);
4722             }
4723              
4724             return 1;
4725             }
4726              
4727             #===============================================================================
4728              
4729             package Rinchi::XMLSchema::Import;
4730              
4731             use Carp;
4732              
4733             our @ISA = qw(Rinchi::XMLSchema);
4734              
4735             our @EXPORT = qw();
4736             our @EXPORT_OK = qw();
4737              
4738             =head1 DESCRIPTION of Import class
4739              
4740             Rinchi::XMLSchema::Import is used for creating XML Schema Import objects.
4741              
4742             id = ID
4743             namespace = anyURI
4744             schemaLocation = anyURI
4745             {any attributes with non-schema namespace . . .}>
4746             Content: (annotation?)
4747              
4748             =cut
4749              
4750             #===============================================================================
4751              
4752             =item $Object = Rinchi::XMLSchema::Import->new();
4753              
4754             Create a new Rinchi::XMLSchema::Import object.
4755              
4756             =cut
4757              
4758             sub new() {
4759             my $class = shift;
4760             $class = ref($class) || $class;
4761             my $self = {};
4762             bless($self,$class);
4763             $self->{'_content_'} = [];
4764             return $self;
4765             }
4766              
4767             #===============================================================================
4768             # Rinchi::XMLSchema::Import::id
4769              
4770             =item $value = $Object->id([$new_value]);
4771              
4772             Set or get value of the 'id' attribute.
4773              
4774             =cut
4775              
4776             sub id() {
4777             my $self = shift;
4778             if (@_) {
4779             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
4780             $self->{'_id'} = shift;
4781             } else {
4782             carp 'Found value \'' . $_[0] . '\', expecting ID.'
4783             }
4784             }
4785             return $self->{'_id'};
4786             }
4787              
4788             #===============================================================================
4789             # Rinchi::XMLSchema::Import::namespace
4790              
4791             =item $value = $Object->namespace([$new_value]);
4792              
4793             Set or get value of the 'namespace' attribute.
4794              
4795             =cut
4796              
4797             sub namespace() {
4798             my $self = shift;
4799             if (@_) {
4800             $self->{'_namespace'} = shift;
4801             }
4802             return $self->{'_namespace'};
4803             }
4804              
4805             #===============================================================================
4806             # Rinchi::XMLSchema::Import::schemaLocation
4807              
4808             =item $value = $Object->schemaLocation([$new_value]);
4809              
4810             Set or get value of the 'schemaLocation' attribute.
4811              
4812             =cut
4813              
4814             sub schemaLocation() {
4815             my $self = shift;
4816             if (@_) {
4817             $self->{'_schemaLocation'} = shift;
4818             }
4819             return $self->{'_schemaLocation'};
4820             }
4821              
4822             #===============================================================================
4823             # Rinchi::XMLSchema::Import::sameAs
4824              
4825             =item $value = $Object->sameAs($other);
4826              
4827             Compares self to other returning 1 if they are the same, 0 otherwise;
4828              
4829             =cut
4830              
4831             sub sameAs() {
4832             my $self = shift @_;
4833             my $other = shift @_;
4834              
4835             return 0 unless (ref($other) eq ref($self));
4836              
4837             if (exists($self->{'_namespace'})) {
4838             if (exists($other->{'_namespace'})) {
4839             return 0 unless ($self->{'_namespace'} eq $other->{'_namespace'});
4840             } else {
4841             return 0;
4842             }
4843             } else {
4844             return 0 if (exists($other->{'_namespace'}));
4845             }
4846              
4847             if (exists($self->{'_schemaLocation'})) {
4848             if (exists($other->{'_schemaLocation'})) {
4849             return 0 unless ($self->{'_schemaLocation'} eq $other->{'_schemaLocation'});
4850             } else {
4851             return 0;
4852             }
4853             } else {
4854             return 0 if (exists($other->{'_schemaLocation'}));
4855             }
4856              
4857             return 1;
4858             }
4859              
4860             #===============================================================================
4861              
4862             package Rinchi::XMLSchema::Include;
4863              
4864             use Carp;
4865              
4866             our @ISA = qw(Rinchi::XMLSchema);
4867              
4868             our @EXPORT = qw();
4869             our @EXPORT_OK = qw();
4870              
4871             =head1 DESCRIPTION of Include class
4872              
4873             Rinchi::XMLSchema::Include is used for creating XML Schema Include objects.
4874              
4875             id = ID
4876             schemaLocation = anyURI
4877             {any attributes with non-schema namespace . . .}>
4878             Content: (annotation?)
4879              
4880             =cut
4881              
4882             #===============================================================================
4883              
4884             =item $Object = Rinchi::XMLSchema::Include->new();
4885              
4886             Create a new Rinchi::XMLSchema::Include object.
4887              
4888             =cut
4889              
4890             sub new() {
4891             my $class = shift;
4892             $class = ref($class) || $class;
4893             my $self = {};
4894             bless($self,$class);
4895             $self->{'_content_'} = [];
4896             return $self;
4897             }
4898              
4899             #===============================================================================
4900             # Rinchi::XMLSchema::Include::id
4901              
4902             =item $value = $Object->id([$new_value]);
4903              
4904             Set or get value of the 'id' attribute.
4905              
4906             =cut
4907              
4908             sub id() {
4909             my $self = shift;
4910             if (@_) {
4911             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
4912             $self->{'_id'} = shift;
4913             } else {
4914             carp 'Found value \'' . $_[0] . '\', expecting ID.'
4915             }
4916             }
4917             return $self->{'_id'};
4918             }
4919              
4920             #===============================================================================
4921             # Rinchi::XMLSchema::Include::schemaLocation
4922              
4923             =item $value = $Object->schemaLocation([$new_value]);
4924              
4925             Set or get value of the 'schemaLocation' attribute.
4926              
4927             =cut
4928              
4929             sub schemaLocation() {
4930             my $self = shift;
4931             if (@_) {
4932             $self->{'_schemaLocation'} = shift;
4933             }
4934             return $self->{'_schemaLocation'};
4935             }
4936              
4937             #===============================================================================
4938             # Rinchi::XMLSchema::Include::sameAs
4939              
4940             =item $value = $Object->sameAs($other);
4941              
4942             Compares self to other returning 1 if they are the same, 0 otherwise;
4943              
4944             =cut
4945              
4946             sub sameAs() {
4947             my $self = shift @_;
4948             my $other = shift @_;
4949              
4950             return 0 unless (ref($other) eq ref($self));
4951              
4952             if (exists($self->{'_schemaLocation'})) {
4953             if (exists($other->{'_schemaLocation'})) {
4954             return 0 unless ($self->{'_schemaLocation'} eq $other->{'_schemaLocation'});
4955             } else {
4956             return 0;
4957             }
4958             } else {
4959             return 0 if (exists($other->{'_schemaLocation'}));
4960             }
4961              
4962             return 1;
4963             }
4964              
4965             #===============================================================================
4966              
4967             package Rinchi::XMLSchema::Key;
4968              
4969             use Carp;
4970              
4971             our @ISA = qw(Rinchi::XMLSchema);
4972              
4973             our @EXPORT = qw();
4974             our @EXPORT_OK = qw();
4975              
4976             =head1 DESCRIPTION of Key class
4977              
4978             Rinchi::XMLSchema::Key is used for creating XML Schema Key objects.
4979              
4980             id = ID
4981             name = NCName
4982             {any attributes with non-schema namespace ...}>
4983             Content: (annotation?, (selector, field+))
4984              
4985             =cut
4986              
4987             #===============================================================================
4988              
4989             =item $Object = Rinchi::XMLSchema::Key->new();
4990              
4991             Create a new Rinchi::XMLSchema::Key object.
4992              
4993             =cut
4994              
4995             sub new() {
4996             my $class = shift;
4997             $class = ref($class) || $class;
4998             my $self = {};
4999             bless($self,$class);
5000             $self->{'_content_'} = [];
5001             return $self;
5002             }
5003              
5004             #===============================================================================
5005             # Rinchi::XMLSchema::Key::id
5006              
5007             =item $value = $Object->id([$new_value]);
5008              
5009             Set or get value of the 'id' attribute.
5010              
5011             =cut
5012              
5013             sub id() {
5014             my $self = shift;
5015             if (@_) {
5016             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
5017             $self->{'_id'} = shift;
5018             } else {
5019             carp 'Found value \'' . $_[0] . '\', expecting ID.'
5020             }
5021             }
5022             return $self->{'_id'};
5023             }
5024              
5025             #===============================================================================
5026             # Rinchi::XMLSchema::Key::name
5027              
5028             =item $value = $Object->name([$new_value]);
5029              
5030             Set or get value of the 'name' attribute.
5031              
5032             =cut
5033              
5034             sub name() {
5035             my $self = shift;
5036             if (@_) {
5037             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
5038             $self->{'_name'} = shift;
5039             } else {
5040             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
5041             }
5042             }
5043             return $self->{'_name'};
5044             }
5045              
5046             #===============================================================================
5047             # Rinchi::XMLSchema::Key::sameAs
5048              
5049             =item $value = $Object->sameAs($other);
5050              
5051             Compares self to other returning 1 if they are the same, 0 otherwise;
5052              
5053             =cut
5054              
5055             sub sameAs() {
5056             my $self = shift @_;
5057             my $other = shift @_;
5058              
5059             return 0 unless (ref($other) eq ref($self));
5060              
5061             if (exists($self->{'_name'})) {
5062             if (exists($other->{'_name'})) {
5063             return 0 unless ($self->{'_name'} eq $other->{'_name'});
5064             } else {
5065             return 0;
5066             }
5067             } else {
5068             return 0 if (exists($other->{'_name'}));
5069             }
5070              
5071             my @self_cont = @{$self->{'_content_'}};
5072             my @other_cont = @{$other->{'_content_'}};
5073             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
5074             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
5075              
5076             if (@self_cont) {
5077             if (@other_cont) {
5078             while (@self_cont and @other_cont) {
5079             my $sc = shift @self_cont;
5080             my $oc = shift @other_cont;
5081             return 0 unless($sc->sameAs($oc));
5082             }
5083             return (0) if (@self_cont or @other_cont);
5084             } else {
5085             return 0;
5086             }
5087             } else {
5088             return 0 if (@other_cont);
5089             }
5090              
5091             return 1;
5092             }
5093              
5094             #===============================================================================
5095              
5096             package Rinchi::XMLSchema::Keyref;
5097              
5098             use Carp;
5099              
5100             our @ISA = qw(Rinchi::XMLSchema);
5101              
5102             our @EXPORT = qw();
5103             our @EXPORT_OK = qw();
5104              
5105             =head1 DESCRIPTION of Keyref class
5106              
5107             Rinchi::XMLSchema::Keyref is used for creating XML Schema Keyref objects.
5108              
5109             id = ID
5110             name = NCName
5111             refer = QName
5112             {any attributes with non-schema namespace ...}>
5113             Content: (annotation?, (selector, field+))
5114              
5115             =cut
5116              
5117             #===============================================================================
5118              
5119             =item $Object = Rinchi::XMLSchema::Keyref->new();
5120              
5121             Create a new Rinchi::XMLSchema::Keyref object.
5122              
5123             =cut
5124              
5125             sub new() {
5126             my $class = shift;
5127             $class = ref($class) || $class;
5128             my $self = {};
5129             bless($self,$class);
5130             $self->{'_content_'} = [];
5131             return $self;
5132             }
5133              
5134             #===============================================================================
5135             # Rinchi::XMLSchema::Keyref::id
5136              
5137             =item $value = $Object->id([$new_value]);
5138              
5139             Set or get value of the 'id' attribute.
5140              
5141             =cut
5142              
5143             sub id() {
5144             my $self = shift;
5145             if (@_) {
5146             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
5147             $self->{'_id'} = shift;
5148             } else {
5149             carp 'Found value \'' . $_[0] . '\', expecting ID.'
5150             }
5151             }
5152             return $self->{'_id'};
5153             }
5154              
5155             #===============================================================================
5156             # Rinchi::XMLSchema::Keyref::name
5157              
5158             =item $value = $Object->name([$new_value]);
5159              
5160             Set or get value of the 'name' attribute.
5161              
5162             =cut
5163              
5164             sub name() {
5165             my $self = shift;
5166             if (@_) {
5167             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
5168             $self->{'_name'} = shift;
5169             } else {
5170             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
5171             }
5172             }
5173             return $self->{'_name'};
5174             }
5175              
5176             #===============================================================================
5177             # Rinchi::XMLSchema::Keyref::refer
5178              
5179             =item $value = $Object->refer([$new_value]);
5180              
5181             Set or get value of the 'refer' attribute.
5182              
5183             =cut
5184              
5185             sub refer() {
5186             my $self = shift;
5187             if (@_) {
5188             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
5189             $self->{'_refer'} = shift;
5190             } else {
5191             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
5192             }
5193             }
5194             return $self->{'_refer'};
5195             }
5196              
5197             #===============================================================================
5198             # Rinchi::XMLSchema::Keyref::sameAs
5199              
5200             =item $value = $Object->sameAs($other);
5201              
5202             Compares self to other returning 1 if they are the same, 0 otherwise;
5203              
5204             =cut
5205              
5206             sub sameAs() {
5207             my $self = shift @_;
5208             my $other = shift @_;
5209              
5210             return 0 unless (ref($other) eq ref($self));
5211              
5212             if (exists($self->{'_name'})) {
5213             if (exists($other->{'_name'})) {
5214             return 0 unless ($self->{'_name'} eq $other->{'_name'});
5215             } else {
5216             return 0;
5217             }
5218             } else {
5219             return 0 if (exists($other->{'_name'}));
5220             }
5221              
5222             if (exists($self->{'_refer'})) {
5223             if (exists($other->{'_refer'})) {
5224             return 0 unless ($self->{'_refer'} eq $other->{'_refer'});
5225             } else {
5226             return 0;
5227             }
5228             } else {
5229             return 0 if (exists($other->{'_refer'}));
5230             }
5231              
5232             my @self_cont = @{$self->{'_content_'}};
5233             my @other_cont = @{$other->{'_content_'}};
5234             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
5235             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
5236              
5237             if (@self_cont) {
5238             if (@other_cont) {
5239             while (@self_cont and @other_cont) {
5240             my $sc = shift @self_cont;
5241             my $oc = shift @other_cont;
5242             return 0 unless($sc->sameAs($oc));
5243             }
5244             return (0) if (@self_cont or @other_cont);
5245             } else {
5246             return 0;
5247             }
5248             } else {
5249             return 0 if (@other_cont);
5250             }
5251              
5252             return 1;
5253             }
5254              
5255             #===============================================================================
5256              
5257             package Rinchi::XMLSchema::Length;
5258              
5259             use Carp;
5260              
5261             our @ISA = qw(Rinchi::XMLSchema);
5262              
5263             our @EXPORT = qw();
5264             our @EXPORT_OK = qw();
5265              
5266             =head1 DESCRIPTION of Length class
5267              
5268             Rinchi::XMLSchema::Length is used for creating XML Schema Length objects.
5269              
5270             =cut
5271              
5272             #===============================================================================
5273              
5274             =item $Object = Rinchi::XMLSchema::Length->new();
5275              
5276             Create a new Rinchi::XMLSchema::Length object.
5277              
5278             =cut
5279              
5280             sub new() {
5281             my $class = shift;
5282             $class = ref($class) || $class;
5283             my $self = {};
5284             bless($self,$class);
5285             $self->{'_content_'} = [];
5286             return $self;
5287             }
5288              
5289             #===============================================================================
5290             # Rinchi::XMLSchema::Length::fixed
5291              
5292             =item $value = $Object->fixed([$new_value]);
5293              
5294             Set or get value of the 'fixed' attribute.
5295              
5296             =cut
5297              
5298             sub fixed() {
5299             my $self = shift;
5300             if (@_) {
5301             if ($_[0] =~ /^true|false$/) {
5302             $self->{'_fixed'} = shift;
5303             } else {
5304             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
5305             }
5306             }
5307             return $self->{'_fixed'};
5308             }
5309              
5310             #===============================================================================
5311             # Rinchi::XMLSchema::Length::id
5312              
5313             =item $value = $Object->id([$new_value]);
5314              
5315             Set or get value of the 'id' attribute.
5316              
5317             =cut
5318              
5319             sub id() {
5320             my $self = shift;
5321             if (@_) {
5322             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
5323             $self->{'_id'} = shift;
5324             } else {
5325             carp 'Found value \'' . $_[0] . '\', expecting ID.'
5326             }
5327             }
5328             return $self->{'_id'};
5329             }
5330              
5331             #===============================================================================
5332             # Rinchi::XMLSchema::Length::value
5333              
5334             =item $value = $Object->value([$new_value]);
5335              
5336             Set or get value of the 'value' attribute.
5337              
5338             =cut
5339              
5340             sub value() {
5341             my $self = shift;
5342             if (@_) {
5343             $self->{'_value'} = shift;
5344             }
5345             return $self->{'_value'};
5346             }
5347              
5348             #===============================================================================
5349             # Rinchi::XMLSchema::Length::sameAs
5350              
5351             =item $value = $Object->sameAs($other);
5352              
5353             Compares self to other returning 1 if they are the same, 0 otherwise;
5354              
5355             =cut
5356              
5357             sub sameAs() {
5358             my $self = shift @_;
5359             my $other = shift @_;
5360              
5361             return 0 unless (ref($other) eq ref($self));
5362              
5363             if (exists($self->{'_fixed'})) {
5364             if (exists($other->{'_fixed'})) {
5365             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
5366             } else {
5367             return 0;
5368             }
5369             } else {
5370             return 0 if (exists($other->{'_fixed'}));
5371             }
5372              
5373             if (exists($self->{'_value'})) {
5374             if (exists($other->{'_value'})) {
5375             return 0 unless ($self->{'_value'} eq $other->{'_value'});
5376             } else {
5377             return 0;
5378             }
5379             } else {
5380             return 0 if (exists($other->{'_value'}));
5381             }
5382              
5383             return 1;
5384             }
5385              
5386             #===============================================================================
5387              
5388             package Rinchi::XMLSchema::List;
5389              
5390             use Carp;
5391              
5392             our @ISA = qw(Rinchi::XMLSchema);
5393              
5394             our @EXPORT = qw();
5395             our @EXPORT_OK = qw();
5396              
5397             =head1 DESCRIPTION of List class
5398              
5399             Rinchi::XMLSchema::List is used for creating XML Schema List objects.
5400              
5401             id = ID
5402             itemType = QName
5403             {any attributes with non-schema namespace ...}>
5404             Content: (annotation?, simpleType?)
5405              
5406             =cut
5407              
5408             #===============================================================================
5409              
5410             =item $Object = Rinchi::XMLSchema::List->new();
5411              
5412             Create a new Rinchi::XMLSchema::List object.
5413              
5414             =cut
5415              
5416             sub new() {
5417             my $class = shift;
5418             $class = ref($class) || $class;
5419             my $self = {};
5420             bless($self,$class);
5421             $self->{'_content_'} = [];
5422             return $self;
5423             }
5424              
5425             #===============================================================================
5426             # Rinchi::XMLSchema::List::id
5427              
5428             =item $value = $Object->id([$new_value]);
5429              
5430             Set or get value of the 'id' attribute.
5431              
5432             =cut
5433              
5434             sub id() {
5435             my $self = shift;
5436             if (@_) {
5437             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
5438             $self->{'_id'} = shift;
5439             } else {
5440             carp 'Found value \'' . $_[0] . '\', expecting ID.'
5441             }
5442             }
5443             return $self->{'_id'};
5444             }
5445              
5446             #===============================================================================
5447             # Rinchi::XMLSchema::List::itemType
5448              
5449             =item $value = $Object->itemType([$new_value]);
5450              
5451             Set or get value of the 'itemType' attribute.
5452              
5453             =cut
5454              
5455             sub itemType() {
5456             my $self = shift;
5457             if (@_) {
5458             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
5459             $self->{'_itemType'} = shift;
5460             } else {
5461             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
5462             }
5463             }
5464             return $self->{'_itemType'};
5465             }
5466              
5467             #===============================================================================
5468             # Rinchi::XMLSchema::List::sameAs
5469              
5470             =item $value = $Object->sameAs($other);
5471              
5472             Compares self to other returning 1 if they are the same, 0 otherwise;
5473              
5474             =cut
5475              
5476             sub sameAs() {
5477             my $self = shift @_;
5478             my $other = shift @_;
5479              
5480             return 0 unless (ref($other) eq ref($self));
5481              
5482             if (exists($self->{'_itemType'})) {
5483             if (exists($other->{'_itemType'})) {
5484             return 0 unless ($self->{'_itemType'} eq $other->{'_itemType'});
5485             } else {
5486             return 0;
5487             }
5488             } else {
5489             return 0 if (exists($other->{'_itemType'}));
5490             }
5491              
5492             my @self_cont = @{$self->{'_content_'}};
5493             my @other_cont = @{$other->{'_content_'}};
5494             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
5495             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
5496              
5497             if (@self_cont) {
5498             if (@other_cont) {
5499             while (@self_cont and @other_cont) {
5500             my $sc = shift @self_cont;
5501             my $oc = shift @other_cont;
5502             return 0 unless($sc->sameAs($oc));
5503             }
5504             return (0) if (@self_cont or @other_cont);
5505             } else {
5506             return 0;
5507             }
5508             } else {
5509             return 0 if (@other_cont);
5510             }
5511              
5512             return 1;
5513             }
5514              
5515             #===============================================================================
5516              
5517             package Rinchi::XMLSchema::MaxExclusive;
5518              
5519             use Carp;
5520              
5521             our @ISA = qw(Rinchi::XMLSchema);
5522              
5523             our @EXPORT = qw();
5524             our @EXPORT_OK = qw();
5525              
5526             =head1 DESCRIPTION of MaxExclusive class
5527              
5528             Rinchi::XMLSchema::MaxExclusive is used for creating XML Schema MaxExclusive objects.
5529              
5530             =cut
5531              
5532             #===============================================================================
5533              
5534             =item $Object = Rinchi::XMLSchema::MaxExclusive->new();
5535              
5536             Create a new Rinchi::XMLSchema::MaxExclusive object.
5537              
5538             =cut
5539              
5540             sub new() {
5541             my $class = shift;
5542             $class = ref($class) || $class;
5543             my $self = {};
5544             bless($self,$class);
5545             $self->{'_content_'} = [];
5546             return $self;
5547             }
5548              
5549             #===============================================================================
5550             # Rinchi::XMLSchema::MaxExclusive::fixed
5551              
5552             =item $value = $Object->fixed([$new_value]);
5553              
5554             Set or get value of the 'fixed' attribute.
5555              
5556             =cut
5557              
5558             sub fixed() {
5559             my $self = shift;
5560             if (@_) {
5561             if ($_[0] =~ /^true|false$/) {
5562             $self->{'_fixed'} = shift;
5563             } else {
5564             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
5565             }
5566             }
5567             return $self->{'_fixed'};
5568             }
5569              
5570             #===============================================================================
5571             # Rinchi::XMLSchema::MaxExclusive::id
5572              
5573             =item $value = $Object->id([$new_value]);
5574              
5575             Set or get value of the 'id' attribute.
5576              
5577             =cut
5578              
5579             sub id() {
5580             my $self = shift;
5581             if (@_) {
5582             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
5583             $self->{'_id'} = shift;
5584             } else {
5585             carp 'Found value \'' . $_[0] . '\', expecting ID.'
5586             }
5587             }
5588             return $self->{'_id'};
5589             }
5590              
5591             #===============================================================================
5592             # Rinchi::XMLSchema::MaxExclusive::value
5593              
5594             =item $value = $Object->value([$new_value]);
5595              
5596             Set or get value of the 'value' attribute.
5597              
5598             =cut
5599              
5600             sub value() {
5601             my $self = shift;
5602             if (@_) {
5603             $self->{'_value'} = shift;
5604             }
5605             return $self->{'_value'};
5606             }
5607              
5608             #===============================================================================
5609             # Rinchi::XMLSchema::MaxExclusive::sameAs
5610              
5611             =item $value = $Object->sameAs($other);
5612              
5613             Compares self to other returning 1 if they are the same, 0 otherwise;
5614              
5615             =cut
5616              
5617             sub sameAs() {
5618             my $self = shift @_;
5619             my $other = shift @_;
5620              
5621             return 0 unless (ref($other) eq ref($self));
5622              
5623             if (exists($self->{'_fixed'})) {
5624             if (exists($other->{'_fixed'})) {
5625             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
5626             } else {
5627             return 0;
5628             }
5629             } else {
5630             return 0 if (exists($other->{'_fixed'}));
5631             }
5632              
5633             if (exists($self->{'_value'})) {
5634             if (exists($other->{'_value'})) {
5635             return 0 unless ($self->{'_value'} eq $other->{'_value'});
5636             } else {
5637             return 0;
5638             }
5639             } else {
5640             return 0 if (exists($other->{'_value'}));
5641             }
5642              
5643             return 1;
5644             }
5645              
5646             #===============================================================================
5647              
5648             package Rinchi::XMLSchema::MaxInclusive;
5649              
5650             use Carp;
5651              
5652             our @ISA = qw(Rinchi::XMLSchema);
5653              
5654             our @EXPORT = qw();
5655             our @EXPORT_OK = qw();
5656              
5657             =head1 DESCRIPTION of MaxInclusive class
5658              
5659             Rinchi::XMLSchema::MaxInclusive is used for creating XML Schema MaxInclusive objects.
5660              
5661             =cut
5662              
5663             #===============================================================================
5664              
5665             =item $Object = Rinchi::XMLSchema::MaxInclusive->new();
5666              
5667             Create a new Rinchi::XMLSchema::MaxInclusive object.
5668              
5669             =cut
5670              
5671             sub new() {
5672             my $class = shift;
5673             $class = ref($class) || $class;
5674             my $self = {};
5675             bless($self,$class);
5676             $self->{'_content_'} = [];
5677             return $self;
5678             }
5679              
5680             #===============================================================================
5681             # Rinchi::XMLSchema::MaxInclusive::fixed
5682              
5683             =item $value = $Object->fixed([$new_value]);
5684              
5685             Set or get value of the 'fixed' attribute.
5686              
5687             =cut
5688              
5689             sub fixed() {
5690             my $self = shift;
5691             if (@_) {
5692             if ($_[0] =~ /^true|false$/) {
5693             $self->{'_fixed'} = shift;
5694             } else {
5695             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
5696             }
5697             }
5698             return $self->{'_fixed'};
5699             }
5700              
5701             #===============================================================================
5702             # Rinchi::XMLSchema::MaxInclusive::id
5703              
5704             =item $value = $Object->id([$new_value]);
5705              
5706             Set or get value of the 'id' attribute.
5707              
5708             =cut
5709              
5710             sub id() {
5711             my $self = shift;
5712             if (@_) {
5713             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
5714             $self->{'_id'} = shift;
5715             } else {
5716             carp 'Found value \'' . $_[0] . '\', expecting ID.'
5717             }
5718             }
5719             return $self->{'_id'};
5720             }
5721              
5722             #===============================================================================
5723             # Rinchi::XMLSchema::MaxInclusive::value
5724              
5725             =item $value = $Object->value([$new_value]);
5726              
5727             Set or get value of the 'value' attribute.
5728              
5729             =cut
5730              
5731             sub value() {
5732             my $self = shift;
5733             if (@_) {
5734             $self->{'_value'} = shift;
5735             }
5736             return $self->{'_value'};
5737             }
5738              
5739             #===============================================================================
5740             # Rinchi::XMLSchema::MaxInclusive::sameAs
5741              
5742             =item $value = $Object->sameAs($other);
5743              
5744             Compares self to other returning 1 if they are the same, 0 otherwise;
5745              
5746             =cut
5747              
5748             sub sameAs() {
5749             my $self = shift @_;
5750             my $other = shift @_;
5751              
5752             return 0 unless (ref($other) eq ref($self));
5753              
5754             if (exists($self->{'_fixed'})) {
5755             if (exists($other->{'_fixed'})) {
5756             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
5757             } else {
5758             return 0;
5759             }
5760             } else {
5761             return 0 if (exists($other->{'_fixed'}));
5762             }
5763              
5764             if (exists($self->{'_value'})) {
5765             if (exists($other->{'_value'})) {
5766             return 0 unless ($self->{'_value'} eq $other->{'_value'});
5767             } else {
5768             return 0;
5769             }
5770             } else {
5771             return 0 if (exists($other->{'_value'}));
5772             }
5773              
5774             return 1;
5775             }
5776              
5777             #===============================================================================
5778              
5779             package Rinchi::XMLSchema::MaxLength;
5780              
5781             use Carp;
5782              
5783             our @ISA = qw(Rinchi::XMLSchema);
5784              
5785             our @EXPORT = qw();
5786             our @EXPORT_OK = qw();
5787              
5788             =head1 DESCRIPTION of MaxLength class
5789              
5790             Rinchi::XMLSchema::MaxLength is used for creating XML Schema MaxLength objects.
5791              
5792             =cut
5793              
5794             #===============================================================================
5795              
5796             =item $Object = Rinchi::XMLSchema::MaxLength->new();
5797              
5798             Create a new Rinchi::XMLSchema::MaxLength object.
5799              
5800             =cut
5801              
5802             sub new() {
5803             my $class = shift;
5804             $class = ref($class) || $class;
5805             my $self = {};
5806             bless($self,$class);
5807             $self->{'_content_'} = [];
5808             return $self;
5809             }
5810              
5811             #===============================================================================
5812             # Rinchi::XMLSchema::MaxLength::fixed
5813              
5814             =item $value = $Object->fixed([$new_value]);
5815              
5816             Set or get value of the 'fixed' attribute.
5817              
5818             =cut
5819              
5820             sub fixed() {
5821             my $self = shift;
5822             if (@_) {
5823             if ($_[0] =~ /^true|false$/) {
5824             $self->{'_fixed'} = shift;
5825             } else {
5826             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
5827             }
5828             }
5829             return $self->{'_fixed'};
5830             }
5831              
5832             #===============================================================================
5833             # Rinchi::XMLSchema::MaxLength::id
5834              
5835             =item $value = $Object->id([$new_value]);
5836              
5837             Set or get value of the 'id' attribute.
5838              
5839             =cut
5840              
5841             sub id() {
5842             my $self = shift;
5843             if (@_) {
5844             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
5845             $self->{'_id'} = shift;
5846             } else {
5847             carp 'Found value \'' . $_[0] . '\', expecting ID.'
5848             }
5849             }
5850             return $self->{'_id'};
5851             }
5852              
5853             #===============================================================================
5854             # Rinchi::XMLSchema::MaxLength::value
5855              
5856             =item $value = $Object->value([$new_value]);
5857              
5858             Set or get value of the 'value' attribute.
5859              
5860             =cut
5861              
5862             sub value() {
5863             my $self = shift;
5864             if (@_) {
5865             $self->{'_value'} = shift;
5866             }
5867             return $self->{'_value'};
5868             }
5869              
5870             #===============================================================================
5871             # Rinchi::XMLSchema::MaxLength::sameAs
5872              
5873             =item $value = $Object->sameAs($other);
5874              
5875             Compares self to other returning 1 if they are the same, 0 otherwise;
5876              
5877             =cut
5878              
5879             sub sameAs() {
5880             my $self = shift @_;
5881             my $other = shift @_;
5882              
5883             return 0 unless (ref($other) eq ref($self));
5884              
5885             if (exists($self->{'_fixed'})) {
5886             if (exists($other->{'_fixed'})) {
5887             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
5888             } else {
5889             return 0;
5890             }
5891             } else {
5892             return 0 if (exists($other->{'_fixed'}));
5893             }
5894              
5895             if (exists($self->{'_value'})) {
5896             if (exists($other->{'_value'})) {
5897             return 0 unless ($self->{'_value'} eq $other->{'_value'});
5898             } else {
5899             return 0;
5900             }
5901             } else {
5902             return 0 if (exists($other->{'_value'}));
5903             }
5904              
5905             return 1;
5906             }
5907              
5908             #===============================================================================
5909              
5910             package Rinchi::XMLSchema::MinExclusive;
5911              
5912             use Carp;
5913              
5914             our @ISA = qw(Rinchi::XMLSchema);
5915              
5916             our @EXPORT = qw();
5917             our @EXPORT_OK = qw();
5918              
5919             =head1 DESCRIPTION of MinExclusive class
5920              
5921             Rinchi::XMLSchema::MinExclusive is used for creating XML Schema MinExclusive objects.
5922              
5923             =cut
5924              
5925             #===============================================================================
5926              
5927             =item $Object = Rinchi::XMLSchema::MinExclusive->new();
5928              
5929             Create a new Rinchi::XMLSchema::MinExclusive object.
5930              
5931             =cut
5932              
5933             sub new() {
5934             my $class = shift;
5935             $class = ref($class) || $class;
5936             my $self = {};
5937             bless($self,$class);
5938             $self->{'_content_'} = [];
5939             return $self;
5940             }
5941              
5942             #===============================================================================
5943             # Rinchi::XMLSchema::MinExclusive::fixed
5944              
5945             =item $value = $Object->fixed([$new_value]);
5946              
5947             Set or get value of the 'fixed' attribute.
5948              
5949             =cut
5950              
5951             sub fixed() {
5952             my $self = shift;
5953             if (@_) {
5954             if ($_[0] =~ /^true|false$/) {
5955             $self->{'_fixed'} = shift;
5956             } else {
5957             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
5958             }
5959             }
5960             return $self->{'_fixed'};
5961             }
5962              
5963             #===============================================================================
5964             # Rinchi::XMLSchema::MinExclusive::id
5965              
5966             =item $value = $Object->id([$new_value]);
5967              
5968             Set or get value of the 'id' attribute.
5969              
5970             =cut
5971              
5972             sub id() {
5973             my $self = shift;
5974             if (@_) {
5975             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
5976             $self->{'_id'} = shift;
5977             } else {
5978             carp 'Found value \'' . $_[0] . '\', expecting ID.'
5979             }
5980             }
5981             return $self->{'_id'};
5982             }
5983              
5984             #===============================================================================
5985             # Rinchi::XMLSchema::MinExclusive::value
5986              
5987             =item $value = $Object->value([$new_value]);
5988              
5989             Set or get value of the 'value' attribute.
5990              
5991             =cut
5992              
5993             sub value() {
5994             my $self = shift;
5995             if (@_) {
5996             $self->{'_value'} = shift;
5997             }
5998             return $self->{'_value'};
5999             }
6000              
6001             #===============================================================================
6002             # Rinchi::XMLSchema::MinExclusive::sameAs
6003              
6004             =item $value = $Object->sameAs($other);
6005              
6006             Compares self to other returning 1 if they are the same, 0 otherwise;
6007              
6008             =cut
6009              
6010             sub sameAs() {
6011             my $self = shift @_;
6012             my $other = shift @_;
6013              
6014             return 0 unless (ref($other) eq ref($self));
6015              
6016             if (exists($self->{'_fixed'})) {
6017             if (exists($other->{'_fixed'})) {
6018             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
6019             } else {
6020             return 0;
6021             }
6022             } else {
6023             return 0 if (exists($other->{'_fixed'}));
6024             }
6025              
6026             if (exists($self->{'_value'})) {
6027             if (exists($other->{'_value'})) {
6028             return 0 unless ($self->{'_value'} eq $other->{'_value'});
6029             } else {
6030             return 0;
6031             }
6032             } else {
6033             return 0 if (exists($other->{'_value'}));
6034             }
6035              
6036             return 1;
6037             }
6038              
6039             #===============================================================================
6040              
6041             package Rinchi::XMLSchema::MinInclusive;
6042              
6043             use Carp;
6044              
6045             our @ISA = qw(Rinchi::XMLSchema);
6046              
6047             our @EXPORT = qw();
6048             our @EXPORT_OK = qw();
6049              
6050             =head1 DESCRIPTION of MinInclusive class
6051              
6052             Rinchi::XMLSchema::MinInclusive is used for creating XML Schema MinInclusive objects.
6053              
6054             =cut
6055              
6056             #===============================================================================
6057              
6058             =item $Object = Rinchi::XMLSchema::MinInclusive->new();
6059              
6060             Create a new Rinchi::XMLSchema::MinInclusive object.
6061              
6062             =cut
6063              
6064             sub new() {
6065             my $class = shift;
6066             $class = ref($class) || $class;
6067             my $self = {};
6068             bless($self,$class);
6069             $self->{'_content_'} = [];
6070             return $self;
6071             }
6072              
6073             #===============================================================================
6074             # Rinchi::XMLSchema::MinInclusive::fixed
6075              
6076             =item $value = $Object->fixed([$new_value]);
6077              
6078             Set or get value of the 'fixed' attribute.
6079              
6080             =cut
6081              
6082             sub fixed() {
6083             my $self = shift;
6084             if (@_) {
6085             if ($_[0] =~ /^true|false$/) {
6086             $self->{'_fixed'} = shift;
6087             } else {
6088             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
6089             }
6090             }
6091             return $self->{'_fixed'};
6092             }
6093              
6094             #===============================================================================
6095             # Rinchi::XMLSchema::MinInclusive::id
6096              
6097             =item $value = $Object->id([$new_value]);
6098              
6099             Set or get value of the 'id' attribute.
6100              
6101             =cut
6102              
6103             sub id() {
6104             my $self = shift;
6105             if (@_) {
6106             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
6107             $self->{'_id'} = shift;
6108             } else {
6109             carp 'Found value \'' . $_[0] . '\', expecting ID.'
6110             }
6111             }
6112             return $self->{'_id'};
6113             }
6114              
6115             #===============================================================================
6116             # Rinchi::XMLSchema::MinInclusive::value
6117              
6118             =item $value = $Object->value([$new_value]);
6119              
6120             Set or get value of the 'value' attribute.
6121              
6122             =cut
6123              
6124             sub value() {
6125             my $self = shift;
6126             if (@_) {
6127             $self->{'_value'} = shift;
6128             }
6129             return $self->{'_value'};
6130             }
6131              
6132             #===============================================================================
6133             # Rinchi::XMLSchema::MinInclusive::sameAs
6134              
6135             =item $value = $Object->sameAs($other);
6136              
6137             Compares self to other returning 1 if they are the same, 0 otherwise;
6138              
6139             =cut
6140              
6141             sub sameAs() {
6142             my $self = shift @_;
6143             my $other = shift @_;
6144              
6145             return 0 unless (ref($other) eq ref($self));
6146              
6147             if (exists($self->{'_fixed'})) {
6148             if (exists($other->{'_fixed'})) {
6149             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
6150             } else {
6151             return 0;
6152             }
6153             } else {
6154             return 0 if (exists($other->{'_fixed'}));
6155             }
6156              
6157             if (exists($self->{'_value'})) {
6158             if (exists($other->{'_value'})) {
6159             return 0 unless ($self->{'_value'} eq $other->{'_value'});
6160             } else {
6161             return 0;
6162             }
6163             } else {
6164             return 0 if (exists($other->{'_value'}));
6165             }
6166              
6167             return 1;
6168             }
6169              
6170             #===============================================================================
6171              
6172             package Rinchi::XMLSchema::MinLength;
6173              
6174             use Carp;
6175              
6176             our @ISA = qw(Rinchi::XMLSchema);
6177              
6178             our @EXPORT = qw();
6179             our @EXPORT_OK = qw();
6180              
6181             =head1 DESCRIPTION of MinLength class
6182              
6183             Rinchi::XMLSchema::MinLength is used for creating XML Schema MinLength objects.
6184              
6185             =cut
6186              
6187             #===============================================================================
6188              
6189             =item $Object = Rinchi::XMLSchema::MinLength->new();
6190              
6191             Create a new Rinchi::XMLSchema::MinLength object.
6192              
6193             =cut
6194              
6195             sub new() {
6196             my $class = shift;
6197             $class = ref($class) || $class;
6198             my $self = {};
6199             bless($self,$class);
6200             $self->{'_content_'} = [];
6201             return $self;
6202             }
6203              
6204             #===============================================================================
6205             # Rinchi::XMLSchema::MinLength::fixed
6206              
6207             =item $value = $Object->fixed([$new_value]);
6208              
6209             Set or get value of the 'fixed' attribute.
6210              
6211             =cut
6212              
6213             sub fixed() {
6214             my $self = shift;
6215             if (@_) {
6216             if ($_[0] =~ /^true|false$/) {
6217             $self->{'_fixed'} = shift;
6218             } else {
6219             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
6220             }
6221             }
6222             return $self->{'_fixed'};
6223             }
6224              
6225             #===============================================================================
6226             # Rinchi::XMLSchema::MinLength::id
6227              
6228             =item $value = $Object->id([$new_value]);
6229              
6230             Set or get value of the 'id' attribute.
6231              
6232             =cut
6233              
6234             sub id() {
6235             my $self = shift;
6236             if (@_) {
6237             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
6238             $self->{'_id'} = shift;
6239             } else {
6240             carp 'Found value \'' . $_[0] . '\', expecting ID.'
6241             }
6242             }
6243             return $self->{'_id'};
6244             }
6245              
6246             #===============================================================================
6247             # Rinchi::XMLSchema::MinLength::value
6248              
6249             =item $value = $Object->value([$new_value]);
6250              
6251             Set or get value of the 'value' attribute.
6252              
6253             =cut
6254              
6255             sub value() {
6256             my $self = shift;
6257             if (@_) {
6258             $self->{'_value'} = shift;
6259             }
6260             return $self->{'_value'};
6261             }
6262              
6263             #===============================================================================
6264             # Rinchi::XMLSchema::MinLength::sameAs
6265              
6266             =item $value = $Object->sameAs($other);
6267              
6268             Compares self to other returning 1 if they are the same, 0 otherwise;
6269              
6270             =cut
6271              
6272             sub sameAs() {
6273             my $self = shift @_;
6274             my $other = shift @_;
6275              
6276             return 0 unless (ref($other) eq ref($self));
6277              
6278             if (exists($self->{'_fixed'})) {
6279             if (exists($other->{'_fixed'})) {
6280             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
6281             } else {
6282             return 0;
6283             }
6284             } else {
6285             return 0 if (exists($other->{'_fixed'}));
6286             }
6287              
6288             if (exists($self->{'_value'})) {
6289             if (exists($other->{'_value'})) {
6290             return 0 unless ($self->{'_value'} eq $other->{'_value'});
6291             } else {
6292             return 0;
6293             }
6294             } else {
6295             return 0 if (exists($other->{'_value'}));
6296             }
6297              
6298             return 1;
6299             }
6300              
6301             #===============================================================================
6302              
6303             package Rinchi::XMLSchema::Notation;
6304              
6305             use Carp;
6306              
6307             our @ISA = qw(Rinchi::XMLSchema);
6308              
6309             our @EXPORT = qw();
6310             our @EXPORT_OK = qw();
6311              
6312             =head1 DESCRIPTION of Notation class
6313              
6314             Rinchi::XMLSchema::Notation is used for creating XML Schema Notation objects.
6315              
6316             id = ID
6317             name = NCName
6318             public = token
6319             system = anyURI
6320             {any attributes with non-schema namespace ...}>
6321             Content: (annotation?)
6322              
6323             =cut
6324              
6325             #===============================================================================
6326              
6327             =item $Object = Rinchi::XMLSchema::Notation->new();
6328              
6329             Create a new Rinchi::XMLSchema::Notation object.
6330              
6331             =cut
6332              
6333             sub new() {
6334             my $class = shift;
6335             $class = ref($class) || $class;
6336             my $self = {};
6337             bless($self,$class);
6338             $self->{'_content_'} = [];
6339             return $self;
6340             }
6341              
6342             #===============================================================================
6343             # Rinchi::XMLSchema::Notation::id
6344              
6345             =item $value = $Object->id([$new_value]);
6346              
6347             Set or get value of the 'id' attribute.
6348              
6349             =cut
6350              
6351             sub id() {
6352             my $self = shift;
6353             if (@_) {
6354             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
6355             $self->{'_id'} = shift;
6356             } else {
6357             carp 'Found value \'' . $_[0] . '\', expecting ID.'
6358             }
6359             }
6360             return $self->{'_id'};
6361             }
6362              
6363             #===============================================================================
6364             # Rinchi::XMLSchema::Notation::name
6365              
6366             =item $value = $Object->name([$new_value]);
6367              
6368             Set or get value of the 'name' attribute.
6369              
6370             =cut
6371              
6372             sub name() {
6373             my $self = shift;
6374             if (@_) {
6375             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
6376             $self->{'_name'} = shift;
6377             } else {
6378             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
6379             }
6380             }
6381             return $self->{'_name'};
6382             }
6383              
6384             #===============================================================================
6385             # Rinchi::XMLSchema::Notation::public
6386              
6387             =item $value = $Object->public([$new_value]);
6388              
6389             Set or get value of the 'public' attribute.
6390              
6391             =cut
6392              
6393             sub public() {
6394             my $self = shift;
6395             if (@_) {
6396             $self->{'_public'} = shift;
6397             }
6398             return $self->{'_public'};
6399             }
6400              
6401             #===============================================================================
6402             # Rinchi::XMLSchema::Notation::system
6403              
6404             =item $value = $Object->system([$new_value]);
6405              
6406             Set or get value of the 'system' attribute.
6407              
6408             =cut
6409              
6410             sub system() {
6411             my $self = shift;
6412             if (@_) {
6413             $self->{'_system'} = shift;
6414             }
6415             return $self->{'_system'};
6416             }
6417              
6418             #===============================================================================
6419             # Rinchi::XMLSchema::Notation::sameAs
6420              
6421             =item $value = $Object->sameAs($other);
6422              
6423             Compares self to other returning 1 if they are the same, 0 otherwise;
6424              
6425             =cut
6426              
6427             sub sameAs() {
6428             my $self = shift @_;
6429             my $other = shift @_;
6430              
6431             return 0 unless (ref($other) eq ref($self));
6432              
6433             if (exists($self->{'_name'})) {
6434             if (exists($other->{'_name'})) {
6435             return 0 unless ($self->{'_name'} eq $other->{'_name'});
6436             } else {
6437             return 0;
6438             }
6439             } else {
6440             return 0 if (exists($other->{'_name'}));
6441             }
6442              
6443             if (exists($self->{'_public'})) {
6444             if (exists($other->{'_public'})) {
6445             return 0 unless ($self->{'_public'} eq $other->{'_public'});
6446             } else {
6447             return 0;
6448             }
6449             } else {
6450             return 0 if (exists($other->{'_public'}));
6451             }
6452              
6453             if (exists($self->{'_system'})) {
6454             if (exists($other->{'_system'})) {
6455             return 0 unless ($self->{'_system'} eq $other->{'_system'});
6456             } else {
6457             return 0;
6458             }
6459             } else {
6460             return 0 if (exists($other->{'_system'}));
6461             }
6462              
6463             return 1;
6464             }
6465              
6466             #===============================================================================
6467              
6468             package Rinchi::XMLSchema::Pattern;
6469              
6470             use Carp;
6471              
6472             our @ISA = qw(Rinchi::XMLSchema);
6473              
6474             our @EXPORT = qw();
6475             our @EXPORT_OK = qw();
6476              
6477             =head1 DESCRIPTION of Pattern class
6478              
6479             Rinchi::XMLSchema::Pattern is used for creating XML Schema Pattern objects.
6480              
6481             =cut
6482              
6483             #===============================================================================
6484              
6485             =item $Object = Rinchi::XMLSchema::Pattern->new();
6486              
6487             Create a new Rinchi::XMLSchema::Pattern object.
6488              
6489             =cut
6490              
6491             sub new() {
6492             my $class = shift;
6493             $class = ref($class) || $class;
6494             my $self = {};
6495             bless($self,$class);
6496             $self->{'_content_'} = [];
6497             return $self;
6498             }
6499              
6500             #===============================================================================
6501             # Rinchi::XMLSchema::Pattern::id
6502              
6503             =item $value = $Object->id([$new_value]);
6504              
6505             Set or get value of the 'id' attribute.
6506              
6507             =cut
6508              
6509             sub id() {
6510             my $self = shift;
6511             if (@_) {
6512             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
6513             $self->{'_id'} = shift;
6514             } else {
6515             carp 'Found value \'' . $_[0] . '\', expecting ID.'
6516             }
6517             }
6518             return $self->{'_id'};
6519             }
6520              
6521             #===============================================================================
6522             # Rinchi::XMLSchema::Pattern::value
6523              
6524             =item $value = $Object->value([$new_value]);
6525              
6526             Set or get value of the 'value' attribute.
6527              
6528             =cut
6529              
6530             sub value() {
6531             my $self = shift;
6532             if (@_) {
6533             $self->{'_value'} = shift;
6534             }
6535             return $self->{'_value'};
6536             }
6537              
6538             #===============================================================================
6539             # Rinchi::XMLSchema::Pattern::sameAs
6540              
6541             =item $value = $Object->sameAs($other);
6542              
6543             Compares self to other returning 1 if they are the same, 0 otherwise;
6544              
6545             =cut
6546              
6547             sub sameAs() {
6548             my $self = shift @_;
6549             my $other = shift @_;
6550              
6551             return 0 unless (ref($other) eq ref($self));
6552              
6553             if (exists($self->{'_value'})) {
6554             if (exists($other->{'_value'})) {
6555             return 0 unless ($self->{'_value'} eq $other->{'_value'});
6556             } else {
6557             return 0;
6558             }
6559             } else {
6560             return 0 if (exists($other->{'_value'}));
6561             }
6562              
6563             return 1;
6564             }
6565              
6566             #===============================================================================
6567              
6568             package Rinchi::XMLSchema::Redefine;
6569              
6570             use Carp;
6571              
6572             our @ISA = qw(Rinchi::XMLSchema);
6573              
6574             our @EXPORT = qw();
6575             our @EXPORT_OK = qw();
6576              
6577             =head1 DESCRIPTION of Redefine class
6578              
6579             Rinchi::XMLSchema::Redefine is used for creating XML Schema Redefine objects.
6580              
6581             id = ID
6582             schemaLocation = anyURI
6583             {any attributes with non-schema namespace . . .}>
6584             Content: (annotation | (simpleType | complexType | group | attributeGroup))*
6585              
6586             =cut
6587              
6588             #===============================================================================
6589              
6590             =item $Object = Rinchi::XMLSchema::Redefine->new();
6591              
6592             Create a new Rinchi::XMLSchema::Redefine object.
6593              
6594             =cut
6595              
6596             sub new() {
6597             my $class = shift;
6598             $class = ref($class) || $class;
6599             my $self = {};
6600             bless($self,$class);
6601             $self->{'_content_'} = [];
6602             return $self;
6603             }
6604              
6605             #===============================================================================
6606             # Rinchi::XMLSchema::Redefine::id
6607              
6608             =item $value = $Object->id([$new_value]);
6609              
6610             Set or get value of the 'id' attribute.
6611              
6612             =cut
6613              
6614             sub id() {
6615             my $self = shift;
6616             if (@_) {
6617             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
6618             $self->{'_id'} = shift;
6619             } else {
6620             carp 'Found value \'' . $_[0] . '\', expecting ID.'
6621             }
6622             }
6623             return $self->{'_id'};
6624             }
6625              
6626             #===============================================================================
6627             # Rinchi::XMLSchema::Redefine::schemaLocation
6628              
6629             =item $value = $Object->schemaLocation([$new_value]);
6630              
6631             Set or get value of the 'schemaLocation' attribute.
6632              
6633             =cut
6634              
6635             sub schemaLocation() {
6636             my $self = shift;
6637             if (@_) {
6638             $self->{'_schemaLocation'} = shift;
6639             }
6640             return $self->{'_schemaLocation'};
6641             }
6642              
6643             #===============================================================================
6644             # Rinchi::XMLSchema::Redefine::sameAs
6645              
6646             =item $value = $Object->sameAs($other);
6647              
6648             Compares self to other returning 1 if they are the same, 0 otherwise;
6649              
6650             =cut
6651              
6652             sub sameAs() {
6653             my $self = shift @_;
6654             my $other = shift @_;
6655              
6656             return 0 unless (ref($other) eq ref($self));
6657              
6658             if (exists($self->{'_schemaLocation'})) {
6659             if (exists($other->{'_schemaLocation'})) {
6660             return 0 unless ($self->{'_schemaLocation'} eq $other->{'_schemaLocation'});
6661             } else {
6662             return 0;
6663             }
6664             } else {
6665             return 0 if (exists($other->{'_schemaLocation'}));
6666             }
6667              
6668             my @self_cont = @{$self->{'_content_'}};
6669             my @other_cont = @{$other->{'_content_'}};
6670             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
6671             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
6672              
6673             if (@self_cont) {
6674             if (@other_cont) {
6675             while (@self_cont and @other_cont) {
6676             my $sc = shift @self_cont;
6677             my $oc = shift @other_cont;
6678             return 0 unless($sc->sameAs($oc));
6679             }
6680             return (0) if (@self_cont or @other_cont);
6681             } else {
6682             return 0;
6683             }
6684             } else {
6685             return 0 if (@other_cont);
6686             }
6687              
6688             return 1;
6689             }
6690              
6691             #===============================================================================
6692              
6693             package Rinchi::XMLSchema::Restriction;
6694              
6695             use Carp;
6696              
6697             our @ISA = qw(Rinchi::XMLSchema);
6698              
6699             our @EXPORT = qw();
6700             our @EXPORT_OK = qw();
6701              
6702             =head1 DESCRIPTION of Restriction class
6703              
6704             Rinchi::XMLSchema::Restriction is used for creating XML Schema Restriction objects.
6705              
6706             base = QName
6707             id = ID
6708             {any attributes with non-schema namespace ...}>
6709             Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*))
6710              
6711             =cut
6712              
6713             #===============================================================================
6714              
6715             =item $Object = Rinchi::XMLSchema::Restriction->new();
6716              
6717             Create a new Rinchi::XMLSchema::Restriction object.
6718              
6719             =cut
6720              
6721             sub new() {
6722             my $class = shift;
6723             $class = ref($class) || $class;
6724             my $self = {};
6725             bless($self,$class);
6726             $self->{'_content_'} = [];
6727             return $self;
6728             }
6729              
6730             #===============================================================================
6731             # Rinchi::XMLSchema::Restriction::base
6732              
6733             =item $value = $Object->base([$new_value]);
6734              
6735             Set or get value of the 'base' attribute.
6736              
6737             =cut
6738              
6739             sub base() {
6740             my $self = shift;
6741             if (@_) {
6742             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
6743             $self->{'_base'} = shift;
6744             } else {
6745             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
6746             }
6747             }
6748             return $self->{'_base'};
6749             }
6750              
6751             #===============================================================================
6752             # Rinchi::XMLSchema::Restriction::id
6753              
6754             =item $value = $Object->id([$new_value]);
6755              
6756             Set or get value of the 'id' attribute.
6757              
6758             =cut
6759              
6760             sub id() {
6761             my $self = shift;
6762             if (@_) {
6763             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
6764             $self->{'_id'} = shift;
6765             } else {
6766             carp 'Found value \'' . $_[0] . '\', expecting ID.'
6767             }
6768             }
6769             return $self->{'_id'};
6770             }
6771              
6772             #===============================================================================
6773             # Rinchi::XMLSchema::Restriction::sameAs
6774              
6775             =item $value = $Object->sameAs($other);
6776              
6777             Compares self to other returning 1 if they are the same, 0 otherwise;
6778              
6779             =cut
6780              
6781             sub sameAs() {
6782             my $self = shift @_;
6783             my $other = shift @_;
6784              
6785             return 0 unless (ref($other) eq ref($self));
6786              
6787             if (exists($self->{'_base'})) {
6788             if (exists($other->{'_base'})) {
6789             return 0 unless ($self->{'_base'} eq $other->{'_base'});
6790             } else {
6791             return 0;
6792             }
6793             } else {
6794             return 0 if (exists($other->{'_base'}));
6795             }
6796              
6797             my @self_cont = @{$self->{'_content_'}};
6798             my @other_cont = @{$other->{'_content_'}};
6799             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
6800             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
6801              
6802             if (@self_cont) {
6803             if (@other_cont) {
6804             while (@self_cont and @other_cont) {
6805             my $sc = shift @self_cont;
6806             my $oc = shift @other_cont;
6807             return 0 unless($sc->sameAs($oc));
6808             }
6809             return (0) if (@self_cont or @other_cont);
6810             } else {
6811             return 0;
6812             }
6813             } else {
6814             return 0 if (@other_cont);
6815             }
6816              
6817             return 1;
6818             }
6819              
6820             #===============================================================================
6821              
6822             package Rinchi::XMLSchema::Schema;
6823              
6824             use Carp;
6825              
6826             our @ISA = qw(Rinchi::XMLSchema);
6827              
6828             our @EXPORT = qw();
6829             our @EXPORT_OK = qw();
6830              
6831             =head1 DESCRIPTION of Schema class
6832              
6833             Rinchi::XMLSchema::Schema is used for creating XML Schema Schema objects.
6834              
6835             attributeFormDefault = (qualified | unqualified) : unqualified
6836             blockDefault = (#all | List of (extension | restriction | substitution)) : ''
6837             elementFormDefault = (qualified | unqualified) : unqualified
6838             finalDefault = (#all | List of (extension | restriction | list | union)) : ''
6839             id = ID
6840             targetNamespace = anyURI
6841             version = token
6842             xml:lang = language
6843             {any attributes with non-schema namespace . . .}>
6844             Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*)
6845              
6846             =cut
6847              
6848             #===============================================================================
6849              
6850             =item $Object = Rinchi::XMLSchema::Schema->new();
6851              
6852             Create a new Rinchi::XMLSchema::Schema object.
6853              
6854             =cut
6855              
6856             sub new() {
6857             my $class = shift;
6858             $class = ref($class) || $class;
6859             my $self = {};
6860             bless($self,$class);
6861            
6862             $self->{'_content_'} = [];
6863             $self->{'_elements'} = undef;
6864             $self->{'_attributes'} = undef;
6865             $self->{'_types'} = undef;
6866             $self->{'_groups'} = undef;
6867             $self->{'_attributeGroups'} = undef;
6868             $self->{'_notations'} = undef;
6869             $self->{'_identityConstraints'} = undef;
6870            
6871             return $self;
6872             }
6873              
6874             #===============================================================================
6875             # Rinchi::XMLSchema::Schema::attributeFormDefault
6876              
6877             =item $value = $Object->attributeFormDefault([$new_value]);
6878              
6879             Set or get value of the 'attributeFormDefault' attribute.
6880              
6881             =cut
6882              
6883             sub attributeFormDefault() {
6884             my $self = shift;
6885             if (@_) {
6886             if ($_[0] =~ /^qualified|unqualified$/) {
6887             $self->{'_attributeFormDefault'} = shift;
6888             } else {
6889             carp 'Found value \'' . $_[0] . '\', expecting value \'qualified | unqualified\'.';
6890             }
6891             }
6892             return $self->{'_attributeFormDefault'};
6893             }
6894              
6895             #===============================================================================
6896             # Rinchi::XMLSchema::Schema::blockDefault
6897              
6898             =item $value = $Object->blockDefault([$new_value]);
6899              
6900             Set or get value of the 'blockDefault' attribute.
6901              
6902             =cut
6903              
6904             sub blockDefault() {
6905             my $self = shift;
6906             if (@_) {
6907             if ($_[0] =~ /^#all$|^(extension|restriction|substitution)(\s+(extension|restriction|substitution))*$/) {
6908             $self->{'_blockDefault'} = shift;
6909             } else {
6910             carp 'Found value \'' . $_[0] . '\', expecting value \'#all\' or a list of \'extension | restriction | substitution\'.';
6911             }
6912             }
6913             return $self->{'_blockDefault'};
6914             }
6915              
6916             #===============================================================================
6917             # Rinchi::XMLSchema::Schema::elementFormDefault
6918              
6919             =item $value = $Object->elementFormDefault([$new_value]);
6920              
6921             Set or get value of the 'elementFormDefault' attribute.
6922              
6923             =cut
6924              
6925             sub elementFormDefault() {
6926             my $self = shift;
6927             if (@_) {
6928             if ($_[0] =~ /^qualified|unqualified$/) {
6929             $self->{'_elementFormDefault'} = shift;
6930             } else {
6931             carp 'Found value \'' . $_[0] . '\', expecting value \'qualified | unqualified\'.'
6932             }
6933             }
6934             return $self->{'_elementFormDefault'};
6935             }
6936              
6937             #===============================================================================
6938             # Rinchi::XMLSchema::Schema::finalDefault
6939              
6940             =item $value = $Object->finalDefault([$new_value]);
6941              
6942             Set or get value of the 'finalDefault' attribute.
6943              
6944             =cut
6945              
6946             sub finalDefault() {
6947             my $self = shift;
6948             if (@_) {
6949             if ($_[0] =~ /^#all$|^(extension|restriction)(\s+(extension|restriction))*$/) {
6950             $self->{'_finalDefault'} = shift;
6951             } else {
6952             carp 'Found value \'' . $_[0] . '\', expecting value \'#all\' or a list of \'extension | restriction\'.'
6953             }
6954             }
6955             return $self->{'_finalDefault'};
6956             }
6957              
6958             #===============================================================================
6959             # Rinchi::XMLSchema::Schema::id
6960              
6961             =item $value = $Object->id([$new_value]);
6962              
6963             Set or get value of the 'id' attribute.
6964              
6965             =cut
6966              
6967             sub id() {
6968             my $self = shift;
6969             if (@_) {
6970             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
6971             $self->{'_id'} = shift;
6972             } else {
6973             carp 'Found value \'' . $_[0] . '\', expecting ID.'
6974             }
6975             }
6976             return $self->{'_id'};
6977             }
6978              
6979             #===============================================================================
6980             # Rinchi::XMLSchema::Schema::targetNamespace
6981              
6982             =item $value = $Object->targetNamespace([$new_value]);
6983              
6984             Set or get value of the 'targetNamespace' attribute.
6985              
6986             =cut
6987              
6988             sub targetNamespace() {
6989             my $self = shift;
6990             if (@_) {
6991             $self->{'_targetNamespace'} = shift;
6992             }
6993             return $self->{'_targetNamespace'};
6994             }
6995              
6996             #===============================================================================
6997             # Rinchi::XMLSchema::Schema::version
6998              
6999             =item $value = $Object->version([$new_value]);
7000              
7001             Set or get value of the 'version' attribute.
7002              
7003             =cut
7004              
7005             sub version() {
7006             my $self = shift;
7007             if (@_) {
7008             $self->{'_version'} = shift;
7009             }
7010             return $self->{'_version'};
7011             }
7012              
7013             #===============================================================================
7014             # Rinchi::XMLSchema::Schema::xml:lang
7015              
7016             =item $value = $Object->xml_lang([$new_value]);
7017              
7018             Set or get value of the 'xml:lang' attribute.
7019              
7020             =cut
7021              
7022             sub xml_lang() {
7023             my $self = shift;
7024             if (@_) {
7025             $self->{'_xml:lang'} = shift;
7026             }
7027             return $self->{'_xml:lang'};
7028             }
7029              
7030             #===============================================================================
7031             # Rinchi::XMLSchema::Schema::xmlns
7032              
7033             =item $value = $Object->xmlns([$new_value]);
7034              
7035             Set or get value of the 'xmlns' attribute.
7036              
7037             =cut
7038              
7039             sub xmlns() {
7040             my $self = shift;
7041             if (@_) {
7042             $self->{'_xmlns'} = shift;
7043             }
7044             return $self->{'_xmlns'};
7045             }
7046              
7047             #===============================================================================
7048             # Rinchi::XMLSchema::Schema::xmlns:xs
7049              
7050             =item $value = $Object->xmlns_xs([$new_value]);
7051              
7052             Set or get value of the 'xmlns:xs' attribute.
7053              
7054             =cut
7055              
7056             sub xmlns_xs() {
7057             my $self = shift;
7058             if (@_) {
7059             $self->{'_xmlns:xs'} = shift;
7060             }
7061             return $self->{'_xmlns:xs'};
7062             }
7063              
7064             #===============================================================================
7065             sub _classify_content() {
7066             my $self = shift;
7067            
7068             foreach my $c (@{$self->{'_content_'}}) {
7069             my $cref = ref($c);
7070             if ($cref eq 'Rinchi::XMLSchema::Element') {
7071             if (exists($c->{'_ref'})) {
7072             delete $c->{'_ref'};
7073             carp "The attribute 'ref' is prohibited in a top-level element.";
7074             }
7075             if (exists($c->{'_form'})) {
7076             delete $c->{'_form'};
7077             carp "The attribute 'form' is prohibited in a top-level element.";
7078             }
7079             if (exists($c->{'_minOccurs'})) {
7080             delete $c->{'_minOccurs'};
7081             carp "The attribute 'minOccurs' is prohibited in a top-level element.";
7082             }
7083             if (exists($c->{'_maxOccurs'})) {
7084             delete $c->{'_maxOccurs'};
7085             carp "The attribute 'maxOccurs' is prohibited in a top-level element.";
7086             }
7087             unless (exists($c->{'_name'})) {
7088             carp "The attribute 'name' is required in a top-level element.";
7089             }
7090             $self->{'_elements'}{$c->name()} = $c;
7091             }
7092             elsif ($cref eq 'Rinchi::XMLSchema::Attribute') {
7093             $self->{'_attributes'}{$c->name()} = $c;
7094             }
7095             elsif ($cref eq 'Rinchi::XMLSchema::ComplexType') {
7096             $self->{'_types'}{$c->name()} = $c;
7097             }
7098             elsif ($cref eq 'Rinchi::XMLSchema::SimpleType') {
7099             $self->{'_types'}{$c->name()} = $c;
7100             }
7101             elsif ($cref eq 'Rinchi::XMLSchema::Group') {
7102             $self->{'_groups'}{$c->name()} = $c;
7103             }
7104             elsif ($cref eq 'Rinchi::XMLSchema::AttributeGroup') {
7105             $self->{'_attributeGroups'}{$c->name()} = $c;
7106             }
7107             elsif ($cref eq 'Rinchi::XMLSchema::Notation') {
7108             $self->{'_Notations'}{$c->name()} = $c;
7109             }
7110             }
7111             }
7112              
7113             #===============================================================================
7114             # Rinchi::XMLSchema::Schema::elements
7115              
7116             =item $value = $Object->elements();
7117              
7118             Get the top-level element objects.
7119              
7120             =cut
7121              
7122             sub elements() {
7123             my $self = shift;
7124             unless (defined($self->{'_elements'})) {
7125             $self->_classify_content();
7126             }
7127             return $self->{'_elements'};
7128             }
7129              
7130             #===============================================================================
7131             # Rinchi::XMLSchema::Schema::attributes
7132              
7133             =item $value = $Object->attributes();
7134              
7135             Get the top-level attribute objects.
7136              
7137             =cut
7138              
7139             sub attributes() {
7140             my $self = shift;
7141             unless (defined($self->{'_attributes'})) {
7142             $self->_classify_content();
7143             }
7144             return $self->{'_attributes'};
7145             }
7146              
7147             #===============================================================================
7148             # Rinchi::XMLSchema::Schema::types
7149              
7150             =item $value = $Object->types();
7151              
7152             Get the top-level type objects.
7153              
7154             =cut
7155              
7156             sub types() {
7157             my $self = shift;
7158             unless (defined($self->{'_types'})) {
7159             $self->_classify_content();
7160             }
7161             return $self->{'_types'};
7162             }
7163              
7164             #===============================================================================
7165             # Rinchi::XMLSchema::Schema::groups
7166              
7167             =item $value = $Object->groups();
7168              
7169             Get the top-level groups objects.
7170              
7171             =cut
7172              
7173             sub groups() {
7174             my $self = shift;
7175             unless (defined($self->{'_groups'})) {
7176             $self->_classify_content();
7177             }
7178             return $self->{'_groups'};
7179             }
7180              
7181             #===============================================================================
7182             # Rinchi::XMLSchema::Schema::attributeGroups
7183              
7184             =item $value = $Object->attributeGroups();
7185              
7186             Get the top-level attributeGroups objects.
7187              
7188             =cut
7189              
7190             sub attributeGroups() {
7191             my $self = shift;
7192             unless (defined($self->{'_attributeGroups'})) {
7193             $self->_classify_content();
7194             }
7195             return $self->{'_attributeGroups'};
7196             }
7197              
7198             #===============================================================================
7199             # Rinchi::XMLSchema::Schema::notations
7200              
7201             =item $value = $Object->notations();
7202              
7203             Get the top-level notation objects.
7204              
7205             =cut
7206              
7207             sub notations() {
7208             my $self = shift;
7209             unless (defined($self->{'_notations'})) {
7210             $self->_classify_content();
7211             }
7212             return $self->{'_notations'};
7213             }
7214              
7215             #===============================================================================
7216             # Rinchi::XMLSchema::Schema::identityConstraints
7217              
7218             =item $value = $Object->identityConstraints();
7219              
7220             Get the top-level identityConstraint objects.
7221              
7222             =cut
7223              
7224             sub identityConstraints() {
7225             my $self = shift;
7226             unless (defined($self->{'_identityConstraints'})) {
7227             $self->_find_identityConstraints($self);
7228             }
7229             return $self->{'_identityConstraints'};
7230             }
7231              
7232             #===============================================================================
7233             # Rinchi::XMLSchema::Schema::sameAs
7234              
7235             =item $value = $Object->sameAs($other);
7236              
7237             Compares self to other returning 1 if they are the same, 0 otherwise;
7238              
7239             =cut
7240              
7241             sub sameAs() {
7242             my $self = shift @_;
7243             my $other = shift @_;
7244              
7245             return 0 unless (ref($other) eq ref($self));
7246              
7247             if (exists($self->{'_attributeFormDefault'})) {
7248             if (exists($other->{'_attributeFormDefault'})) {
7249             return 0 unless ($self->{'_attributeFormDefault'} eq $other->{'_attributeFormDefault'});
7250             } else {
7251             return 0;
7252             }
7253             } else {
7254             return 0 if (exists($other->{'_attributeFormDefault'}));
7255             }
7256              
7257             if (exists($self->{'_blockDefault'})) {
7258             if (exists($other->{'_blockDefault'})) {
7259             return 0 unless ($self->{'_blockDefault'} eq $other->{'_blockDefault'});
7260             } else {
7261             return 0;
7262             }
7263             } else {
7264             return 0 if (exists($other->{'_blockDefault'}));
7265             }
7266              
7267             if (exists($self->{'_elementFormDefault'})) {
7268             if (exists($other->{'_elementFormDefault'})) {
7269             return 0 unless ($self->{'_elementFormDefault'} eq $other->{'_elementFormDefault'});
7270             } else {
7271             return 0;
7272             }
7273             } else {
7274             return 0 if (exists($other->{'_elementFormDefault'}));
7275             }
7276              
7277             if (exists($self->{'_finalDefault'})) {
7278             if (exists($other->{'_finalDefault'})) {
7279             return 0 unless ($self->{'_finalDefault'} eq $other->{'_finalDefault'});
7280             } else {
7281             return 0;
7282             }
7283             } else {
7284             return 0 if (exists($other->{'_finalDefault'}));
7285             }
7286              
7287             if (exists($self->{'_targetNamespace'})) {
7288             if (exists($other->{'_targetNamespace'})) {
7289             return 0 unless ($self->{'_targetNamespace'} eq $other->{'_targetNamespace'});
7290             } else {
7291             return 0;
7292             }
7293             } else {
7294             return 0 if (exists($other->{'_targetNamespace'}));
7295             }
7296              
7297             if (exists($self->{'_version'})) {
7298             if (exists($other->{'_version'})) {
7299             return 0 unless ($self->{'_version'} eq $other->{'_version'});
7300             } else {
7301             return 0;
7302             }
7303             } else {
7304             return 0 if (exists($other->{'_version'}));
7305             }
7306              
7307             if (exists($self->{'_xml:lang'})) {
7308             if (exists($other->{'_xml:lang'})) {
7309             return 0 unless ($self->{'_xml:lang'} eq $other->{'_xml:lang'});
7310             } else {
7311             return 0;
7312             }
7313             } else {
7314             return 0 if (exists($other->{'_xml:lang'}));
7315             }
7316              
7317             if (exists($self->{'_xmlns'})) {
7318             if (exists($other->{'_xmlns'})) {
7319             return 0 unless ($self->{'_xmlns'} eq $other->{'_xmlns'});
7320             } else {
7321             return 0;
7322             }
7323             } else {
7324             return 0 if (exists($other->{'_xmlns'}));
7325             }
7326              
7327             if (exists($self->{'_xmlns:xs'})) {
7328             if (exists($other->{'_xmlns:xs'})) {
7329             return 0 unless ($self->{'_xmlns:xs'} eq $other->{'_xmlns:xs'});
7330             } else {
7331             return 0;
7332             }
7333             } else {
7334             return 0 if (exists($other->{'_xmlns:xs'}));
7335             }
7336              
7337             my @self_cont = @{$self->{'_content_'}};
7338             my @other_cont = @{$other->{'_content_'}};
7339             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
7340             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
7341              
7342             if (@self_cont) {
7343             if (@other_cont) {
7344             while (@self_cont and @other_cont) {
7345             my $sc = shift @self_cont;
7346             my $oc = shift @other_cont;
7347             return 0 unless($sc->sameAs($oc));
7348             }
7349             return (0) if (@self_cont or @other_cont);
7350             } else {
7351             return 0;
7352             }
7353             } else {
7354             return 0 if (@other_cont);
7355             }
7356              
7357             return 1;
7358             }
7359              
7360             #===============================================================================
7361              
7362             package Rinchi::XMLSchema::Selector;
7363              
7364             use Carp;
7365              
7366             our @ISA = qw(Rinchi::XMLSchema);
7367              
7368             our @EXPORT = qw();
7369             our @EXPORT_OK = qw();
7370              
7371             =head1 DESCRIPTION of Selector class
7372              
7373             Rinchi::XMLSchema::Selector is used for creating XML Schema Selector objects.
7374              
7375             id = ID
7376             xpath = a subset of XPath expression, see below
7377             {any attributes with non-schema namespace ...}>
7378             Content: (annotation?)
7379              
7380             =cut
7381              
7382             #===============================================================================
7383              
7384             =item $Object = Rinchi::XMLSchema::Selector->new();
7385              
7386             Create a new Rinchi::XMLSchema::Selector object.
7387              
7388             =cut
7389              
7390             sub new() {
7391             my $class = shift;
7392             $class = ref($class) || $class;
7393             my $self = {};
7394             bless($self,$class);
7395             $self->{'_content_'} = [];
7396             return $self;
7397             }
7398              
7399             #===============================================================================
7400             # Rinchi::XMLSchema::Selector::id
7401              
7402             =item $value = $Object->id([$new_value]);
7403              
7404             Set or get value of the 'id' attribute.
7405              
7406             =cut
7407              
7408             sub id() {
7409             my $self = shift;
7410             if (@_) {
7411             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
7412             $self->{'_id'} = shift;
7413             } else {
7414             carp 'Found value \'' . $_[0] . '\', expecting ID.'
7415             }
7416             }
7417             return $self->{'_id'};
7418             }
7419              
7420             #===============================================================================
7421             # Rinchi::XMLSchema::Selector::xpath
7422              
7423             =item $value = $Object->xpath([$new_value]);
7424              
7425             Set or get value of the 'xpath' attribute.
7426              
7427             =cut
7428              
7429             sub xpath() {
7430             my $self = shift;
7431             if (@_) {
7432             $self->{'_xpath'} = shift;
7433             }
7434             return $self->{'_xpath'};
7435             }
7436              
7437             #===============================================================================
7438             # Rinchi::XMLSchema::Selector::sameAs
7439              
7440             =item $value = $Object->sameAs($other);
7441              
7442             Compares self to other returning 1 if they are the same, 0 otherwise;
7443              
7444             =cut
7445              
7446             sub sameAs() {
7447             my $self = shift @_;
7448             my $other = shift @_;
7449              
7450             return 0 unless (ref($other) eq ref($self));
7451              
7452             if (exists($self->{'_xpath'})) {
7453             if (exists($other->{'_xpath'})) {
7454             return 0 unless ($self->{'_xpath'} eq $other->{'_xpath'});
7455             } else {
7456             return 0;
7457             }
7458             } else {
7459             return 0 if (exists($other->{'_xpath'}));
7460             }
7461              
7462             return 1;
7463             }
7464              
7465             #===============================================================================
7466              
7467             package Rinchi::XMLSchema::Sequence;
7468              
7469             use Carp;
7470              
7471             our @ISA = qw(Rinchi::XMLSchema);
7472              
7473             our @EXPORT = qw();
7474             our @EXPORT_OK = qw();
7475              
7476             =head1 DESCRIPTION of Sequence class
7477              
7478             Rinchi::XMLSchema::Sequence is used for creating XML Schema Sequence objects.
7479              
7480             id = ID
7481             maxOccurs = (nonNegativeInteger | unbounded) : 1
7482             minOccurs = nonNegativeInteger : 1
7483             {any attributes with non-schema namespace ...}>
7484             Content: (annotation?, (element | group | choice | sequence | any)*)
7485              
7486             =cut
7487              
7488             #===============================================================================
7489              
7490             =item $Object = Rinchi::XMLSchema::Sequence->new();
7491              
7492             Create a new Rinchi::XMLSchema::Sequence object.
7493              
7494             =cut
7495              
7496             sub new() {
7497             my $class = shift;
7498             $class = ref($class) || $class;
7499             my $self = {};
7500             bless($self,$class);
7501             $self->{'_content_'} = [];
7502             return $self;
7503             }
7504              
7505             #===============================================================================
7506             # Rinchi::XMLSchema::Sequence::id
7507              
7508             =item $value = $Object->id([$new_value]);
7509              
7510             Set or get value of the 'id' attribute.
7511              
7512             =cut
7513              
7514             sub id() {
7515             my $self = shift;
7516             if (@_) {
7517             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
7518             $self->{'_id'} = shift;
7519             } else {
7520             carp 'Found value \'' . $_[0] . '\', expecting ID.'
7521             }
7522             }
7523             return $self->{'_id'};
7524             }
7525              
7526             #===============================================================================
7527             # Rinchi::XMLSchema::Sequence::maxOccurs
7528              
7529             =item $value = $Object->maxOccurs([$new_value]);
7530              
7531             Set or get value of the 'maxOccurs' attribute.
7532              
7533             =cut
7534              
7535             sub maxOccurs() {
7536             my $self = shift;
7537             if (@_) {
7538             $self->{'_maxOccurs'} = shift;
7539             }
7540             return $self->{'_maxOccurs'};
7541             }
7542              
7543             #===============================================================================
7544             # Rinchi::XMLSchema::Sequence::minOccurs
7545              
7546             =item $value = $Object->minOccurs([$new_value]);
7547              
7548             Set or get value of the 'minOccurs' attribute.
7549              
7550             =cut
7551              
7552             sub minOccurs() {
7553             my $self = shift;
7554             if (@_) {
7555             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
7556             $self->{'_minOccurs'} = shift;
7557             } else {
7558             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
7559             }
7560             }
7561             return $self->{'_minOccurs'};
7562             }
7563              
7564             #===============================================================================
7565             # Rinchi::XMLSchema::Sequence::sameAs
7566              
7567             =item $value = $Object->sameAs($other);
7568              
7569             Compares self to other returning 1 if they are the same, 0 otherwise;
7570              
7571             =cut
7572              
7573             sub sameAs() {
7574             my $self = shift @_;
7575             my $other = shift @_;
7576              
7577             return 0 unless (ref($other) eq ref($self));
7578              
7579             if (exists($self->{'_maxOccurs'})) {
7580             if (exists($other->{'_maxOccurs'})) {
7581             return 0 unless ($self->{'_maxOccurs'} eq $other->{'_maxOccurs'});
7582             } else {
7583             return 0;
7584             }
7585             } else {
7586             return 0 if (exists($other->{'_maxOccurs'}));
7587             }
7588              
7589             if (exists($self->{'_minOccurs'})) {
7590             if (exists($other->{'_minOccurs'})) {
7591             return 0 unless ($self->{'_minOccurs'} eq $other->{'_minOccurs'});
7592             } else {
7593             return 0;
7594             }
7595             } else {
7596             return 0 if (exists($other->{'_minOccurs'}));
7597             }
7598              
7599             my @self_cont = @{$self->{'_content_'}};
7600             my @other_cont = @{$other->{'_content_'}};
7601             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
7602             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
7603              
7604             if (@self_cont) {
7605             if (@other_cont) {
7606             while (@self_cont and @other_cont) {
7607             my $sc = shift @self_cont;
7608             my $oc = shift @other_cont;
7609             return 0 unless($sc->sameAs($oc));
7610             }
7611             return (0) if (@self_cont or @other_cont);
7612             } else {
7613             return 0;
7614             }
7615             } else {
7616             return 0 if (@other_cont);
7617             }
7618              
7619             return 1;
7620             }
7621              
7622             #===============================================================================
7623              
7624             package Rinchi::XMLSchema::SimpleContent;
7625              
7626             use Carp;
7627              
7628             our @ISA = qw(Rinchi::XMLSchema);
7629              
7630             our @EXPORT = qw();
7631             our @EXPORT_OK = qw();
7632              
7633             =head1 DESCRIPTION of SimpleContent class
7634              
7635             Rinchi::XMLSchema::SimpleContent is used for creating XML Schema SimpleContent objects.
7636              
7637             =cut
7638              
7639             #===============================================================================
7640              
7641             =item $Object = Rinchi::XMLSchema::SimpleContent->new();
7642              
7643             Create a new Rinchi::XMLSchema::SimpleContent object.
7644              
7645             =cut
7646              
7647             sub new() {
7648             my $class = shift;
7649             $class = ref($class) || $class;
7650             my $self = {};
7651             bless($self,$class);
7652             $self->{'_content_'} = [];
7653             return $self;
7654             }
7655              
7656             #===============================================================================
7657             # Rinchi::XMLSchema::SimpleContent::id
7658              
7659             =item $value = $Object->id([$new_value]);
7660              
7661             Set or get value of the 'id' attribute.
7662              
7663             =cut
7664              
7665             sub id() {
7666             my $self = shift;
7667             if (@_) {
7668             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
7669             $self->{'_id'} = shift;
7670             } else {
7671             carp 'Found value \'' . $_[0] . '\', expecting ID.'
7672             }
7673             }
7674             return $self->{'_id'};
7675             }
7676              
7677             #===============================================================================
7678             # Rinchi::XMLSchema::SimpleContent::sameAs
7679              
7680             =item $value = $Object->sameAs($other);
7681              
7682             Compares self to other returning 1 if they are the same, 0 otherwise;
7683              
7684             =cut
7685              
7686             sub sameAs() {
7687             my $self = shift @_;
7688             my $other = shift @_;
7689              
7690             return 0 unless (ref($other) eq ref($self));
7691              
7692             my @self_cont = @{$self->{'_content_'}};
7693             my @other_cont = @{$other->{'_content_'}};
7694             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
7695             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
7696              
7697             if (@self_cont) {
7698             if (@other_cont) {
7699             while (@self_cont and @other_cont) {
7700             my $sc = shift @self_cont;
7701             my $oc = shift @other_cont;
7702             return 0 unless($sc->sameAs($oc));
7703             }
7704             return (0) if (@self_cont or @other_cont);
7705             } else {
7706             return 0;
7707             }
7708             } else {
7709             return 0 if (@other_cont);
7710             }
7711              
7712             return 1;
7713             }
7714              
7715             #===============================================================================
7716              
7717             package Rinchi::XMLSchema::SimpleType;
7718              
7719             use Carp;
7720              
7721             our @ISA = qw(Rinchi::XMLSchema);
7722              
7723             our @EXPORT = qw();
7724             our @EXPORT_OK = qw();
7725              
7726             =head1 DESCRIPTION of SimpleType class
7727              
7728             Rinchi::XMLSchema::SimpleType is used for creating XML Schema SimpleType objects.
7729              
7730             final = (#all | List of (list | union | restriction))
7731             id = ID
7732             name = NCName
7733             {any attributes with non-schema namespace ...}>
7734             Content: (annotation?, (restriction | list | union))
7735              
7736             =cut
7737              
7738             #===============================================================================
7739              
7740             =item $Object = Rinchi::XMLSchema::SimpleType->new();
7741              
7742             Create a new Rinchi::XMLSchema::SimpleType object.
7743              
7744             =cut
7745              
7746             sub new() {
7747             my $class = shift;
7748             $class = ref($class) || $class;
7749             my $self = {};
7750             bless($self,$class);
7751             $self->{'_content_'} = [];
7752             return $self;
7753             }
7754              
7755             #===============================================================================
7756             # Rinchi::XMLSchema::SimpleType::final
7757              
7758             =item $value = $Object->final([$new_value]);
7759              
7760             Set or get value of the 'final' attribute.
7761              
7762             =cut
7763              
7764             sub final() {
7765             my $self = shift;
7766             if (@_) {
7767             $self->{'_final'} = shift;
7768             }
7769             return $self->{'_final'};
7770             }
7771              
7772             #===============================================================================
7773             # Rinchi::XMLSchema::SimpleType::id
7774              
7775             =item $value = $Object->id([$new_value]);
7776              
7777             Set or get value of the 'id' attribute.
7778              
7779             =cut
7780              
7781             sub id() {
7782             my $self = shift;
7783             if (@_) {
7784             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
7785             $self->{'_id'} = shift;
7786             } else {
7787             carp 'Found value \'' . $_[0] . '\', expecting ID.'
7788             }
7789             }
7790             return $self->{'_id'};
7791             }
7792              
7793             #===============================================================================
7794             # Rinchi::XMLSchema::SimpleType::name
7795              
7796             =item $value = $Object->name([$new_value]);
7797              
7798             Set or get value of the 'name' attribute.
7799              
7800             =cut
7801              
7802             sub name() {
7803             my $self = shift;
7804             if (@_) {
7805             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
7806             $self->{'_name'} = shift;
7807             } else {
7808             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
7809             }
7810             }
7811             return $self->{'_name'};
7812             }
7813              
7814             #===============================================================================
7815             # Rinchi::XMLSchema::SimpleType::sameAs
7816              
7817             =item $value = $Object->sameAs($other);
7818              
7819             Compares self to other returning 1 if they are the same, 0 otherwise;
7820              
7821             =cut
7822              
7823             sub sameAs() {
7824             my $self = shift @_;
7825             my $other = shift @_;
7826            
7827             return 0 unless (ref($other) eq ref($self));
7828              
7829             if (exists($self->{'_final'})) {
7830             if (exists($other->{'_final'})) {
7831             return 0 unless ($self->{'_final'} eq $other->{'_final'});
7832             } else {
7833             return 0;
7834             }
7835             } else {
7836             return 0 if (exists($other->{'_final'}));
7837             }
7838              
7839             if (exists($self->{'_name'})) {
7840             if (exists($other->{'_name'})) {
7841             return 0 unless ($self->{'_name'} eq $other->{'_name'});
7842             } else {
7843             return 0;
7844             }
7845             } else {
7846             return 0 if (exists($other->{'_name'}));
7847             }
7848              
7849             my @self_cont = @{$self->{'_content_'}};
7850             my @other_cont = @{$other->{'_content_'}};
7851             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
7852             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
7853              
7854             if (@self_cont) {
7855             if (@other_cont) {
7856             while (@self_cont and @other_cont) {
7857             my $sc = shift @self_cont;
7858             my $oc = shift @other_cont;
7859             return 0 unless($sc->sameAs($oc));
7860             }
7861             return (0) if (@self_cont or @other_cont);
7862             } else {
7863             return 0;
7864             }
7865             } else {
7866             return 0 if (@other_cont);
7867             }
7868            
7869             return 1;
7870             }
7871              
7872             #===============================================================================
7873              
7874             package Rinchi::XMLSchema::TotalDigits;
7875              
7876             use Carp;
7877              
7878             our @ISA = qw(Rinchi::XMLSchema);
7879              
7880             our @EXPORT = qw();
7881             our @EXPORT_OK = qw();
7882              
7883             =head1 DESCRIPTION of TotalDigits class
7884              
7885             Rinchi::XMLSchema::TotalDigits is used for creating XML Schema TotalDigits objects.
7886              
7887             =cut
7888              
7889             #===============================================================================
7890              
7891             =item $Object = Rinchi::XMLSchema::TotalDigits->new();
7892              
7893             Create a new Rinchi::XMLSchema::TotalDigits object.
7894              
7895             =cut
7896              
7897             sub new() {
7898             my $class = shift;
7899             $class = ref($class) || $class;
7900             my $self = {};
7901             bless($self,$class);
7902             $self->{'_content_'} = [];
7903             return $self;
7904             }
7905              
7906             #===============================================================================
7907             # Rinchi::XMLSchema::TotalDigits::fixed
7908              
7909             =item $value = $Object->fixed([$new_value]);
7910              
7911             Set or get value of the 'fixed' attribute.
7912              
7913             =cut
7914              
7915             sub fixed() {
7916             my $self = shift;
7917             if (@_) {
7918             if ($_[0] =~ /^true|false$/) {
7919             $self->{'_fixed'} = shift;
7920             } else {
7921             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
7922             }
7923             }
7924             return $self->{'_fixed'};
7925             }
7926              
7927             #===============================================================================
7928             # Rinchi::XMLSchema::TotalDigits::id
7929              
7930             =item $value = $Object->id([$new_value]);
7931              
7932             Set or get value of the 'id' attribute.
7933              
7934             =cut
7935              
7936             sub id() {
7937             my $self = shift;
7938             if (@_) {
7939             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
7940             $self->{'_id'} = shift;
7941             } else {
7942             carp 'Found value \'' . $_[0] . '\', expecting ID.'
7943             }
7944             }
7945             return $self->{'_id'};
7946             }
7947              
7948             #===============================================================================
7949             # Rinchi::XMLSchema::TotalDigits::value
7950              
7951             =item $value = $Object->value([$new_value]);
7952              
7953             Set or get value of the 'value' attribute.
7954              
7955             =cut
7956              
7957             sub value() {
7958             my $self = shift;
7959             if (@_) {
7960             $self->{'_value'} = shift;
7961             }
7962             return $self->{'_value'};
7963             }
7964              
7965             #===============================================================================
7966             # Rinchi::XMLSchema::TotalDigits::sameAs
7967              
7968             =item $value = $Object->sameAs($other);
7969              
7970             Compares self to other returning 1 if they are the same, 0 otherwise;
7971              
7972             =cut
7973              
7974             sub sameAs() {
7975             my $self = shift @_;
7976             my $other = shift @_;
7977              
7978             return 0 unless (ref($other) eq ref($self));
7979              
7980             if (exists($self->{'_fixed'})) {
7981             if (exists($other->{'_fixed'})) {
7982             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
7983             } else {
7984             return 0;
7985             }
7986             } else {
7987             return 0 if (exists($other->{'_fixed'}));
7988             }
7989              
7990             if (exists($self->{'_value'})) {
7991             if (exists($other->{'_value'})) {
7992             return 0 unless ($self->{'_value'} eq $other->{'_value'});
7993             } else {
7994             return 0;
7995             }
7996             } else {
7997             return 0 if (exists($other->{'_value'}));
7998             }
7999              
8000             return 1;
8001             }
8002              
8003             #===============================================================================
8004              
8005             package Rinchi::XMLSchema::Union;
8006              
8007             use Carp;
8008              
8009             our @ISA = qw(Rinchi::XMLSchema);
8010              
8011             our @EXPORT = qw();
8012             our @EXPORT_OK = qw();
8013              
8014             =head1 DESCRIPTION of Union class
8015              
8016             Rinchi::XMLSchema::Union is used for creating XML Schema Union objects.
8017              
8018             id = ID
8019             memberTypes = List of QName
8020             {any attributes with non-schema namespace ...}>
8021             Content: (annotation?, simpleType*)
8022              
8023             =cut
8024              
8025             #===============================================================================
8026              
8027             =item $Object = Rinchi::XMLSchema::Union->new();
8028              
8029             Create a new Rinchi::XMLSchema::Union object.
8030              
8031             =cut
8032              
8033             sub new() {
8034             my $class = shift;
8035             $class = ref($class) || $class;
8036             my $self = {};
8037             bless($self,$class);
8038             $self->{'_content_'} = [];
8039             return $self;
8040             }
8041              
8042             #===============================================================================
8043             # Rinchi::XMLSchema::Union::id
8044              
8045             =item $value = $Object->id([$new_value]);
8046              
8047             Set or get value of the 'id' attribute.
8048              
8049             =cut
8050              
8051             sub id() {
8052             my $self = shift;
8053             if (@_) {
8054             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
8055             $self->{'_id'} = shift;
8056             } else {
8057             carp 'Found value \'' . $_[0] . '\', expecting ID.'
8058             }
8059             }
8060             return $self->{'_id'};
8061             }
8062              
8063             #===============================================================================
8064             # Rinchi::XMLSchema::Union::memberTypes
8065              
8066             =item $value = $Object->memberTypes([$new_value]);
8067              
8068             Set or get value of the 'memberTypes' attribute.
8069              
8070             =cut
8071              
8072             sub memberTypes() {
8073             my $self = shift;
8074             if (@_) {
8075             if ($_[0] =~ /^[-0-9A-Za-z_.:]+(\s+[-0-9A-Za-z_.:]+)*$/) {
8076             $self->{'_memberTypes'} = shift;
8077             } else {
8078             carp 'Found value \'' . $_[0] . '\', expecting NMTOKENS.'
8079             }
8080             }
8081             return $self->{'_memberTypes'};
8082             }
8083              
8084             #===============================================================================
8085             # Rinchi::XMLSchema::Union::sameAs
8086              
8087             =item $value = $Object->sameAs($other);
8088              
8089             Compares self to other returning 1 if they are the same, 0 otherwise;
8090              
8091             =cut
8092              
8093             sub sameAs() {
8094             my $self = shift @_;
8095             my $other = shift @_;
8096              
8097             return 0 unless (ref($other) eq ref($self));
8098              
8099             if (exists($self->{'_memberTypes'})) {
8100             if (exists($other->{'_memberTypes'})) {
8101             return 0 unless ($self->{'_memberTypes'} eq $other->{'_memberTypes'});
8102             } else {
8103             return 0;
8104             }
8105             } else {
8106             return 0 if (exists($other->{'_memberTypes'}));
8107             }
8108              
8109             my @self_cont = @{$self->{'_content_'}};
8110             my @other_cont = @{$other->{'_content_'}};
8111             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
8112             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
8113              
8114             if (@self_cont) {
8115             if (@other_cont) {
8116             while (@self_cont and @other_cont) {
8117             my $sc = shift @self_cont;
8118             my $oc = shift @other_cont;
8119             return 0 unless($sc->sameAs($oc));
8120             }
8121             return (0) if (@self_cont or @other_cont);
8122             } else {
8123             return 0;
8124             }
8125             } else {
8126             return 0 if (@other_cont);
8127             }
8128              
8129             return 1;
8130             }
8131              
8132             #===============================================================================
8133              
8134             package Rinchi::XMLSchema::Unique;
8135              
8136             use Carp;
8137              
8138             our @ISA = qw(Rinchi::XMLSchema);
8139              
8140             our @EXPORT = qw();
8141             our @EXPORT_OK = qw();
8142              
8143             =head1 DESCRIPTION of Unique class
8144              
8145             Rinchi::XMLSchema::Unique is used for creating XML Schema Unique objects.
8146              
8147             id = ID
8148             name = NCName
8149             {any attributes with non-schema namespace ...}>
8150             Content: (annotation?, (selector, field+))
8151              
8152             =cut
8153              
8154             #===============================================================================
8155              
8156             =item $Object = Rinchi::XMLSchema::Unique->new();
8157              
8158             Create a new Rinchi::XMLSchema::Unique object.
8159              
8160             =cut
8161              
8162             sub new() {
8163             my $class = shift;
8164             $class = ref($class) || $class;
8165             my $self = {};
8166             bless($self,$class);
8167             $self->{'_content_'} = [];
8168             return $self;
8169             }
8170              
8171             #===============================================================================
8172             # Rinchi::XMLSchema::Unique::id
8173              
8174             =item $value = $Object->id([$new_value]);
8175              
8176             Set or get value of the 'id' attribute.
8177              
8178             =cut
8179              
8180             sub id() {
8181             my $self = shift;
8182             if (@_) {
8183             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
8184             $self->{'_id'} = shift;
8185             } else {
8186             carp 'Found value \'' . $_[0] . '\', expecting ID.'
8187             }
8188             }
8189             return $self->{'_id'};
8190             }
8191              
8192             #===============================================================================
8193             # Rinchi::XMLSchema::Unique::name
8194              
8195             =item $value = $Object->name([$new_value]);
8196              
8197             Set or get value of the 'name' attribute.
8198              
8199             =cut
8200              
8201             sub name() {
8202             my $self = shift;
8203             if (@_) {
8204             if ($_[0] =~ /^[-0-9A-Za-z_.:]+$/) {
8205             $self->{'_name'} = shift;
8206             } else {
8207             carp 'Found value \'' . $_[0] . '\', expecting NMTOKEN.'
8208             }
8209             }
8210             return $self->{'_name'};
8211             }
8212              
8213             #===============================================================================
8214             # Rinchi::XMLSchema::Unique::sameAs
8215              
8216             =item $value = $Object->sameAs($other);
8217              
8218             Compares self to other returning 1 if they are the same, 0 otherwise;
8219              
8220             =cut
8221              
8222             sub sameAs() {
8223             my $self = shift @_;
8224             my $other = shift @_;
8225              
8226             return 0 unless (ref($other) eq ref($self));
8227              
8228             if (exists($self->{'_name'})) {
8229             if (exists($other->{'_name'})) {
8230             return 0 unless ($self->{'_name'} eq $other->{'_name'});
8231             } else {
8232             return 0;
8233             }
8234             } else {
8235             return 0 if (exists($other->{'_name'}));
8236             }
8237              
8238             my @self_cont = @{$self->{'_content_'}};
8239             my @other_cont = @{$other->{'_content_'}};
8240             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
8241             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
8242              
8243             if (@self_cont) {
8244             if (@other_cont) {
8245             while (@self_cont and @other_cont) {
8246             my $sc = shift @self_cont;
8247             my $oc = shift @other_cont;
8248             return 0 unless($sc->sameAs($oc));
8249             }
8250             return (0) if (@self_cont or @other_cont);
8251             } else {
8252             return 0;
8253             }
8254             } else {
8255             return 0 if (@other_cont);
8256             }
8257              
8258             return 1;
8259             }
8260              
8261             #===============================================================================
8262              
8263             package Rinchi::XMLSchema::WhiteSpace;
8264              
8265             use Carp;
8266              
8267             our @ISA = qw(Rinchi::XMLSchema);
8268              
8269             our @EXPORT = qw();
8270             our @EXPORT_OK = qw();
8271              
8272             =head1 DESCRIPTION of WhiteSpace class
8273              
8274             Rinchi::XMLSchema::WhiteSpace is used for creating XML Schema WhiteSpace objects.
8275              
8276             =cut
8277              
8278             #===============================================================================
8279              
8280             =item $Object = Rinchi::XMLSchema::WhiteSpace->new();
8281              
8282             Create a new Rinchi::XMLSchema::WhiteSpace object.
8283              
8284             =cut
8285              
8286             sub new() {
8287             my $class = shift;
8288             $class = ref($class) || $class;
8289             my $self = {};
8290             bless($self,$class);
8291             $self->{'_content_'} = [];
8292             return $self;
8293             }
8294              
8295             #===============================================================================
8296             # Rinchi::XMLSchema::WhiteSpace::fixed
8297              
8298             =item $value = $Object->fixed([$new_value]);
8299              
8300             Set or get value of the 'fixed' attribute.
8301              
8302             =cut
8303              
8304             sub fixed() {
8305             my $self = shift;
8306             if (@_) {
8307             if ($_[0] =~ /^true|false$/) {
8308             $self->{'_fixed'} = shift;
8309             } else {
8310             carp 'Found value \'' . $_[0] . '\', expecting value \'true | false\'.'
8311             }
8312             }
8313             return $self->{'_fixed'};
8314             }
8315              
8316             #===============================================================================
8317             # Rinchi::XMLSchema::WhiteSpace::id
8318              
8319             =item $value = $Object->id([$new_value]);
8320              
8321             Set or get value of the 'id' attribute.
8322              
8323             =cut
8324              
8325             sub id() {
8326             my $self = shift;
8327             if (@_) {
8328             if ($_[0] =~ /^[A-Za-z_][-0-9A-Za-z_.:]*$/) {
8329             $self->{'_id'} = shift;
8330             } else {
8331             carp 'Found value \'' . $_[0] . '\', expecting ID.'
8332             }
8333             }
8334             return $self->{'_id'};
8335             }
8336              
8337             #===============================================================================
8338             # Rinchi::XMLSchema::WhiteSpace::value
8339              
8340             =item $value = $Object->value([$new_value]);
8341              
8342             Set or get value of the 'value' attribute.
8343              
8344             =cut
8345              
8346             sub value() {
8347             my $self = shift;
8348             if (@_) {
8349             $self->{'_value'} = shift;
8350             }
8351             return $self->{'_value'};
8352             }
8353              
8354             #===============================================================================
8355             # Rinchi::XMLSchema::WhiteSpace::sameAs
8356              
8357             =item $value = $Object->sameAs($other);
8358              
8359             Compares self to other returning 1 if they are the same, 0 otherwise;
8360              
8361             =cut
8362              
8363             sub sameAs() {
8364             my $self = shift @_;
8365             my $other = shift @_;
8366              
8367             return 0 unless (ref($other) eq ref($self));
8368              
8369             if (exists($self->{'_fixed'})) {
8370             if (exists($other->{'_fixed'})) {
8371             return 0 unless ($self->{'_fixed'} eq $other->{'_fixed'});
8372             } else {
8373             return 0;
8374             }
8375             } else {
8376             return 0 if (exists($other->{'_fixed'}));
8377             }
8378              
8379             if (exists($self->{'_value'})) {
8380             if (exists($other->{'_value'})) {
8381             return 0 unless ($self->{'_value'} eq $other->{'_value'});
8382             } else {
8383             return 0;
8384             }
8385             } else {
8386             return 0 if (exists($other->{'_value'}));
8387             }
8388              
8389             my @self_cont = @{$self->{'_content_'}};
8390             my @other_cont = @{$other->{'_content_'}};
8391             shift @self_cont while(@self_cont and ref($self_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
8392             shift @other_cont while(@other_cont and ref($other_cont[0]) eq 'Rinchi::XMLSchema::Annotation');
8393              
8394             if (@self_cont) {
8395             if (@other_cont) {
8396             while (@self_cont and @other_cont) {
8397             my $sc = shift @self_cont;
8398             my $oc = shift @other_cont;
8399             return 0 unless($sc->sameAs($oc));
8400             }
8401             return (0) if (@self_cont or @other_cont);
8402             } else {
8403             return 0;
8404             }
8405             } else {
8406             return 0 if (@other_cont);
8407             }
8408              
8409             return 1;
8410             }
8411              
8412             #===============================================================================
8413              
8414             1
8415              
8416             __END__