xjc

XSD. Different between xsd:element and xs:element?

主宰稳场 提交于 2020-01-03 03:36:29
问题 I reading articles about XSD on w3schools and here many examples. For example this: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> But after I tried put this .xsd file in xjc -

XJC Java class generation for <xs:choice> element which is not unbounded

笑着哭i 提交于 2020-01-02 10:04:39
问题 After this similar question yesterday I have another question concerning inheritance in XML schema and XJC bindings. Given the following choice element such that Book and Journal have a common parent type ( Publication ). <xsd:choice > <xsd:element name="Book" type="Book" /> <xsd:element name="Journal" type="Journal" /> </xsd:choice> The Java class properties which are generated are like: private Book book; private Journal journal; Since <xsd:choice> means that there might be either a Book or

XJC superinterface and superclass only for all classes?

本小妞迷上赌 提交于 2020-01-01 09:00:10
问题 I'm trying to automatically implement an interface in one java class generated from a xsd file. This looks as if it could do that, but it will only add implements SomeInterface to all classes, which is completly stupid. Am I missing something or can you only do this for all classes? Doesn't really make too much sence to let all generated classes implement the same interface. Can I use this feature for one class only? 回答1: You could use Inheritance extension provided by JAXB2 Basics Plugins.

JAXB XJC compiler disregarding mixed=true on XML Schema documents

帅比萌擦擦* 提交于 2019-12-31 10:44:53
问题 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

Inserting code with XJC+xsd+jxb using the options “ -Xinject-code -extension ”

北城余情 提交于 2019-12-27 17:43:29
问题 Im' trying to use the extension "-Xinject-code" of xjc to add some code to my generated classes. For the following simple xsd schema... <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="MyList" > <xs:complexType> <xs:sequence> <xs:element ref="MyItem" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="MyItem"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:int"/> <xs:element

JAXB/XJC - XML Schema Parsin Fail

别来无恙 提交于 2019-12-25 09:01:24
问题 I am currently working with JAXB (and its tool XJC) to "translate" an XML Schema (.xsd) to auto-generated java classes. I execute the following command : java -jar "../lib/com.sun.jaxb_1.0.0/jaxb-xjc.jar" schema.xsd But, obviously, I don't get to compile my schema and get the following errors : parsing a schema... [ERROR] s4s-elt-invalid-content.1 : Le contenu de 'heureType' n'est pas valide. L'élément 'element' n'est pas valide, est mal placé ou compte trop d'occurrences. line 9 of file:***

Can I configure XJC compiler to consume custom XML bindings for inline customization?

夙愿已清 提交于 2019-12-25 08:34:04
问题 For JAXB we could use Inline Customization to adjust schema compiler in some way. This could be done via Schema Binding Declarations (<jxb:schemaBindings/>). Any way to make other XML tags (e.g. ActualType, EnumerationValue in example below) work with standard XJC compiler to affect generated classes? <xs:simpleType name="SomeType"> <xs:annotation> <xs:appinfo> <ActualType Name="unsignedInt" /> </xs:appinfo> </xs:annotation> <xs:restriction base="xs:string"> <xs:enumeration value=

How do I tell the maven-jaxb2-plugin to run xjc on all .xsd files in a maven dependency?

倖福魔咒の 提交于 2019-12-25 04:28:09
问题 I'm using the maven-jaxb2-plugin and my .xsd files are in a maven dependency. The documentation shows that you specify a .xsd in a maven dependency like this <schema> <!-- Specifies a schema from the Maven artifact. --> <dependencyResource> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin-tests-po</artifactId> <!-- Version of the artifact. May be omitted. The plugin will then try to find the version using the dependencyManagement and dependencies of the project. -->

XJC episode with maven

馋奶兔 提交于 2019-12-25 04:21:12
问题 How can I generate an episode with maven? I now get an error message: an operand is missing (org.apache.cxf:cxf-xjc-plugin:2.4.0:xsdtojava:generate-sources:generate-sources) Here my plugin: <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-xjc-plugin</artifactId> <version>2.4.0</version> <configuration> <extensions> <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:2.4.0</extension> </extensions> </configuration> <executions> <execution> <id>generate-sources</id> <phase>generate

Unrecognized parameter -XsomePlugin error when using JAXB/XJC plugins

亡梦爱人 提交于 2019-12-24 15:14:08
问题 I am compiling an XML Schema using JAXB/XJC and I want to use some XJC plugin to augment generated code. I include plugin into the XJC classpath and activate it using -XsomePlugin . However I am getting an error like: Caused by: com.sun.tools.xjc.BadCommandLineException: unrecognized parameter -XsomePlugin at com.sun.tools.xjc.Options.parseArguments(Options.java:859) at com.sun.tools.xjc.XJCBase._doXJC(XJCBase.java:804) ... 21 more So apparently the plugin is not picked up by XJC or is not