.xjs customization in JAXB

Hi!
I am using JAXB to generate my java classes. I have a third party dtd which I am using in the process.
I really need to change the names of the classes that the xjc compiler is generating (for eg , for a request element in the dtd xjc generates Request.java ; what i really need is MyProjectRequest.java ) .
Of course, I can make changes manually ; but is there a tag in the binding schema that will help me specify this ??
Thanks !
Mayura

Thanks a lot!
Btw, are all the tags that a .xjs file takes documented anywhere??
Its feels rather silly to struggle so much for little things.(Moreover, I am an XML rookie ...so I don't have much f an instinct when it comes to that!)
Thanks again.

Similar Messages

  • Using the xjc:superClass customization in jaxb

    Hi,
    I'm having some problems with the <xjc:superClass> customization when I use this, the properties of my superClass don't get serialized to xml the xml file is empty. Can sombody help me with this problem?
    this is my xsd:
    <xsd:schema jaxb:version="1.0" jaxb:extensionBindingPrefixes="xjc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
         <xsd:annotation>
              <xsd:appinfo>
                   <jaxb:globalBindings generateIsSetMethod="true">
                        <xjc:serializable/>
                        <xjc:superClass name="VtProduct"/>
                   </jaxb:globalBindings>
              </xsd:appinfo>
         </xsd:annotation>
         <xsd:element name="fastrackProduct">
    </xsd:schema>and this is my VtProduct from witch the fastrackProduct should extend:
    public class VtProduct implements Serializable {
        private String code;
        private String description;
        private int priceInCents;
        private String deliveryName;
        private String uid;
        public VtProduct() {
        public String getCode() {
            return this.code;
        public void setCode(String code) {
            this.code = code;
        public String getDescription() {
            return this.description;
        public void setDescription(String description) {
            this.description = description;
        public int getPriceInCents() {
            return this.priceInCents;
        public void setPriceInCents(int priceInCents) {
            this.priceInCents = priceInCents;
        public String getDeliveryName()  {
            return this.deliveryName;
        public void setDeliveryName(java.lang.String deliveryName)  {
            this.deliveryName = deliveryName;
        public String getUid() {
            return this.uid;
        public void setUid(java.lang.String uid) {
            this.uid = uid;
    }This is what i'm trying to do im my main class:
    FastrackProductImpl po = new FastrackProductImpl();
    po.setCode("1234567890");
    po.setDeliveryName("Delivery name");
    po.setDescription("Description");
    po.setPriceInCents(1000);
    po.setUid("0987654321");
    po.setFastrackProductId("FSID1234");
    FileOutputStream mout = new FileOutputStream("fastrackProduct.xml");
    marshaller.marshal(po, mout);
    mout.close();

    Thanks a lot!
    Btw, are all the tags that a .xjs file takes documented anywhere??
    Its feels rather silly to struggle so much for little things.(Moreover, I am an XML rookie ...so I don't have much f an instinct when it comes to that!)
    Thanks again.

  • Class Name customization in JAXB

    Does Sun Jaxb allows customizing class names so that they are same as in schema definition, instad of Java format. For example, if a purhcaseorder schema has complex type named purchaseorder, jaxb generates Class by PurchaseOrder, is there a way to not to do this. Similllary for elements and attributes
    Thanks

    Customize JAXB? Ha ha ha! That's a good one.
    I can't remember if this is one of the irregular selection of things you can specify. Have you messed around with the binding document? I can't remember what they call it. It's a mapping doucment that's supposed to allow you to do this type of thing but I find it's often not functional.

  • Jaxb 2 customization issue

    I am new to JAXB2 world.
    -I have a xml document whose xsd has imports of other xsds. I have the corresponding domain model and java objects in hand. The names of the classes/attibutes differ from that of those specified in the xsd; Thus did the jaxb 2.0 customization. JAXB is throwing a nullpointer exception when it encounters the import of other xsd in the calling xsd but works well, otherwise.
    -In the case of complicated java domain models and xml bining, would the usuage of Jibx be preferable over Jaxb...any suggestions?!
    -Also please suggest a good book/articles about java domain and xml binding.
    Any help is highly appreciated.
    Thanks in advance.

    Hello,
    For complicated models, or for situations in which you want to map an existing object model to an existing XML schema you need a tool that goes beyond JAXB.
    I am the team lead for Oracle TopLink Object-to-XML (JAXB) and was a member of the JAXB 2.0 (JSR-222) expert group so I'll share my thoughts.
    - TopLink OXM provides a visual tool, the TopLink Workbench to map an existing XML schema to an existing object model.
    - TopLink OXM can be exposed through the standard JAXB runtime APIs.
    - TopLink OXM can be run with any JAXP compliant parser. Many binding solutions are dependent on a specific parser.
    For more information on TopLink OXM/JAXB
    http://www.oracle.com/technology/products/ias/toplink/oxm/index.html
    My Oracle OpenWorld 2005 presentation
    http://download-west.oracle.com/oowsf2005/1535.pdf
    -Blaise

  • JAXB: How to have my generated classes subclass some other outside class ?

    With my XJS and DTD, JAXB generates the following:
    public class FraisMessage
        extends MarshallableRootElement
        implements RootElement
    { etc...I would like it to generate this instead:
    public class FraisMessage extends MyOtherClass
        extends MarshallableRootElement
        implements RootElement
    { etc...MyOtherClass is another class outside the scope of JAXB
    How do I do this ? What do I have to put in my XJS to get this ?

    You cannot do that. TheJAVA language does not allow a class to "extend" more than one upper class.
    Typically, the solution is to modify your architecture a little bit. Just use the "has a" relationship instead of "is a". That means something like that:public class MyFraisMessage
        extends MyOtherClass
        private FraisMessage message;
      etc...You write an extension "MyFraisMessage" of your upper class "MyOtherClass", which has the JAXB generated object as an attribute. This structure is often useful, when you think you would need multiple inheritance.

  • Unable to compile the Java Files generated by JAXB

    Hi,
    I have generated the Java Files for a DTD and .xjs file using JAXB. But when i tyr to compile the .java files generated i am getting errors.
    My DTD file is addctq.dtd
    <?xml version="1.0" encoding="UTF-8"?>
    <!ELEMENT AddCtq (Ctq*)>
    <!ELEMENT Ctq (PartNumber ,PartDescription,CtqDescription,CtqType,ProductLine,Supplier,Ppctq,Ctp,Ctc,CtqCode1,CtqCode2,CtqCode3,Commodity,SubCommodity,UnitOfMeasure,Client,SamplingFrequency,Remarks,VariableData)>
    <!ELEMENT VariableData (SubGroupSize, Specification,Nominal,Usl,Ual,Lal,Lsl,Zal,RangeVal?,RangeAlarmVal?)>
    <!ELEMENT PartNumber (#PCDATA)>
    <!ATTLIST PartNumber new CDATA #REQUIRED >
    <!ELEMENT PartDescription (#PCDATA)>
    <!ELEMENT CtqDescription (#PCDATA)>
    <!ELEMENT CtqType (#PCDATA)>
    <!ELEMENT ProductLine (#PCDATA)>
    <!ELEMENT Supplier (#PCDATA)>
    <!ELEMENT Ppctq (#PCDATA)>
    <!ELEMENT Ctp (#PCDATA)>
    <!ELEMENT Ctc (#PCDATA)>
    <!ELEMENT CtqCode1 (#PCDATA)>
    <!ELEMENT CtqCode2 (#PCDATA)>
    <!ELEMENT CtqCode3 (#PCDATA)>
    <!ELEMENT Commodity (#PCDATA)>
    <!ELEMENT SubCommodity (#PCDATA)>
    <!ELEMENT UnitOfMeasure (#PCDATA)>
    <!ELEMENT Client (#PCDATA)>
    <!ELEMENT SamplingFrequency (#PCDATA)>
    <!ELEMENT Remarks (#PCDATA)>
    <!ELEMENT SubGroupSize (#PCDATA)>
    <!ELEMENT Specification (#PCDATA)>
    <!ELEMENT Nominal (#PCDATA)>
    <!ELEMENT Usl (#PCDATA)>
    <!ELEMENT Ual (#PCDATA)>
    <!ELEMENT Lal (#PCDATA)>
    <!ELEMENT Lsl (#PCDATA)>
    <!ELEMENT Zal (#PCDATA)>
    <!ELEMENT RangeVal (#PCDATA)>
    <!ELEMENT RangeAlarmVal (#PCDATA)>
    and the .xjs file i created is addctq.xjs
    <?xml version="1.0" encoding="UTF-8" ?>
    <xml-java-binding-schema version="1.0-ea">
    <options package="com.geindustrial.sqms"/>
    <element name="AddCtq" type="class" root="true">
    <content>
    <element-ref name="Ctq"/>
    </content>
    </element>
    <element name="Ctq" type="class">
    <content>
         <element-ref name="PartNumber"/>
         <element-ref name="PartDescription"/>
         <element-ref name="CtqDescription"/>
         <element-ref name="CtqType"/>
         <element-ref name="ProductLine"/>
         <element-ref name="Supplier"/>
         <element-ref name="Ppctq"/>
         <element-ref name="Ctp"/>
         <element-ref name="Ctc"/>
         <element-ref name="CtqCode1"/>
         <element-ref name="CtqCode2"/>
         <element-ref name="CtqCode3"/>
         <element-ref name="Commodity"/>
         <element-ref name="SubCommodity"/>
         <element-ref name="UnitOfMeasure"/>
         <element-ref name="Client"/>
         <element-ref name="SamplingFrequency"/>
         <element-ref name="Remarks"/>
         <element-ref name="VariableData"/>
    </content>      
    </element>
    <element name="VariableData" type="class">
    <content>
    <element-ref name="SubGroupSize"/>
    <element-ref name="Specification"/>
    <element-ref name="Nominal"/>
    <element-ref name="Usl"/>
    <element-ref name="Ual"/>
    <element-ref name="Lal"/>
    <element-ref name="Lsl"/>
    <element-ref name="Zal"/>
    </content>
    </element>
    <element name="PartNumber" type="value">
    <attribute name="new"/>
    </element>
    <element name="PartDescription" type="value">
    </element>
    <element name="CtqDescription" type="value">
    </element>
    <element name="CtqType" type="value">
    </element>
    <element name="ProductLine" type="value">
    </element>
    <element name="Supplier" type="value">
    </element>
    <element name="Ppctq" type="value">
    </element>
    <element name="Ctp" type="value">
    </element>
    <element name="Ctc" type="value">
    </element>
    <element name="CtqCode1" type="value">
    </element>
    <element name="CtqCode2" type="value">
    </element>
    <element name="CtqCode3" type="value">
    </element>
    <element name="Commodity" type="value">
    </element>
    <element name="SubCommodity" type="value">
    </element>
    <element name="UnitOfMeasure" type="value">
    </element>
    <element name="Client" type="value">
    </element>
    <element name="SamplingFrequency" type="value">
    </element>
    <element name="Remarks" type="value">
    </element>
    <element name="SubGroupSize" type="value" convert="int">
    </element>
    <element name="Specification" type="value">
    </element>
    <element name="Nominal" type="value" convert="float">
    </element>
    <element name="Usl" type="value" convert="float">
    </element>
    <element name="Ual" type="value" convert="float">
    </element>
    <element name="Lal" type="value" convert="float">
    </element>
    <element name="Lsl" type="value" convert="float">
    </element>
    <element name="Zal" type="value" convert="float">
    </element>
    <element name="RangeVal" type="value" convert="float">
    </element>
    <element name="RangeAlarmVal" type="value" convert="float">
    </element>
    </xml-java-binding-schema>
    When i ran the xjc , it generated 3 .java files
    AddCtq.java , Ctq.java and VariableData.java
    But i am unable to compile any of the above files...
    The Error i am getting is
    VariableData.java:710: Undefined variable or class name: AddCtq
    return AddCtq.newDispatcher();
    ^
    1 error
    If i try to compile AddCtq.java , the Error i am getting is
    AddCtq.java:4: Class com.geindustrial.sqms.Ctq not found in import.
    import com.geindustrial.sqms.Ctq;
    ^
    AddCtq.java:169: Class com.geindustrial.sqms.Ctq not found.
    if (!(ob instanceof Ctq)) {
    ^
    AddCtq.java:170: Class com.geindustrial.sqms.Ctq not found.
    throw new InvalidContentObjectException(ob, (Ctq.class));
    ^
    3 errors
    And when i try to compile Ctq.java , i am getting the following Error:
    Ctq.java:4: Class com.geindustrial.sqms.VariableData not found in import.
    import com.geindustrial.sqms.VariableData;
    ^
    1 error
    How to solve this problem..Pls advise...
    Thanks
    Sateesh

    I suspect you are trying to compile the files one by one. You may also be trying to compile them disregarding the package structure.
    From your post, I gather these files are in the package: com.geindustrial.sqms
    Therefore, if they are not so already, put them under a directory structure:
    com/geindustrial/sqms
    and then compile with:
    javac com/geindustrial/sqms/AddCtq.java com/geindustrial/sqms/Ctq.java com/geindustrial/sqms/VariableData.java
    (The above is all on one line.)
    HTH,
    Manuel Amago.

  • Where is the "set" method for this ELEMENT?

    Hi
    I'm trying to understand the relationship between the DTD and XJS, and the JAXB generated code.
    Consider the example DTD, XJS, and generated source code (i.e., "value07.java") for ELEMENT value07, below ...
    QUESTION#1: Why is there no "set" method generated for ELEMENT "value07a" within the generated value07.java ???
    QUESTION#2: How to I code the DTD/XJS in order to force the generation of a "set" method in value07.java???.
    -- I want to be able to set a new value for ELEMENT "value07a" in order to generate an XML document containing the new value!!
    (NOTE: the reason that ELEMENT value07 (as well as other ELEMENTs) has only a single subelement, is in order to satisfy the XSLT definition in a preexisting application.)
    * * * this is the DTD* * *
    <!ELEMENT request                          (value01,value02,value03,value04,value05?,value06?,value07?,value08?,value09?,value10?,value11?,value12?,value13?,value14?,value15?,value16?,value17?,value18?)>
    <!ELEMENT value01                          (#PCDATA)>
    <!ELEMENT value02                          (#PCDATA)>
    <!ELEMENT value03                          (#PCDATA)>
    <!ELEMENT value04                          (value04a, value04b?)>
    <!ELEMENT value04a                          (#PCDATA)>
    <!ELEMENT value04b                          (#PCDATA)>
    <!ELEMENT value05                          (value05a, value05b?)>
    <!ELEMENT value05a                          (#PCDATA)>
    <!ELEMENT value05b                          (#PCDATA)>
    <!ELEMENT value06                          (value06a+)>
    <!ELEMENT value06a                          (#PCDATA)>
    <!ELEMENT value07                          (value07a+)>
    <!ELEMENT value07a                          (#PCDATA)>
    <!ELEMENT value08                          (value08a+)>
    <!ELEMENT value08a                          (#PCDATA)>
    <!ELEMENT value09                          (value09a+)>
    <!ELEMENT value09a                          (#PCDATA)>
    <!ELEMENT value10                          (value10a+)>
    <!ELEMENT value10a                          (#PCDATA)>
    <!ELEMENT value11                          (value11a+)>
    <!ELEMENT value11a                          (#PCDATA)>
    <!ELEMENT value12                          (value12a+)>
    <!ELEMENT value12a                          (#PCDATA)>
    <!ELEMENT value13                          (value13a+)>
    <!ELEMENT value13a                          (#PCDATA)>
    <!ELEMENT value14                          (value14a+)>
    <!ELEMENT value14a                          (#PCDATA)>
    <!ELEMENT value15                          (value15a+)>
    <!ELEMENT value15a                          (#PCDATA)>
    <!ELEMENT value16                          (value16a+)>
    <!ELEMENT value16a                          (#PCDATA)>
    <!ELEMENT value17                          (value17a+)>
    <!ELEMENT value17a                          (#PCDATA)>
    <!ELEMENT value18                          (value18a+)>
    <!ELEMENT value18a                          (#PCDATA)>
    * * * this is the XJS * * *
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE xml-java-binding-schema SYSTEM "http://java.sun.com/dtd/jaxb/1.0-ea/xjs.dtd">
    <xml-java-binding-schema version="1.0-ea">
    <options package="testSourceCode"/>
    <element name="request" type="class" root="true"/>
         <element name="value01"                               type="value"/>
         <element name="value02"                               type="value"/>
         <element name="value03"                          type="value"/>
         <element name="value04" type="class">
              <content>
                   <element-ref name="value04a" />
                   <element-ref name="value04b" />
              </content>
         </element>
         <element name="value05" type="class">
              <content>
                   <element-ref name="value05a" />
                   <element-ref name="value05b" />
              </content>
         </element>
         <element name="value06" type="class">
              <content>
                   <element-ref name="value06a" />
              </content>
         </element>
         <element name="value07" type="class">
              <content>
                   <element-ref name="value07a" />
              </content>
         </element>
         <element name="value08" type="class">
              <content>
                   <element-ref name="value08a" />
              </content>
         </element>
         <element name="value09" type="class">
              <content>
                   <element-ref name="value09a" />
              </content>
         </element>
         <element name="value10" type="class">
              <content>
                   <element-ref name="value10a" />
              </content>
         </element>
         <element name="value11" type="class">
              <content>
                   <element-ref name="value11a" />
              </content>
         </element>
         <element name="value12" type="class">
              <content>
                   <element-ref name="value12a" />
              </content>
         </element>
         <element name="value13" type="class">
              <content>
                   <element-ref name="value13a" />
              </content>
         </element>
         <element name="value14" type="class">
              <content>
                   <element-ref name="value14a" />
              </content>
         </element>
         <element name="value15" type="class">
              <content>
                   <element-ref name="value15a" />
              </content>
         </element>
         <element name="value16" type="class">
              <content>
                   <element-ref name="value16a" />
              </content>
         </element>
         <element name="value17" type="class">
              <content>
                   <element-ref name="value17a" />
              </content>
         </element>
         <element name="value18" type="class">
              <content>
                   <element-ref name="value18a" />
              </content>
         </element>
    </xml-java-binding-schema>
    * * * generated sourcecode for ELEMENT "value07"...i.e., "value07.java" * * *
    package testSourceCode;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.xml.bind.ConversionException;
    import javax.xml.bind.Dispatcher;
    import javax.xml.bind.Element;
    import javax.xml.bind.InvalidAttributeException;
    import javax.xml.bind.InvalidContentObjectException;
    import javax.xml.bind.LocalValidationException;
    import javax.xml.bind.MarshallableObject;
    import javax.xml.bind.Marshaller;
    import javax.xml.bind.MissingContentException;
    import javax.xml.bind.PredicatedLists;
    import javax.xml.bind.PredicatedLists.Predicate;
    import javax.xml.bind.StructureValidationException;
    import javax.xml.bind.UnmarshalException;
    import javax.xml.bind.Unmarshaller;
    import javax.xml.bind.Validator;
    import javax.xml.marshal.XMLScanner;
    import javax.xml.marshal.XMLWriter;
    public class Value07
    extends MarshallableObject
    implements Element
    private List _Value07A = PredicatedLists.createInvalidating(this, new Value07APredicate(), new ArrayList());
    private PredicatedLists.Predicate pred_Value07A = new Value07APredicate();
    public List getValue07A() {
    return _Value07A;
    public void deleteValue07A() {
    _Value07A = null;
    invalidate();
    public void emptyValue07A() {
    Value07A = PredicatedLists.createInvalidating(this, predValue07A, new ArrayList());
    public void validateThis()
    throws LocalValidationException
    if (_Value07A == null) {
    throw new MissingContentException("value07a");
    public void validate(Validator v)
    throws StructureValidationException
    public void marshal(Marshaller m)
    throws IOException
    XMLWriter w = m.writer();
    w.start("value07");
    for (Iterator i = _Value07A.iterator(); i.hasNext(); ) {
    w.leaf("value07a", ((String) i.next()).toString());
    w.end("value07");
    public void unmarshal(Unmarshaller u)
    throws UnmarshalException
    XMLScanner xs = u.scanner();
    Validator v = u.validator();
    xs.takeStart("value07");
    while (xs.atAttribute()) {
    String an = xs.takeAttributeName();
    throw new InvalidAttributeException(an);
    List l = new ArrayList();
    while (xs.atStart()) {
    if (xs.atStart("value07a")) {
    xs.takeStart("value07a");
    String s;
    if (xs.atChars(XMLScanner.WS_COLLAPSE)) {
    s = xs.takeChars(XMLScanner.WS_COLLAPSE);
    } else {
    s = "";
    String uf;
    try {
    uf = String.valueOf(s);
    } catch (Exception x) {
    throw new ConversionException("value07a", x);
    l.add(uf);
    xs.takeEnd("value07a");
    } else {
    break;
    Value07A = PredicatedLists.createInvalidating(this, predValue07A, l);
    xs.takeEnd("value07");
    public static Value07 unmarshal(InputStream in)
    throws UnmarshalException
    return unmarshal(XMLScanner.open(in));
    public static Value07 unmarshal(XMLScanner xs)
    throws UnmarshalException
    return unmarshal(xs, newDispatcher());
    public static Value07 unmarshal(XMLScanner xs, Dispatcher d)
    throws UnmarshalException
    return ((Value07) d.unmarshal(xs, (Value07 .class)));
    public boolean equals(Object ob) {
    if (this == ob) {
    return true;
    if (!(ob instanceof Value07)) {
    return false;
    Value07 tob = ((Value07) ob);
    if (_Value07A!= null) {
    if (tob._Value07A == null) {
    return false;
    if (!_Value07A.equals(tob._Value07A)) {
    return false;
    } else {
    if (tob._Value07A!= null) {
    return false;
    return true;
    public int hashCode() {
    int h = 0;
    h = ((127 *h)+((_Value07A!= null)?_Value07A.hashCode(): 0));
    return h;
    public String toString() {
    StringBuffer sb = new StringBuffer("<<value07");
    if (_Value07A!= null) {
    sb.append(" value07a=");
    sb.append(_Value07A.toString());
    sb.append(">>");
    return sb.toString();
    public static Dispatcher newDispatcher() {
    return Request.newDispatcher();
    private static class Value07APredicate
    implements PredicatedLists.Predicate
    public void check(Object ob) {
    if (!(ob instanceof String)) {
    throw new InvalidContentObjectException(ob, (String.class));

    I discovered something similar this morning...i.e., for
    <element name="value07" type="class">
    <content>
    <element-ref name="value07a" />
    </content>
    </element>
    -- I did something like this...
    Value7 v7 = new Value7();
    for (int i=0; i< Value7_input_array.length; i++)
    ((List)(v7.getValue07A())).add(Value7_input_array);
    Thanks for responding, barry!

  • Binding ANY in (JAXB) xjs

    Any ideas on how i bind the following dtd entry in my xjs file.
    <!ELEMENT ResultData ANY>
    Where i want the ResultData to pick up any tags in between, even as just a string or something, without trying to marshal it.
    eg
    <ResultData>
    <id>1</id>
    <name>test</name>
    </ResultData>
    Thanx for any advice and i am sorry if this is a simple question!
    Kris

    Hi
    I am having the same problem too. If any of you have solved this problem kindly enlighten me. In between, I found the following in the specification
    A wildcard is mapped to a simple content-property with:
    Content-property name set to the constant �any�. A binding schema customization could provide a more semantically meaningful contentproperty
    name.
    Content-property base type set to java.lang.Object by default.Wildcard content encountering during unmarshalling is supported if global XML element tags occurring in �strict� or �lax� wildcard context are known to the instance of javax.xml.bind.JAXBContext, meaning that the schema(s) describing the element content occurring in the wildcard context is registered with the JAXBContext instance, see Section 3.2, �JAXBContext,� on page 24 on how bindings are registered with a JAXBContext instance. A JAXB implementation is only required to be able to marshall and unmarshal global element content to/from �strict�/�lax� wildcard context that is registered and valid according to the schema(s) registered to JAXBContext. The specification does not specify how a JAXB implementation handles element content that it does not know how to map to a Java representation.
    See content-property predicate for a wildcard.
    If the maxOccurs is greater than one, the content property is mapped to a collection property. The default collection property is a List property.
    These is no default value.
    But still I could'nt make the necessary changes !
    Thanks

  • [ERROR] javaType customization in this context must be nested (JAXB spec

    Hi All,
    when i was trying to generate java classes from schema xjc is giving the below error.
    parsing a schema...
    [ERROR] <javaType> customization in this context must be nested (JAXB spec
    <property>
    <baseType>
    <javaType ...>
    </baseType>
    </property>
    Failed to parse a schema.
    my annotation goes like this for an attribute.
    <xs:attribute name="content_id" type="xs:string">
    <xs:annotation>
    <xs:appinfo>
         <jxb:javaType name="java.lang.Long"
    prseMethod= "javax.xml.bind.DatatypeConverter.parseLong"
    printMethod="javax.xml.bind.DatatypeConverter.printLong" />
    </xs:appinfo>
    </xs:annotation>
    </xs:attribute>
    please help me to resolve this problem
    thanks in advance
    Amar

    Hi All,
    when i was trying to generate java classes from schema xjc is giving the below error.
    parsing a schema...
    [ERROR] <javaType> customization in this context must be nested (JAXB spec
    <property>
    <baseType>
    <javaType ...>
    </baseType>
    </property>
    Failed to parse a schema.
    my annotation goes like this for an attribute.
    <xs:attribute name="content_id" type="xs:string">
    <xs:annotation>
    <xs:appinfo>
         <jxb:javaType name="java.lang.Long"
    prseMethod= "javax.xml.bind.DatatypeConverter.parseLong"
    printMethod="javax.xml.bind.DatatypeConverter.printLong" />
    </xs:appinfo>
    </xs:annotation>
    </xs:attribute>
    please help me to resolve this problem
    thanks in advance
    Amar

  • Jaxb: customization for superClass

    Hi,
    I' trying to get JAXB to extend one of my classes in the implementation classes in the impl/ package. In the tutorial (1.1) there is some obscure hint to an xjc:superClass customization, but that seems not to work :-(
    Can someone point me to some more info or give me a hint how to do it?
    Thx & ciao,
    Leif

    Hi,
    I' trying to get JAXB to extend one of my classes in
    the implementation classes in the impl/ package. In
    the tutorial (1.1) there is some obscure hint to an
    xjc:superClass customization, but that seems not to
    work :-(
    Can someone point me to some more info or give me a
    hint how to do it?
    Thx & ciao,
    LeifCheck the vendor extension example in the <JWSDP1.1>/jaxb-1.0/examples
    folder. That has an example on how to use the superClass customization
    Thanks,
    Bhakti

  • Need some good links for JAXB Customization

    Hi all,
    Please gimme some good links for JAXB customization tutorial.
    cheers
    JoyBoy

    Hi all,
    Please gimme some good links for JAXB customization tutorial.
    cheers
    JoyBoy

  • JAXB DTD and XJS element specification

    I have a DTD with the following element declaration:
    <!ELEMENT PersonIdentifiers ((GvtNbr, (IdSateNbr, IdStateCd)?) | (IdStateNbr, IdStateCd))>
    GvtNbr, IdStateNbr, and IdStateCd are all #PCDATA
    How can I structure my XJS in order that I don't just have to call getContent() and then search for what I want?

    Have you tried an interface, which would consist of an IDStateNbr and an IDStateCd?
    the only problem with your setup and jaxb right now is that jaxb will choke on validation, if your optional element isn't present. hopefully, this bug will be fixed when the 1.0 version comes out, later this year...

  • JAXB External Customizations

    Hello all,
    I've been trying to build a JAXB external customizations file that covers several schemas simultaneously. The JWS 2.0 tutorial mentions the following regarding an external customizations file ...
    You can have a single binding file that contains customizations for multiple schemas,
    or you can break the customizations into multiple bindings files; for example:
    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
    Note that the ordering of schema files and binding files on the command line
    does not matter, although each binding customization file must be preceded by
    its own -b switch on the command line.
    The JAXB documentation says that the external file format is as follows:
    <jxb:bindings schemaLocation = "xs:anyURI">
    <jxb:bindings node = "xs:string">*
    <binding declaration>
    <jxb:bindings>
    </jxb:bindings>
    where schemaLocation is of the form schemaLocation="some-schema.xsd"
    My question is, how do I reference multiple schemas inside the same customizations file? Everything I've tried to date has failed except creating separate customizations files for each schema. Thanks In Advance.
    - John

    Hi.
    I have already read it. I don't know how to define wsdlLocation (main wsdl or another wsdl?) inside example jaxb bindings. I have tried something like
    <jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <jxb:bindings wsdlLocation="path.to.my.main.wsdl" node="//xs:complexType[@name='objectFactory']">
          <jxb:class name="MyObjectFactory" />
       </jxb:bindings>
    </jxb:bindings> and I'm getting error
    [ERROR] XPath evaluation of "//xs:complexType[@name='objectFactory']" results in
    empty target node
      line 2 of file:myBinding.xjb

  • Customize names of generated JAXB classes

    I have a peculiar requirement. We have been using JAXB1.0 in our project to parse XMLs. External binding files were used to provide proper names for the generated JAXB classes. Now, I have an xml that looks something like this:
    //sample xml. Original format is much bigger
    <b>
    <MasterTag>
    <attr id="123">Value1</attr>
    <attr id="736">Value2</attr>
    <attr id="900">value3</attr>
    </MasterTag>
    </b>
    There's a property file which has key value pairs for the attr id
    Eg:
    <b>
    123=CompanyID
    736=CompanyAddress
    900=CompanyPinCode
    </b>
    Is it possible to generate JAXB classes names based on the attr id value? These values finally need to persisted in the db. JAXB is the preferred technology.
    Any other ideas are also welcome. Thanks.

    I might be misunderstanding your question, but if you control the single large schema, it would be simple to define the things that you want to treat specially as either individual elements or complexTypes inside the single schema file. Using psuedo-schema, say you have something like this now:
    <xs:element name='Information'>
      <xs:complexType>
        <xs:sequence>
          <xs:element name='Header'>
              <!-- your definition here -->
          </xs:element>
          <xs:element name='Item' maxOccurs='unbounded'>
              <!-- your definition here -->
          </xs:element>
        </xs:sequence>
      </xs:complexType>
    </xs:element>You can change that to:
    <xs:element name='Information'>
      <xs:complexType>
        <xs:sequence>
          <xs:element ref='Header'/>
          <xs:element name='Item' maxOccurs='unbounded'>
              <!-- your definition here -->
          </xs:element>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
    <xs:element name='Header'>
      <!-- your definition here -->
    </xs:element>That should produce distinct classes for your Information and Header elements. You similary can break out the Item and Trailer elements.

  • JAXB compiler problem in handling xsd:any and nillble = "true"

    Dear all,
    i am using jdeveloper 10.1.3.1 production release version.
    i am designing a xml schema that contain element of attribute nillable="true", for extensible, contain tag <xsd:any>.
    but i encounter 2 problem:
    1. for xml schema element with attribute nillable="true", no corresponding isNil(), setNil
    method is generated (refer to jaxb 1.0 spec. 5.7.1)
    2. cannot handle tag <xs:any> that generate incorrect java source code (cannot compile) [refer to jaxb 1.0 spec 5.9.5)
    *** i have add jaxb customization tag inside the <xs:any> tag
    ***   <xs:annotation><xs:appinfo>
    ***               <jaxb:property name="Extension"/>
    ***</xs:appinfo></xs:annotation>
    Does oracle's JAXB implementation conform to the JAXB 1.0 spec?
    Is it a known bug?
    Could anybody help me?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Refer to section
    E.2 Not Required XML Schema
    concepts
    "A JAXB implementation is not required to support the following XML Schema
    concepts for this version of the specification. A JAXB implementation may
    choose to support these features in an implementation dependent manner."
    E.2.2 Not supported while manipulating the XML
    content
    Schema component: wildcard
    (any)
    how can i know if an xml element with xsi:nil="true" (unmarshal)
    and set xsi:nil="true" for an element (marshal) ?
    According to the JAXB 1.0 specification:
    If {nillable} is "true", the methods setNil() and isNil() are
    generated.

Maybe you are looking for

  • HP LaserJet Printer in Solaris 9

    I installed an HP LaserJet 8000 DN with Solaris Print Manager on Solaris 9 and keep getting the same message - exec exit fault<EOT>. Does anyone have any idea what the problem is?

  • Quicktime 10 "Save For Web", spaces in file names?

    Maybe I'm overlooking something here, but: When using Quicktime 10's "Save for Web" function, it exports movie source files that all have spaces in the filenames (i.e. "Movie - iPhone.m4v" etc) Now correct me if I'm wrong, but most web servers DO NOT

  • Nokia 5800 v21.0.025 font bug

    Was in "Menu > Settings > Phone > Display > Font Size" and changed it to small cuz i like it that way when more fits whitout scrolling. Theres text at most places but not in just plain "Menu" only icons. // ljung Solved! Go to Solution.

  • Can't transfer large files with remote connection

    Hi all, I'm trying to figure out why we can't transfer large files (< 20MB) over a remote connection. The remote machine is a G5 running 10.4.11, the files reside on a Mac OS X SATA RAID. We are logged into the remote machine via afp with an administ

  • Cannot watch any videos from Youtube

    I bought a EA3500 router and the setup went fine. I have two computers on the network and both have acces to the Internet. But on one of them which runs Windows 7 and MCAfee Antivirus I cannot watch any videos from Youtube. On the other one which run