[xsd-users] CodeSynthesis - Namespaces and schemas

Boris Kolpackov boris at codesynthesis.com
Thu Feb 2 07:53:48 EST 2012


Hi Andrew,

Andrew.King2 at barclayscapital.com <Andrew.King2 at barclayscapital.com> writes:

> Ideally, I'd like the above XML to look like the following:
> 
> <fpml:requestConfirmation xmlns:fpml="http://www.fpml.org...
>   <isCorrection>false</isCorrection>
> [...]

As Lyndon pointed out in his reply, you need change:

> map["fpml"].name = "http://www.fpml.org/FpML-5/confirmation";
> map["fpml"].schema = "/xmls/OTC/fpml-main-5-1.xsd";

To read:

map[""].name = "http://www.fpml.org/FpML-5/confirmation";
map[""].schema = "/xmls/OTC/fpml-main-5-1.xsd";

Note, however, that this won't produce exactly the XML you have shows.
In particular, the root element won't have the fpml prefix since it
is in the default namespace. Rather, the output will look like this:

<requestConfirmation xmlns="http://www.fpml.org...
  <isCorrection>false</isCorrection>
  ...

Boris



More information about the xsd-users mailing list