xjc

Use JAXB (xjc) generated classes in android

寵の児 提交于 2019-12-03 12:49:56
I am using a Rest-Webservice in Android . The Web Service could handle JSON and XML , the API is described as an XSD . So I used JAXB to generate classes from the XSD and then I used jackson JSON processor to generate JSON from my instances. The problem is, that JAXB ( xjc ) generates classes with JAXB annotations and Android can't handle those. I tried to add the jaxb-api.jar to my android project but the Dalvik won't use core classes. For my first implementation I manually removed the annotations. But now the XSD was updated and I don't want to do this every time this happens. Do you have

Resolving type definitions from imported schema in XJC fails

久未见 提交于 2019-12-03 08:56:17
问题 I've got this API using JAXB to conveniently use object models, generated from XML Schemas by the XJC (XML-to-Java) compiler, through named references. It abstracts the creation of JAXB contexts and finding ObjectFactory methods away by all sorts of background magic and reflection. The basic gist of it is that you'd always define one general schema, and then any number (may also be 0) of schemas "extending" that general one, each resulting in its own data model. The general schema carries the

JAXB generated classes of certain types implementing a custom interface

南笙酒味 提交于 2019-12-03 08:42:34
I am working on an application that uses XJC to generate Java POJOs from XSDs. There are dozens of schemas, and that number will grow. The application also needs to be able to handle different versions of the same schema, which means that I will have multiple schemas defining common types. I am trying to customize the bindings so that certain core types implement a common interface. The Inheritance plugin of JAXB2 Basics seems to do what I need, but I can't seem to nail the right syntax. Here is the relevant part of my schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http:/

Maven JAXB2 XJC plugin: M2E plugin execution not covered

假装没事ソ 提交于 2019-12-03 06:09:54
问题 I am using using the jaxb2 xjc plugin for generating java files from a XSD . Therefore I used to configure my pom.xml as follows: <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>1.3</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <packageName>com.mypackage.model</packageName> <schemaDirectory>${basedir}/src/main/resources/XSD<

How to write an external binding file for xjc?

女生的网名这么多〃 提交于 2019-12-03 01:55:36
The documentation of JAXB xjc says: -b Specify one or more external binding files to process. (Each binding file must have it's own "-b" switch.) The syntax of the external binding files is extremely flexible. You may have a single binding file that contains customizations for multiple schemas or you can break the customizations into multiple bindings files: xjc schema1.xsd schema2.xsd schema3.xsd -b bindings123.xjb xjc schema1.xsd schema2.xsd schema3.xsd -b bindings1.xjb -b bindings2.xjb -b bindings3.xjb In addition, the ordering of the schema files and binding files on the command line does

JAXB XJC compiler disregarding mixed=true on XML Schema documents

筅森魡賤 提交于 2019-12-03 01:05:28
XJC seems to be completely ignoring mixed="true" on my XML Schema elements thereby not allowing me to extract text content. From the sample XML below, I need to be able to extract "Title Text." Without mixed="true" being recognized, no accessor is created nor is it unmarshalled from XML: <?xml version="1.0" encoding="UTF-8"?> <title xmlns="urn:hl7-org:v3" integrityCheck="true">Title Text</title> Here's a complete but minimized schema that demonstrates the problem: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <xs:schema targetNamespace="urn:hl7-org:v3" xmlns:xs="http://www.w3.org/2001

JAXB binding file: XmlAdapters and package name

落花浮王杯 提交于 2019-12-03 00:31:33
I have a binding file like this <jxb:bindings version="2.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <jxb:bindings schemaLocation="example.xsd" node="/xs:schema"> <jxb:schemaBindings> <jxb:package name="example" /> </jxb:schemaBindings> <jxb:globalBindings> <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime" /> <jxb:javaType name="java.util.Calendar" xmlType="xs

Maven JAXB2 XJC plugin: M2E plugin execution not covered

与世无争的帅哥 提交于 2019-12-02 19:34:52
I am using using the jaxb2 xjc plugin for generating java files from a XSD . Therefore I used to configure my pom.xml as follows: <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>1.3</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <packageName>com.mypackage.model</packageName> <schemaDirectory>${basedir}/src/main/resources/XSD</schemaDirectory> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId>

xjc: override xs:simpleType definition

ⅰ亾dé卋堺 提交于 2019-12-02 02:52:19
问题 I am compiling a set of XSDs to Java classes using xjc . I would like to be able to override the data type definition for a given simple type. The XSD snippet is: <xs:simpleType name="CPT-DateTime"> <xs:annotation> <xs:appinfo>Can be specified as a integer number or as xs:dateTime</xs:appinfo> </xs:annotation> <xs:union memberTypes="xs:unsignedLong xs:dateTime"/> </xs:simpleType> which results (not surprisingly) in an element of the CPT-DateTime type being defined in the resulting Java class

java.lang.ClassNotFoundException: com.sun.codemodel.CodeWriter with JDK9

我的未来我决定 提交于 2019-12-02 01:16:41
问题 [WARNING] The POM for org.glassfish.jaxb:jaxb-runtime:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details [WARNING] The POM for org.glassfish.jaxb:jaxb-xjc:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details [WARNING] Error injecting: org.jvnet.mjiip.v_2.XJC2Mojo java.lang.NoClassDefFoundError: com/sun/codemodel/CodeWriter at java.base/java.lang.Class