JAXB beta optional attributes

I am evaluating JAXB beta release and I am wondering how to tell if an optional attribute was specified in the document. In particular, my attribute is of type xsd:int. The Impl class has a "protected boolean has_XXXXX" field, but I don't see a public method for accessing this value.
Hopefully, I am missing something obvious.
Thanks in advance.

Bhakti,
Thanks for your response. Here is the beginning of my xsd:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
jxb:version="1.0">
<xsd:annotation>
<xsd:appinfo>
<jxb:globalBindings
fixedAttributeAsConstantProperty="true"
collectionType="java.util.ArrayList"
typesafeEnumBase="xsd:NCName"
     choiceContentProperty="false"
     typesafeEnumMemberName="generateError"
     modelGroupAsClass="false"
     enableFailFastCheck="false"
     generateIsSetMethod="true"
underscoreBinding="asCharInWord"/>
<jxb:schemaBindings>
     <jxb:package name="com.limesoft.report.dictionaryxml"/>
</jxb:schemaBindings>
</xsd:appinfo>
</xsd:annotation>
I think I am setting "generateIsSetMethod" appropriately, but the methods are not generated.
Suggestions?

Similar Messages

  • JAXB, optional attribute, primitive

    I have created a XML schema where a node contains an optional attribute, and this attribute is of type boolean:
    <xs:attribute name="onoff" type="xs:boolean" use="optional"/>
    However, when I create the JAXB binding classes, the class for the complex type that includes this attribute shows the get/methods for this attribute as:
    boolean isOnoff();
    void setOnoff(boolean value);
    What is don't understand is why a boolean primitive is used, instead of a Boolean, due to the fact that the attribute is optional. If the attribute is NOT included and I do a call to isOnoff(), what could be returned? it shouldn't be true or false, but null (or an exception). If a Boolean were used, then it could be null. But because a primitive must be returned, the value will be either true or false.
    How does JAXB generally handle the situation where an attribute is a primitive and the use is optional?

    Hi, did you find a solution? If yes, I would be thankfull if you could tell me...
    /Marc

  • Problem with jax-ws and optional attributes

    Hello,
    I'm developing some web services, starting by defining the object model in schemas, then doing WSDL first to define the services.
    I've come across a problem that appears to be caused by jax-ws not properly handling optional attributes. I've tried this with both 2.0 and 2.1ea3 and both fail the same way.
    I created a simplified test case to repeatably demonstrate the problem.
    The type definition for the object looks like this :
    <xsd:complexType name="TestObject" >
    <xsd:attribute name="name" type="xsd:string" use="required"/>
    <xsd:attribute name="subId" type="xsd:integer" use="optional" />
    </xsd:complexType>
    And in the wsdl:
    <wsdl:message name="testRequest">
    <wsdl:part name="testrequest" type="mf:TestObject"/>
    </wsdl:message>
    <wsdl:operation name="testAction">
    <wsdl:input name="testRequest" message="mf:testRequest"/>
    <wsdl:output name="successResponse" message="mf:successResponse"/>
    </wsdl:operation>
    and the test code:
    public void testOptionalAttrs()
    TestObject testObj = new TestObject();
    testObj.setName("testName");
    //testObj.setSubId(2);
    MDSProvisioningResourcePortType resourceManager = factory.getGatewayResourceManager();
    boolean success = resourceManager.testAction(testObj);
    Running the test code with the 'setSubId' uncommented works.
    With the 'setSubId' call commented out out results in this error:
    javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
    - with linked exception:
    [com.sun.xml.bind.api.AccessorException: java.lang.NullPointerException]
         at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:301)
         at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:124)
         at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:91)
         at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:225)
         at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:121)
         at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:69)
         at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:541)
         at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:497)
         at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:392)
         at com.sun.xml.ws.client.Stub.process(Stub.java:213)
         at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:120)
         at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:238)
         at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:212)
         at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:103)
         at $Proxy58.testAction(Unknown Source)
         at com.qualcomm.mf.prov.ProvisioningGatewayClientFactoryTest.testOptionalAttrs(ProvisioningGatewayClientFactoryTest.java:118)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
         at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
         at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
         at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
         at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
         at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
         at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
         at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
         at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: javax.xml.bind.MarshalException
    - with linked exception:
    [com.sun.xml.bind.api.AccessorException: java.lang.NullPointerException]
         at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:255)
         at com.sun.xml.bind.v2.runtime.BridgeImpl.marshal(BridgeImpl.java:64)
         at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:105)
         at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:292)
         ... 35 more
    Caused by: com.sun.xml.bind.api.AccessorException: java.lang.NullPointerException
         at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:224)
         at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:239)
         at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeAttributes(ClassBeanInfoImpl.java:302)
         at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:661)
         at com.sun.xml.bind.v2.runtime.BridgeImpl.marshal(BridgeImpl.java:111)
         at com.sun.xml.bind.v2.runtime.CompositeStructureBeanInfo.serializeBody(CompositeStructureBeanInfo.java:71)
         at com.sun.xml.bind.v2.runtime.CompositeStructureBeanInfo.serializeBody(CompositeStructureBeanInfo.java:19)
         at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:663)
         at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:250)
         ... 38 more
    Caused by: com.sun.xml.bind.api.AccessorException: java.lang.NullPointerException
         at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:33)
         at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.print(TransducedAccessor.java:199)
         at com.sun.xml.bind.v2.runtime.property.AttributeProperty.serializeAttributes(AttributeProperty.java:61)
         at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeAttributes(ClassBeanInfoImpl.java:295)
         ... 44 more
    Caused by: java.lang.NullPointerException
         at org.w3._2001.xmlschema.Adapter3.marshal(Adapter3.java:23)
         at org.w3._2001.xmlschema.Adapter3.marshal(Adapter3.java:1)
         at com.sun.xml.bind.v2.runtime.reflect.AdaptedAccessor.get(AdaptedAccessor.java:31)
         ... 47 more
    So am I missing something or is jax-ws not handling optional attributes correctly?
    Thanks,
    Hank

    Hi,
    This is not a direct answer to your question. But if you want to build restful web services with Weblogic 10.3, why not use Jersey . It is the implementation of the new JAX-RS spec. In my experience, although Jersey is part of the Java EE 6 spec, it appears to work ok with Java EE 5 container like Weblogic 10.3.1. The [JAX-RS section of Java EE tutorial|http://java.sun.com/javaee/6/docs/tutorial/doc/giepu.html] is another good source of example code.
    Edited by: vamsee2 on Sep 25, 2009 12:38 PM

  • How can I install ntfs on an external hard drive so that my Samsung Smart TV can see my media files? Or is there a better option?

    How can I install ntfs on an external hard drive so that my Samsung Smart TV can see my media files? Or is there a better option?

    OS X cannot natively write to a drive formatted as NTFS, nor can it format a drive as NTFS. There are third-party NTFS drivers available on the market.
    Just out of curiosity: Even with NTFS, how is your TV going to access the external hard drive? Does the TV have a USB port?

  • Better options than DAVE for Win NT connection?

    I work for a small Mac design group in a large business environment. We store Quark, InDesign, Photoshop files on the companies Win NT Server. To do this they have installed DAVE because they said just using OS X's PC connect ability was causing the documents to be looked at as .exe or unrecognizable files by the Mac. Lately some files are giving I/O errors on the server and getting corrupted. Is there a better option for communicating with a PC server than DAVE?

    For just using OS X, I've never heard of any problems like that; I'm wondering if they're just confused? Or are they using a fairly fancy, unusual setup of some sort? Has anyone tried just connecting with the standard Mac feature?; I would be curious to hear what breaks (since if something does break, it probably implies that someone either misconfigured the Macs or misconfigured the server).
    For the files in question: Are you able to access these files from a Windows computer?; can you read them there? I'm wondering if the IO error was a network problem (that DAVE might have a connection to), or just that their server's hard disk is failing.

  • WHICH IS BETTER OPTION IN THE U.S. MARKET SAP CRM or SAP SD

    HI I WISH TO DO A COURSE IN SAP I HAVE TO DECIDE BETWEEN 2 OPTIONS SHOULD I DO SAP SD or SAP CRM WHICH ONE IS A BETTER OPTION AS I AM AN M.B.A. IN MARKETING WITH NO I.T. OR TECH KNOWLEDGE AT ALL. SO WHAT CAN YOU RECCOMEND PLEASE REPLY IT WOULD BE APPRECIATED
    THANKS

    Hello Monty,
    I m located in Mumbai, India.
    Surely I would have helped in India.
    As  far as NY or NJ is concerned I don't know much.
    Here in India we have SIEMENS or GENOVATE which provide SAP Cerification.
    Search for some authorized training acadamey of SAP there, search on net........
    Definitely U will succeed.
    Reward me points, if this helps.
    Anubhav
    [email protected]

  • Which is the better option?

    Hey, I'm looking at getting a new mac but I'm not sure what's the better option. My choice right now is between the base 21.5 inch iMac or the Mac mini ( $799 model), and my main use for it would be recording instruments, music production, and movies / netflix. The 21.5 inch Mac would only give me 8gb of ram, whereas the Mac mini I'd instantly be able to upgrade to 16gb. Another bonus to the mac mini is that I can hook it up to whatever screen I want including my TV for movies.Also, the firewire on the mac mini would be extremely useful as some of the higher quality recording interfaces use firewire. And from what I understand I can also add a SSD to the mac mini? For these reasons I'm leaning towards the Mac mini but I've been recommended by representatives at apple to get the iMac as it's more powerful supposedly, so I'm not sure which one would be better. I know the iMac has a dedicated graphics card vs the integrated hd 4000 on the Mac mini, but I'm not exactly sure how that affects me for what I plan on using the computer for. I'd have to buy a monitor and mouse + keyboard for the mac mini, so it ends up costing me the same as the base model iMac. Any suggestions/ opinions would be appreciated, thanks.

    I would recommend getting the 16GB iMac. If money is an issue then consider using Apples refurbished store, there is no downside to buying from it as they sell current machine, the products have the same warranty as a new machine, and are eligible for AppleCare.
    Because you did not compelete a profile we have no idea where on the planet you are located. To find the US refurb store click:
    http://store.apple.com/us/browse/home/specialdeals

  • Can anybody help me SAP MDM or SAP XI is better option for an ABAPer

    Hi All,
        I have 5 years of exp in SAP ABAP.I want to learn new techonology.I am planning for SAP MDM or SAP XI.
    Can anybody guide me which one is better for me like for a ABAPer which one is a better option and why.

    hi,
    if you have the chance of working with MDM,better to go MDM
    other wise XI for ABAPer

  • Optional attributes in Tag file

    Hi,
    New to tag files here...
    Let's say I have an optional attribute defined in a tag file:
    <%@ attribute name="width" required="false" %>
    <table width="${width}">
    </table>
    How do I detect in the tag file whether that parameter is passed in or not? I want to be able to use a default value for width (say 60%) if it's not passed in, but use the value passed in if provided.
    Thanks,
    Eric.

    <c:if test="${empty width}">
      <c:set var="width" value="60%"/>
    </c:if>Or something like that...

  • Processing in 2 internal tables -Performance wise better option

    Hi Experts,
    I have 2 internal tables.
    ITAB1 and ITAB2  both are sorted by PSPHI.
    ITAB1 has PSPHI  some more fields INVOICE DATE  and AMT
    ITAB2 has PSPHI  some more fields amount.
    Both itab1 and itab2 will always have same amount of data.
    I need to filter data from ITAB2 based invoice date given on selection screen.since ITAB2 doesnt have invoice date field.
    i am doing further processing to filter the records.
    I have thought of below processing logic and wanted to know if there is a better option performance wise?
    loop at ITAB1 into wa where invoice_date > selection screen date. (table which has invoice date)
    lv_index = sy-tabix.
    read table itab2 where psphi = wa-psphi and index = lv_index.
    if sy-subrc = 0.
    delete itab2 index lv_index.
    endif.
    endloop.

    Hi Madhu,
    My Requirement is as below could you please advice on this ?
    ITAB1
    Field   1 PSPHI ,    FIELD 2 INVOICE,  FIELD 3 INVOICE_DATE , FIELD4 AMT
                 15245,                       INV1,                           02/2011  ,  400
                  15245                       INV2                            02/2012  ,  430
    ITAB2
       Field   1 PSPHI ,    FIELD 2 PSNR,      FIELD 3 MATNR  , FIELD4 AMT
                 15245,                       PSNR1,                   X .          430
                  15245                       IPSNR2                    Y,          400
    When user enteres date on sel screen as 02/2011
    I want to delete the data from itab1 and itab2 for invoice date greater then 02/2011/
    If i delere ITAB1 for date > selection screen date.
    Loop itab1.
    delete itab2 where psphi in itab1 will delete both rows in above example because the field psphi which is common can be mutiple.
    endloop.
    Can you advice ?

  • CSM Redundancy : FT or HSRP +FT .. Which is the better option?

    Hi,
    I would like to know for redundancy between CSMs which is the better option FT or HSRP with FT.. and why ?
    Regards
    Kas

    The CSM does not run HSRP.
    So your only option is FT failover.
    Gilles.

  • [svn:fx-trunk] 7671: The SWF metadata tag has optional attributes widthPercent and heightPercent .

    Revision: 7671
    Author:   [email protected]
    Date:     2009-06-09 07:31:19 -0700 (Tue, 09 Jun 2009)
    Log Message:
    The SWF metadata tag has optional attributes widthPercent and heightPercent.  The expected format is "[ws]double%[ws]". For example, [SWF (backgroundColor="#FFFFFF", widthPercent="92%", heightPercent="81%", frameRate="60" )].  Don't blindly strip off the last non-whitespace char and allow the % to be optional.
    QA Notes:
    Doc Notes:
    Bugs: SDK-21436
    Reviewers: Pete
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-21436
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/internal/OEMReport.java

  • Im about to buy a macbook pro. but I dont know if there are too much techproblems with the retina model,such as overheating, malfunction of the fans, screen problems?. or is the macbook pro non retina in tech problems a better option? thanxa lot

    Im about to buy a macbook pro. but I dont know if there are too much techproblems with the retina model,such as overheating, malfunction of the fans, screen problems?. or is the macbook pro non retina in tech problems a better option? thanxa lot

    I have a brand new rMBP and have not seen any of those problems.

  • When traveling to europe would icloud be an advantage re Itunes and music. or would spotify be a better option? iclo

    when travelling abroad would spotify be a better option than icloud?

    This might be of interest, seems apple are encouraging the record companies to improve their source files for submission to the itunes store. Any improvement in audio quality is to be welcomed.
    http://www.apple.com/itunes/mastered-for-itunes/
    http://support.apple.com/kb/HT5156?viewlocale=en_US
    The mastered for itunes document in the first link contains a comment about keeping the highest quality masters in our systems will allow for future improvements to your music.
    Was reading a couple of online blogs abut this and most people appear to be positive about the improvements, I had a listen and compared some previous CD against the same track in the mastered for itunes list and its appears to be an improvement (using Grado Labs SR80 phones not white ear buds), more open sounding.
    Some CDs mastered years ago are very poor and even some recent ones are poorly mastered (loudness, bright) suppose it depends on the care put in at source that counts.

  • Which is a better option : VO on DB View or a VO with two EOs

    I have 2 tables:
    ITEMS_BASE and ITEMS_TL ( contains all translatable column of base table: ITEM_BASE).
    What is better option for me:
    1. TO create a DB View on top of ITEMS_BASE & ITEMS_TL and then create my VO on the DB View OR
    2. Create 2 EOs on ITEMS_BASE and ITEMS_TL and create my VO on these 2 EOs.
    Please also explain reason behind selection of your choice.
    regards -Anuj

    Jdev ver : 11.1.1.4
    Use Case:
    I want to display a rule message in the language as per users local. Only rule name & rule description is a translatable column so i have kept it into separate table.
    Table design:
    Table name : RULE_B
    Columns : PlantCd, ModuleCd, IsRuleApplicable, Value
    Example data : 101, safety, Y, 5
    Table name : RULE_T
    Columns : PlantCd, ModuleCd, RuleName, RuleDesc, Lang
    Example data : 101, safety, 'Minimum Observation required', 'Total number of observation required per site', 'EN'
    101, safety, 'garbage input', 'garbage input', 'gr'
    So i have 2 choices here. either I should create 2 EOs on RULE_B and RULE_T and make my VO on these 2 EOs Or
    create an updatable DB View comprising RULE_B and RULE_T and create my VO on the DB View.

Maybe you are looking for

  • Streaming Video From My Macbook to my Xbox 360

    I'm REALLY hoping someone can help. I was a windows XP user, and got my first mac a few months ago, I could not be happier.... except I used to stream all my audio and video from my old laptop through my Xbox 360 to watch on my TV, and now I seem to

  • Multiple color in a graph

    Hi friends,                The is a SAP standard program in the name GRAPHICS_GUI_CE_DEMO with the help of which we can generate reports represented in graphical way.Whenever we generate a graph,it shows us a bar graph having first bar in yellow,Can

  • How to get repair without Apple Retail Store nearby?

    My daughter's Ipod Touch stopped working after 6 weeks.  Apple support tells me the only way I can get it repaired is by physically taking it to an Apple retail store or a UPS store, neither of which is within an hours drive of me.  Has anyone been a

  • How to get system status and user status ?

    how to get system status and user status for the given production order? In which PP table we can find these? Thanks&Regards Satish

  • Photoshop performing strangely (menu options greyed out and Save As not working)

    Just recently routine tasks have become not so routine. When I use File/Open everything is greyed out because the Enable field is blank. I can't find any place to set this field permanently to All Readable Documents. Secondly, when I use Save As, Pho