Hi all, trying to switch from jaxb to jibx. my app generates an xml used by several applications downstream so moving to jibx I need to generate the xml in the same exact format. Here's the schema excerpt that gives me troubles ... <xs:complexType name="BaseMessageType"> <xs:sequence> <xs:element ref="cm:emheader"/> <xs:element name="body"> <xs:complexType> <xs:sequence> <xs:element name="data" type="xs:anyType" minOccurs="0"/> <xs:element name="keyValue" type="cm:KeyValueType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> ...
In jaxb I'm adding a string (another xml) into the "data" element, then marshall and publish. As a result, generated xml for the data element has the namespace and the content type defined as below <data xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"> ...xml string ... </data> With jibx I'm using schema-codegen from maven. When I'm generating the sources and do the binding the generated class doesn't even allow me to set the data element but provides only - a setter setDataPresent(boolean) and - a checker (boolean ifDataPresent()) I tried to customize with <schema-set xmlns:xs="http://www.w3.org/2001/XMLSchema" type-substitutions="xs:integer xs:int xs:decimal xs:float" xs:anyType xs:ENTITY > </schema-set> This managed to generate the body's Data field which I can set, being a string. Problem is the generated xml generates the data element without the namespace and associated type: <data> ...xml string ... </data> Although the rest of the xml looks identical with the one generated via jaxb, the downstream applications have difficulty parsing the jibx generated xml, complaining about an unexpected element inside data. How can I ask jibx nicely to write the data as jaxb does (hopefully without writing my own marshaller)? If there's no way but writing my own marshaller, how can I specify it in the schema customization so that it will be added to the binding schema automatically? using springboot and java8 in a prod environment. thanks
_______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users