jibx

How to create Java objects from XML tags which are referring each other?

为君一笑 提交于 2020-01-21 05:05:07
问题 I have an XML which has tags corresponding to three types of Java objects which would be created from the XML. The objects are of the form: A - static Map<String, A> - String name - String aInfo1 - String aInfo2 B - static Map<String, B> - String name - String bInfo1 - String bInfo2 C - A aObject - B bObject Now, in my XML, I define a list of tags for A objects and B objects and then I define tags for C objects which refer to A and B objects using there name field. I have two requirements:

Simple Java Xml to POJO mapping/binding?

随声附和 提交于 2020-01-19 11:20:24
问题 I'm trying to figure out the simplest way to map an xml file to to a plain old java object. Note: That in my example the xml doesn't quite match up with my intended POJO. ///////// THE XML <?xml version="1.0" encoding="UTF-8"?> <Animal> <standardName> <Name>Cat</Name> </standardName> <standardVersion> <VersionIdentifier>V02.00</VersionIdentifier> </standardVersion> </Animal> ////// THE INTENDED POJO class Animal { private String name; private String versionIdentifier; } Regular JAXB (with

Simple Java Xml to POJO mapping/binding?

故事扮演 提交于 2020-01-19 11:18:55
问题 I'm trying to figure out the simplest way to map an xml file to to a plain old java object. Note: That in my example the xml doesn't quite match up with my intended POJO. ///////// THE XML <?xml version="1.0" encoding="UTF-8"?> <Animal> <standardName> <Name>Cat</Name> </standardName> <standardVersion> <VersionIdentifier>V02.00</VersionIdentifier> </standardVersion> </Animal> ////// THE INTENDED POJO class Animal { private String name; private String versionIdentifier; } Regular JAXB (with

Simple Java Xml to POJO mapping/binding?

[亡魂溺海] 提交于 2020-01-19 11:18:55
问题 I'm trying to figure out the simplest way to map an xml file to to a plain old java object. Note: That in my example the xml doesn't quite match up with my intended POJO. ///////// THE XML <?xml version="1.0" encoding="UTF-8"?> <Animal> <standardName> <Name>Cat</Name> </standardName> <standardVersion> <VersionIdentifier>V02.00</VersionIdentifier> </standardVersion> </Animal> ////// THE INTENDED POJO class Animal { private String name; private String versionIdentifier; } Regular JAXB (with

Jibx Maven plugin: cross-reference among schemas when they are converted in different build executions

老子叫甜甜 提交于 2020-01-16 18:13:08
问题 I use the jibx Maven plugin to convert some xsds to Java source codes. In a schema A, there is a reference to a type defined in a schema B. Before, I used this pom.xml configuration and everything worked fine: <plugin> <groupId>org.jibx</groupId> <artifactId>jibx-maven-plugin</artifactId> <version>1.2.3</version> <configuration> <schemaLocation>${basedir}/resources/oxm/schemas</schemaLocation> <schemaBindingDirectory>${basedir}/src/java</schemaBindingDirectory> <includeSchemas> <includeSchema

Maven: metadata xml files downloaded often from remote repositories

拥有回忆 提交于 2020-01-14 10:12:49
问题 I'm using Maven to handle a Java project. I thought that Internet connectivity was only needed in the 1st compile to download the required libraries from the remote repositories, but I get several download messages whenever I compile code. Messages like these: Downloading: http://repo.maven.apache.org/maven2/org/eclipse/core/resources/maven-metadata.xml Downloading: http://repository.springsource.com/maven/bundles/external/org/eclipse/core/resources/maven-metadata.xml Downloading: http:/

Jibx Codegen: customization file - package per schema

℡╲_俬逩灬. 提交于 2019-12-25 01:39:00
问题 I'm using Jibx maven plugin in a project to generate Java source from XML schema (xsd) files. I've configured the plugin in the pom.xml to use a customization xml. In this xml, I define a Java package per schema, as presented here: <schema-set> <schema name="schema1.xsd" package="com.myApp.jibxgenerated.schema.schema1"/> <schema name="schema2.xsd" package="com.myApp.jibxgenerated.schema.schema2" includes="element1" /> <schema name="schema3.xsd" package="com.myApp.jibxgenerated.schema.schema3"

Java Upgrade exception from 1.6 to 1.8

◇◆丶佛笑我妖孽 提交于 2019-12-23 05:08:21
问题 I am trying to upgrade my project from Java 1.6 to Java 1.8, While doing Gradle build am getting JIBX binding compilation Error.If I run using Java 1.6 it works fine. I am using JIBX version 1.2.5, Gradle 2.9 version.JAVA 1.8.0_71, Groovy 2.4.4. Attachning my jibx.gradle below configurations { jibx } dependencies { jibx group: 'org.jibx', name: 'jibx-tools', version: '1.2.6' jibx group: 'org.jibx', name: 'jibx-bind', version: '1.2.6' jibx group :'org.jibx', name: 'jibx-extras', version:'1.2.6

Jibx - how to unmarshal/marshal tag with value and attribute?

假如想象 提交于 2019-12-21 05:22:26
问题 <stateData> <MyTag name="voltage">12</Mytag> <MyTag name="Fuel">72</Mytag> </stateData> Sorry Guys, I did not meant to be lazy. Ok Here is the question: I have xml structure with above block of xml which some tags has both value and attribute in tag notation( MyTag has value of 12 and has an attribute name). using Jibx how I can create binding schema for such case. Obviously for xml tags with only value or with attributes without tag value is normal, but when you have both of them I don't

How to set a default value when a field is null in jibx binding?

一笑奈何 提交于 2019-12-13 04:46:30
问题 I would like to set a default constant value to a particular value node in JiBX when the corresponding field value is null. Is this possible and if so, how? 回答1: You can use the element 'default' ... for example: <value name="YourElementName" field="fieldName" default="default-value" usage="optional" /> This is only allowed for 'optional' elements. See the description here: http://jibx.sourceforge.net/details/binding-attributes.html#string 来源: https://stackoverflow.com/questions/6250615/how