Merge XSD documents (XML Schemas) in java program

Discussions

XML & Web services: Merge XSD documents (XML Schemas) in java program

  1. Merge XSD documents (XML Schemas) in java program (1 messages)

    Hello,

    I want to develop a webservice that returns a XSD (a string with the content of one XSD file to be more exactly). That webservice gets the XSD’s from a directory (or database). Now the tricky part:
    The XSD files can include or import other XSD files, but my webservice needs to return the content of 1 working XSD file. So I need code witch can merge a tree of multiple XSD files to one XSD file.

    Do you know where I can get this code?

    Thanks,

    Ward

    Threaded Messages (1)

  2. You can't[ Go to top ]

    You can't merge two arbitrary XSD's into one (what are you going to do with target namespaces?). Instead you could do:

       <wsdl:types>
          <xs:schema>
             <xs:import schemaLocation="a.xsd" namespace="http://a"/>
             <xs:import schemaLocation="b.xsd" namespace="http://b"/>
          </xs:schema>
       </wsdl:types>

    or

       <wsdl:types>
          <xs:schema targetNamesace="http://a"...>
             ...
          </xs:schema>
          <xs:schema targetNamesace="http://b"...>
             ...
          </xs:schema>
       </wsdl:types>

    Although later form might not be well supported by various buggy platforms.