[xsd-users] #include directives & relative paths

Moss, David R (SELEX Comms) (UK Christchurch) david.r.moss at selex-comm.com
Tue Dec 12 12:46:21 EST 2006


All,

Using xsd-2.3.1.b2-i686-windows and given the following file structure
on my disk:

--+ root
    + base
      + schema
          basic-types.xsd
      + generated
          basic-types.hxx

    + derived
      + schema
          derived-types.xsd
      + generated
          derived-types.hxx


And the following snippets of the xsd files shown above:

basic-types.xsd:

<xsd:schema xmlns:xsd      ="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.dave.com/ns1"
            xmlns:ns1      ="http://www.dave.com/ns1">

<xsd:complexType name="BaseType_t">
	// ...
</xsd:complexType>

</xsd:schema>


derived-types.xsd:

<xsd:schema xmlns:xsd=     "http://www.w3.org/2001/XMLSchema"
            xmlns:ns1=     "http://www.dave.com/ns1">

<xsd:import namespace      ="http://www.dave.com/ns1 "
            schemaLocation = "../../base/schema/basic-types.xsd"/>

<xsd:complexType name="DerivedType_t">
   <xsd:complexContent>
      <xsd:extension base="ns1:BaseType_t">
         <xsd:sequence>
		// ...
         </xsd:sequence>
      </xsd:extension>
   </xsd:complexContent>

</xsd:complexType>

</xsd:schema>

Both schemas are compiled with, amongst other things,  
--include-with-brackets and --output-dir ./generated



I have this problem:

The #include directive in derived-types.hxx is 

#include <../../root/schema/basic-types.hxx>

Which doesn't exist. I'd like to not have to specify the relative path
of the base schema on the import line and instead use just the file name
with the 

--include-prefix "generated"

command to produce an include directive 

#include <generated/sentinel-user-config.hxx>

which will build since my build environment finds it in the path. 

This can't be done as xsd can't find the base schema without the
relative path and so doesn't generate the code.

Any ideas?

Hope this makes some kind of sense! 


Cheers,
Dave.


Dave Moss
SELEX Communications
Grange Road
Christchurch 
Dorset  BH23 4JE
United Kingdom
Tel: + 44 (0) 1202 404841
Email: david.r.moss at selex-comm.com

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************





More information about the xsd-users mailing list