Hello everyone,
I've generated bindings for the following schema:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="urn:Container:1.0"
xmlns:cdb="urn:CDB:1.0"
xmlns:log="urn:LoggingConfig:1.0"
targetNamespace="urn:Container:1.0"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="urn:CDB:1.0" schemaLocation="CDB.xsd"/>
<xs:import namespace="urn:LoggingConfig:1.0"
schemaLocation="LoggingConfig.xsd"/>
<xs:element name="Container" type="Container"/>
<xs:complexType name="Container">
<xs:sequence>
<xs:element name="Autoload" type="cdb:Array"/>
<xs:element name="LoggingConfig" type="log:LoggingConfig"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Running the toxml() method of the Container binding produces valid output
like this:
<?xml version="1.0" ?>
<ns1:Container xmlns:ns1="urn:Container:1.0" xmlns:ns2="urn:CDB:1.0">
<ns1:Autoload>
<ns2:_ string="baci"/>
</ns1:Autoload>
<ns1:LoggingConfig centralizedLogger="Log" dispatchPacketSize="0"
immediateDispatchLevel="99" minLogLevel="2"/>
</ns1:Container>
However, I'd like the output to look like:
<?xml version="1.0" ?>
<Container xmlns="urn:Container:1.0" xmlns:cdb="urn:CDB:1.0">
<Autoload>
<cdb:_ string="baci"/>
</Autoload>
<LoggingConfig centralizedLogger="Log" dispatchPacketSize="0"
immediateDispatchLevel="99" minLogLevel="2"/>
</Container>
The documentation shows how to control this by passing a BindingDOMSupport
object to the toxml() method that has the default and declared namespaces
set accordingly. That works just fine too but, as these bindings will be
going into a library, making users of the code create binding objects to get
the formatting right invites a lot of trouble.
I've been experimenting with generating raw bindings and then writing a
custom module to set the BindingDOMSupport appropriately. In what I've done
so far, it appears to work the same as the manual case. However, there are
a lot of schema to generate bindings for and users are writing their own
schemata as well, so a manual process like this doesn't appear to be a good
solution either.
Is there an automated way to generate and associate a BindingDOMSupport
object for the elements of a schema?
Regards,
Arne
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
pyxb-users mailing list
pyxb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyxb-users