[Xml-compile] Accessing schemaLocation attribute url values inside <include> elements

Mark Overmeer mark at overmeer.net
Fri Jul 16 11:04:38 GMT 2010


* Morad IGMIR (migmir at alliancemca.com) [100707 10:22]:
> Is there a method or clever hack to get a hold of 
> The urls in the schemaLocation of include elements such as these ? 

In general (>50% of the WSDLs), these schemaLocations are wrong.

> I'd like to be able to do something like this :
> $wsdl->importDefinitions( @{ $wsdl->{schema}{import}{schemaLocation} } );

One WSDL can have multiple schemas...

  foreach my $fragment ($wsdl->namespaces->allSchemas)
  {   # $fragment is an XML::Compile::Schema::Instance
      my @urls
       = ( $fragment->includeLocations
         , $fragment->importLocations
         );
  }

> Which would allow me to mind about the wsdl only, not urls inside code or
> config files.

Knowing that these are your own schema's. So, you could do:
   my @xsds = glob "$somewhere/*.xsd";
   $wsdl->importDefinitions(\@xsds);
-- 
Regards,

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list