[xsd-users] can xsd compile schema its structure includes reference to external schema?

Jeffrey Yu jeffrey.yu at panpacificinvestment.com
Wed Apr 29 12:32:58 EDT 2009


Thanks Boris, thanks for the quick response.

I did what you recommended, the first two went through ok.  I got this when
compiling "company.xsd", which makes reference to both product.xsd and
person.xsd.
This is the message I get:

Person.xsd:5:46: error: unable to map XML Schema namespace
'http://www.person.org' to C++ namespace
Person.xsd:5:46: info: use the --namespace-map or --namespace-regex option
to provide custom mapping

I couldn't tell if there are problems in person.xsd as far as the structure
is concerned.  My guess is Company is unable to locate Person.xsd, or simply
something else?

Thanks again.

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Wednesday, April 29, 2009 12:10 PM
To: Jeffrey Yu
Cc: XSD-users
Subject: Re: [xsd-users] can xsd compile schema its structure includes
reference to external schema?

Hi Jeffrey,

Jeffrey Yu <jeffrey.yu at panpacificinvestment.com> writes:

> Can someone let me know if this is doable with this xsd?

Yes, this is doable. You just need to tell XSD how to map your new XML
namespaces to C++ namespaces. For example, you can add the following
options to the respective command lines:

--namespace-map http://www.product.org=product
--namespace-map http://www.person.org=person
--namespace-map http://www.company.org=company

Which will make XSD place the generated code into product, person, and
company C++ namespaces, respectively. Or, you can generate everything
into the global namespace (this is what you probably had before the
split):

--namespace-map http://www.product.org=
--namespace-map http://www.person.org=
--namespace-map http://www.company.org=

See Section 3.3, "Namespace Mapping" in the C++/Tree Mapping Getting
Started Guide for more information:

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#3.3

Boris




More information about the xsd-users mailing list