xjc

avoid the use of 'mixed=true' in xml schema

I am using xjc to convert a schema to java classes. When I am using mixed=true in the schema I am losing the access method for child nodes instead there is a single general content access method. Is there a way to rewrite the schema without using mixed=true. There is no way that I can change the xml so I have to customize the schema. S...

xjc generating Adapter1.java.....

When I run xjc to bind the schema to java, Adapter1.java, Adapter2.java were generated. Is there something I did wrong? What do I do with the generated class Adapter1.java, Adapter2.java? ...

JAXB Locator - missing dependency?

On my current project we generate JAXB beans from an XSD file. We need line number information on the beans (beyond XSD validation errors!) so I used the -Xlocator option specified here: http://java.sun.com/webservices/docs/1.6/jaxb/xjc.html However, I'm missing the Locator class. The jar file referenced to on that six-year old page ca...

Generating Java Objects with Ant (&xjc) - java packages

I am generating multiple XSD schemas into java objects, and i need to specify the root package. but the package attribute is not recognized by Ant... (don't know why...) what should i do? thanks! ...

JAXB code generation: restricted type -> how to remove a zero occurrence field?

Hi all, I use JAXB 2.1 to generate Java classes from several XSD files that I cannot modify (coming from a WSDL file actually), and I have a problem related to complex type restriction. On of the restrictions modifies the occurence configuration from minOccurs="0" maxOccurs="unbounded" to minOccurs="0" maxOccurs="0". Thus this field is ...

Maven Release Plugin with JAXB issues

Hiya, We've got a project set up to use the Maven Release Plugin which includes a phase that unpacks a JAR of XML schemas pulled from Artifactory and a phase that generates XJC classes. We're on maven release 2.2.1. Unfortunately the latter phase is executing before the former which means that it isn't generating the XJC classes for th...

backslash in regex in xsd with xjc (ant) and jaxb validation

Hi, I have the following regex type in my xsd file: <xsd:simpleType name="Host"> <xsd:restriction base="xsd:string"> <xsd:pattern value="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"> </x...

XJC namespace problem

Hello! I am trying to generate java source files from a package of *.xsd files using the xjc code generation tool. The namespaces used in those *.xsd files are as follows: h*p://www.domain.com/foo/bar.x h*p://www.domain.com/foo/bar.x.y h**p://www.domain.com/foo/bar.x.y.z XJC produces packages as follows: com.domain.foo.bar.x and...

JAXB Ant Task Error: xjc2 [ERROR] null unknown location

When binding on some valid XML documents using Ant's xjc2 task, I get the following failure message: [xjc2] [ERROR] null [xjc2] unknown location The documents are very similar to other files which have bound successfully, all imported schemas exist. Running xjc in verbose mode produced: Parent is not Defined Class...I cannot get the...

JAXB Make QName in Objectfactory accessible

When you generate java classes with JAXB you'll always get a Class named ObjectFactory. In this class there is a private attribute QName with the namespace in it. Is it possible to tell the generator to make this attribute accessible from the outside. So maybe make it public or create a getter for it? ...

JAXB - Can XJC compile appinfo into the class structure?

I have a schema which is read by a few different applications for form generation; one of them uses JAXB/XJC to compile its class structure. The schema contains appinfo information for friendly names of fields, eg: <xs:element name="HomeAddress" type="xs:string"> <xs:annotation> <xs:appinfo>Home address</xs:appinfo> </xs:annotat...

XJC dont generate required=true annotation into java files based on minoccours value

There is this schema: element type="xs:short" name="Status" minOccurs="1" maxOccurs="1" I miss the required=true from XJC output: @XmlElement(name = "Status") protected short status; But should be: @XmlElement(name = "Status", required = true) protected short status; I generate beans with maven using xjc plugin. POM part is here:...

controlling the class names generated by JAXB for xsd:attributeGroup?

I am using JAXB to bind XML to Java for an application that I am writing. I have an element called measure which contains two amount elements called amount and maxAmount, with which I want to model a lower and an upper limiting value. amount and maxAmount are otherwise identical and I would like them to be implemented with the same class...

Can I configure XJC bindings to generate collections as Set instead of List

Given a schema such as this: <xs:element name="Group" type="GroupType"/> <xs:complexType name="GroupType"> <xs:sequence> <xs:element type="OptionsType" name="Options" maxOccurs="1" minOccurs="1"/> <xs:element type="PageContainerType" name="PageContainer" maxOccurs="unbounded" minOccurs="0"/> </xs:sequence> </xs:...

JAXB XJC compiler disregarding mixed=true on XML Schema documents

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 xml...