Access element values of JAXBElement ? extends

A section of the XML looks like this:
<DocumentIds>
<CustomerDocumentId>
<Id>7777</Id>
<Revision>Orginal</Revision>
</CustomerDocumentId>
</DocumentIds>
The schema shows:
<xs:element name="CustomerDocumentId" type="PartyDocumentId" substitutionGroup="DocumentIdType"/>
I'm assuming that the substitutionGroup causes the xjc to create a DocumentIdType class but not a CustomerDocumentId class.
The getId() and getRevision() methods are in this DocumentIdType class. The getDocumentIdType() method in the DocumentIds class and returns a List<JAXBElement<? extends DocumentIdType>> object. I can't figure out how to get the Id and Revision values after I unmarshall the XML. It marshalls back out OK because I tried that, so there must be someway to get to these values. Reading section 5.5.5 of the JAXB 2.0 specification and the related references I can see why the class is associated with the element property and not the value but I could find no examples to show how to get to the values. Here's what I tried so far:
PurchaseOrderHeader poh = npo.getHeader();
DocumentIds dids = poh.getDocumentIds();
List<JAXBElement<? extends DocumentIdType>> didt = dids.getDocumentIdType();
for(Iterator iterDIDT = didt.iterator(); iterDIDT.hasNext();)
try
DocumentIdType ndidt = (DocumentIdType)iterDIDT.next();
System.out.println("Cust PO#: " + ndidt.getId());
This gives me a ClassCastException. So I changed it to:
JAXBElement ndidt = (JAXBElement)iterDIDT.next();
This worked but, of course, there was no getId() method. However, if I inserted a line to get the QNAME value of the JAXBElement I came up with "CustomerDocumentId". Not that this helps any but it shows that this class doesn't have values it has properties.
Anybody know how to get the Id and the Revision values while in the iteration of the List?

This forum software is putting extra ">" in my sample.
It reads "<JAXBElement><?"
and it s/b "<JAXBElement<?"

Similar Messages

  • How can I get the element value with namespace?

    I tried to get a element value in xml has namespace but i can't.
    I removed the namespace, i can get a element value.
    How can i get a element value with namespace?
    --1. Error ----------- xml ------------------------------
    <?xml version="1.0" encoding="UTF-8"?>
    *<TaxInvoice xmlns="urn:kr:or:kec:standard:Tax:ReusableAggregateBusinessInformation:1:0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:kr:or:kec:standard:Tax:ReusableAggregateBusinessInformation:1:0 http://www.kec.or.kr/standard/Tax/TaxInvoiceSchemaModule_1.0.xsd">*
    <ExchangedDocument>
    <IssueDateTime>20110810133213</IssueDateTime>
    <ReferencedDocument>
    <ID>318701-0002</ID>
    </ReferencedDocument>
    </ExchangedDocument>
    <TaxInvoiceDocument>
    <IssueID>201106294100</IssueID>
    <TypeCode>0101</TypeCode>
    <IssueDateTime>20110810</IssueDateTime>
    <PurposeCode>02</PurposeCode>
    </TaxInvoiceDocument>
    <TaxInvoiceTradeLineItem>
    <SequenceNumeric>1</SequenceNumeric>
    <InvoiceAmount>200000000</InvoiceAmount>
    <TotalTax>
    <CalculatedAmount>20000000</CalculatedAmount>
    </TotalTax>
    </TaxInvoiceTradeLineItem>
    </TaxInvoice>
    --2. sucess ----------- xml ---------remove namespace---------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <TaxInvoice>
    <ExchangedDocument>
    <IssueDateTime>20110810133213</IssueDateTime>
    <ReferencedDocument>
    <ID>318701-0002</ID>
    </ReferencedDocument>
    </ExchangedDocument>
    <TaxInvoiceDocument>
    <IssueID>201106294100</IssueID>
    <TypeCode>0101</TypeCode>
    <IssueDateTime>20110810</IssueDateTime>
    <PurposeCode>02</PurposeCode>
    </TaxInvoiceDocument>
    <TaxInvoiceTradeLineItem>
    <SequenceNumeric>1</SequenceNumeric>
    <InvoiceAmount>200000000</InvoiceAmount>
    <TotalTax>
    <CalculatedAmount>20000000</CalculatedAmount>
    </TotalTax>
    </TaxInvoiceTradeLineItem>
    </TaxInvoice>
    ---------- program ------------
    procedure insert_table
    l_clob clob,
    wellformed out boolean,
    error out varchar2
    is
    l_parser dbms_xmlparser.Parser;
    xmldoc xmldom.domdocument;
    l_doc dbms_xmldom.DOMDocument;
    l_nl dbms_xmldom.DOMNodeList;
    l_n dbms_xmldom.DOMNode;
    l_root DBMS_XMLDOM.domelement;
    l_node DBMS_XMLDOM.domnode;
    l_node2 DBMS_XMLDOM.domnode;
    l_text DBMS_XMLDOM.DOMTEXT;
    buf VARCHAR2(30000);
    xmlparseerror exception;
    TYPE tab_type is Table of xml_upload%ROWTYPE;
    t_tab tab_type := tab_type();
    pragma exception_init(xmlparseerror, -20100);
    l_node_name varchar2(300);
    begin
    l_parser := dbms_xmlparser.newParser;
    l_doc := DBMS_XMLDOM.newdomdocument;
    dbms_xmlparser.parseClob(l_parser, l_clob);
    l_doc := dbms_xmlparser.getDocument(l_parser);
    l_n := dbms_xmldom.makeNode(l_doc);
    l_nl := dbms_xslprocessor.selectNodes(l_n, '/TaxInvoice/TaxInvoiceDocument');
    FOR cur_tax In 0..dbms_xmldom.getLength(l_nl) - 1 LOOP
    l_n := dbms_xmldom.item(l_nl, cur_tax);
    t_tab.extend;
    t_tab(t_tab.last).ed_id := '5000000';
    dbms_xslprocessor.valueOf(l_n, 'IssueID/text()', t_tab(t_tab.last).tid_issue_id);
    dbms_xslprocessor.valueOf(l_n, 'TypeCode/text()', t_tab(t_tab.last).tid_type_code);
    END LOOP;
    FORALL i IN t_tab.first .. t_tab.last
    INSERT INTO xml_upload VALUES t_tab(i);
    COMMIT;
    dbms_xmldom.freeDocument(l_doc);
    wellformed := true;
    exception
    when xmlparseerror then
    --xmlparser.freeparser(l_parser);
    wellformed := false;
    error := sqlerrm;
    end insert_table;

    l_nl := dbms_xslprocessor.selectNodes(l_n, '/TaxInvoice/TaxInvoiceDocument');try to change as follow
    l_nl := dbms_xslprocessor.selectnodes(l_n,'/TaxInvoice/TaxInvoiceDocument','xmlns="urn:kr:or:kec:standard:Tax:ReusableAggregateBusinessInformation:1:0"');Edited by: AlexAnd on Aug 17, 2011 12:36 AM

  • EJB 3: Dynamic Element Values

    Hi all,
    I'm fairly new to EJB3 and I'm wondering whether it is possible to dynamically assign annotation element values like this:
    @Entity
    @Table(name=myClass.getTableName())
    public class Employee {
    }If not, what else can I do to use the same entity class and respective service class for different tables, which all have the same fields?
    Thanks in advance.
    Stephan

    Hi,
    You should be able to achieve what you're after extending the Employee entity and override @Table in every subclass. It should work. (I'd also be looking for something helpful in persistence.xml as that's where mapping and other configurations are - maybe there's a tag for mapping a class to a table?)
    Jacek

  • Help needed with domparsers for accessing TextNode value

    Hi,
    My input appears like this.
    <header>
    <Data>bhargav</Data>
    <header>
    i need to write a java mapping code where i need to access the value of <Data>.It is a type String and Category is element.In my java code i need to take this content of <Data> into a String.
    Thanks in advance,
    Bhargav
    Message was edited by:
            bhargav gundabolu

    Hi,
    Im using this java mapping to solve the level-2 hierarchical issue that occures with content conversion.I have written my java mapping using domparsers and StreamTransformation. and the output is coming fine.But in one case i need to access the value of the <Data> node and make some changes to it.But im unable to do it as <Data> here is a text node.
    Thanks,
    Bhargav

  • Access promoted value in an outbound map

    Hi all,
    Is there any way to access a promoted value in my outbound map. I tried using xpath but that works only if we I give the property schema in source. I wanted to know if there is any functoid that can accomplish this work of accessing a promoted value from
    property schema, not in orchestration maps, but in outbound map so that I will have 1 source schema and 1 destination schema.
    Thanks in advance.
    BizTalk Developer, Bangalore, India

    Hi Nazeer,
    Not all promoted properties are added to the context of every message. And No, you can use this ContextAccessor functoid to access promoted values which are not promoted in the source schema
    context.
    Let’s explain this process with an example. If your source schema is named-Employee schema and contains three elements in it like ID, Name, Age. And in your schema if you have promoted ID
    element using property promotion, then in the context of this particular message instance along with other system-defined properties you will have ID and its value. This ID can be accessed in the various BizTalk Server components, including pipelines and orchestrations.
    If you have another schema named as Machine which contains element like MachineID, Name and if you have promoted MachineID using property promotion then 
    in the context of the this particular message instance (Machine) you will have MachineID along with other system-defined properties.
    In your outbound map, if your source schema is Employee and if you want to access the MachineID, you will not able to access it because MachineID is part of the Machine message instance.
    But if you want to access the MachineID in your map where Employee scheme is used, then you can copy the context property from an Machine message instance to Employee message instance. If you have any Orchestration before the map you can do so like:
    Employee(PropertySchema.SomePropertyFiled) = Machine(PropertySchema.MachineID)
    So when the Outbound map executed at the send port, using the
    ContextAccessor functiod.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Accessing keys values individually

    Anyone know how i can access a key..I know the get method those this..but my key values can be any number and i need to be able to access them individually without knowing what they are..There is a method called keySet() which returns a list of the keys..Can i access these numbers in the list..or is there a simpler way of doin this..Anyone able to help me..Please..

    Yes im able to return the keySet() values
    [2, 8, 1]But what i need to do is access these values to then access there elements.
    as
    2 = {1, 4, 5, 6}
    8 = {2, 6, 8, 9}
    1 = {3, 5, 7, 9}I was trying to do this in a for loop..by implementing it to a size 0f 3(the size of the map)

  • Access field value in ALV

    Hello experts,
    I have created an simple ALV Grid report, in that I have implemented double click event n I want to create a new ALV grid with new data to be displayed. So I want to access field value ie using SLIS_SELFIELD or anything. Could anyone please guide me how can I access a field value using slis though SLIS_SELFIELD has methods like SEL_TAB_FIELD... I wan to access something like SEL_FIELD_VALUE but its not available in the class.
    Thanks in advance...
    Regards,
    Viral Patel

    Hi Viral,
    SLIS_SELFIELD has an attribute named VALUE which holds the value you selected row & TBAINDEX holds the row number.
    Refer below code snippet :-
    FORM user_command
              USING s_ucomm LIKE sy-ucomm
              s_selfield TYPE slis_selfield.                    "#EC CALLED
      CASE s_ucomm.
        WHEN '&IC1'.
          CLEAR wa_podat2.
          READ TABLE itab_podat2 INTO wa_podat2 INDEX s_selfield-tabindex.
          CHECK sy-subrc = 0.
          IF wa_podat2-ebeln = s_selfield-value.
            SET PARAMETER ID 'BES' FIELD wa_podat2-ebeln.
            IF wa_podat2-ebeln IS NOT INITIAL.
              CALL TRANSACTION c_tcode.
            ENDIF.
    For above event to happen, you have to use parameter I_CALLBACK_USER_COMMAND of  REUSE_ALV_GRID_DISPLAY as below :-
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = l_repid
          i_callback_user_command = 'USER_COMMAND'
          it_fieldcat             = itab_fieldcat
          it_events               = itab_events
        TABLES
          t_outtab                = itab_podat2[].
    Regards
    Abhii
    Edited by: Abhii on Nov 30, 2009 11:25 AM

  • How can I access the values in ProfileArray of a CWIMAQProfileReport?

    Hi all,
    I'm not sure if this is the right board, but I didn't find one related to VB and NI Vision.
    I'm using LineProfile2 from CWIMAQVision1 which gives me a ProfileArray which is a variant. I'd like to access the
    values in the array. Normally I would do it like
    Report(1).ProfileArray(i)
    but that does not work. I can get the bounds of the array with LBound and UBound. I can observe the array in 
    debug modus and it contains reasonable values.
    How can I get access to the contents of the ProfileArray?
    Thanks in advance
    Axel

    Hi Elmar,
    thanks for paying attention to my problems.
    I use Vision 8.5. My email adress is [email protected]
    I don't need the hole intensity of the image/2D array. I only need the
    intensity values of a given line which should be a 1D array of bytes.
    I use the following command
            CWIMAQVision1.LineProfile2 Image, Line, Report
    When I understood the command correctly the intensity values are
    in the Report. I would get them with 
            Report(1).ProfileArray(i)
    But that does not work. I get a runtime error #450.
    Other stuff with the report works and gives reasonable values e.g.
                Report(1).PixelCount
                LBound(Report(1).ProfileArray)
                UBound(Report(1).ProfileArray)
    Or passing the hole array to plot the values also works
            frmLineProfile.CWGraph1.PlotY Report(1).ProfileArray
    Best regards,
    Axel

  • Accessing the value of a text box input

    how do i access the value of a text box on a jsp page..
    eg:if the page name is Test.jsp and it has a text box named text.....

    You're mixing JSP and JavaScript. If you're staying within the same page, e.g. no get/post to another JSP, and you need to update values of a text field within a form, use pure JavaScript, such as:
    <form name="fred">
    <input type="text" name="USERID" size="15" onBlur="document.fred.PASS.value=document.fred.USERID.value;"><br>
    <input type="text" name="PASS" size="15"><br>
    </form>
    This will change the value of the PASS field to the same as the USERID field, which is what I think you were trying to do.
    Not to be rude, but in the interest of keeping the Java forum pure, I would look towards a JavaScipt forum if you wish to use pure JavaScript (http://freewarejava.com/cgi-bin/forumdisplay.cgi?action=topics&number=1&SUBMIT=Go)
    bRi

  • How to access the value of a field of a field symbol.

    Hello All,
    i need to access the value of a field in a field symbol. But when i am trying to get the value like <FS>-POSNR, it's showing that that the <FS> has no structure.
    In my program, the field itself that i need to check should be dynamic. ie i'll get the field in a variable and i need to find the value of that field.
    Am pasting my code below, please tell me what needs to be done.
    here in my sample code i am moving the entry of the <FS> into a work area structure. But in my actual program, i gets the structure as a parameter. So is there any way i can declare a work area dynamically...
    FUNCTION z_39181_dyn_fs_60758.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(PARAMETER) TYPE  VBELN
    *"  TABLES
    *"      DATA_TAB
      BREAK-POINT.
      FIELD-SYMBOLS <fs> TYPE ANY.
      FIELD-SYMBOLS <fs1> TYPE ANY.
      FIELD-SYMBOLS <fstab> TYPE ANY TABLE.
      DATA name(5) VALUE 'POSNR'.
      FIELD-SYMBOLS <f> TYPE ANY.
      DATA: dref TYPE REF TO data,
            dref1 TYPE REF TO data,
            dref2 TYPE REF TO data.
      DATA: lv_lips TYPE string.
      DATA: lv_lipsfld TYPE string,
                lv_fld TYPE string,
                lw_lips TYPE lips.
                lv_lips = 'LIPS'.
                lv_fld = 'LW_lips-POSNR'.
      CREATE DATA dref1 TYPE (lv_lips).
      CREATE DATA dref TYPE STANDARD TABLE OF (lv_lips).
      CREATE DATA dref2 LIKE LINE OF data_tab.
      ASSIGN dref->* TO <fstab>.
      ASSIGN dref1->* TO <fs>.
    assign dref2->* to <fs
      <fstab> = data_tab[].
      LOOP AT <fstab> INTO <fs>.
        lw_lips = <fs>.
        WRITE lw_lips-vbeln.
        ASSIGN (lv_fld) TO <fs1>.
       write <fs>
      ENDLOOP.
    Helpful answers will be rewarded...

    Use syntax
    ASSIGN COMPONENT name OF STRUCTURE struc TO <fs>.

  • Accessing ID Value Mapping table in XSLT

    Hi Experts,
    In the XSLT mapping,I would like to access my value mapping table which i defined in ID .The purpose of ID value mapping here is, the table entries will be changing in future and i don want to use fix values, XML table  which is defined in runtime.
    I have gone through the blog
    /people/sreekanth.babu2/blog/2005/01/05/design-time-value-mappings-in-xslt
    which explians design value mapping table in XSLT.
    Is there any way to access Configuration Value Mapping table in XSLT? If yes, can you explain how should i achieve it ?

    Hi,
    you can use the xivmService to call ID val map tables.
    Use tha java function executeMapping, Its a standard SAP api.
    Declare the Service in XSLT at start
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:vm="com.sap.aii.mapping.value.api.XIVMService" version="1.0"> 
    Call the val mapping table using below template wherever required.
    <xsl:template name="ValueMapping">
    <xsl:param name="SenderParam"/>
    <xsl:value-of select="vm:executeMapping( 'SenderType', 'SenderTypeSchema', $SenderParam, 'receiverType', ReceiverTypeSchema')"/>
    </xsl:template>
    Call template like :
    <xsl:call-template name="ValueMapping">
    <xsl:with-param name="SenderParam">
    try it and let me know if you have any doubt.
    regards
    Inder
    Edited by: Kulwinder Grewal on Aug 12, 2009 11:36 PM

  • Exception in assigning XML elements value in Workshop

    Hi ,
    I tried creating a variable of type XML object(OrderREsponse). I have one MB Publisher control which sends in a variable of type OrderResponse. Before sending it , I try setting the individual XML elements value in it. So, for all the individual elemtns , I set accordinglly in both the formats.
    responseXML.addNewOrderResponse().setOrderNumber("N12121212");
    responseXML.getOrderResponse().setOrderNumber("N12121212");
    where responseXML is a variable of type OrderResponse document.
    This place while executing I'm getting an exception.
    Here is the exception I'm getting.
    <Jan 4, 2005 10:51:11 AM MST> <Warning> <WLW> <000000> <Id=top-level; Method=com.bea.wli.bpm.runtime.ProcessState.processNodeOrchestration()
    ; Failure=com.bea.wli.bpm.runtime.UnhandledProcessException: Unhandled process exception [ServiceException]>
    <Jan 4, 2005 10:51:12 AM MST> <Warning> <WLW> <000000> <A message was unable to be delivered from a WLW Message Queue. Attempting to deliver
    the onAsyncFailure event>
    Let me know if the approach is the right one... or how can i set the individual XML elements value from a XML variable.
    Thanks
    Ramesh

    Hi ,
    I tried creating a variable of type XML object(OrderREsponse). I have one MB Publisher control which sends in a variable of type OrderResponse. Before sending it , I try setting the individual XML elements value in it. So, for all the individual elemtns , I set accordinglly in both the formats.
    responseXML.addNewOrderResponse().setOrderNumber("N12121212");
    responseXML.getOrderResponse().setOrderNumber("N12121212");
    where responseXML is a variable of type OrderResponse document.
    This place while executing I'm getting an exception.
    Here is the exception I'm getting.
    <Jan 4, 2005 10:51:11 AM MST> <Warning> <WLW> <000000> <Id=top-level; Method=com.bea.wli.bpm.runtime.ProcessState.processNodeOrchestration()
    ; Failure=com.bea.wli.bpm.runtime.UnhandledProcessException: Unhandled process exception [ServiceException]>
    <Jan 4, 2005 10:51:12 AM MST> <Warning> <WLW> <000000> <A message was unable to be delivered from a WLW Message Queue. Attempting to deliver
    the onAsyncFailure event>
    Let me know if the approach is the right one... or how can i set the individual XML elements value from a XML variable.
    Thanks
    Ramesh

  • Problem with ParseEscapedXML with " " in element value

    I'm having trouble with using getContentAsString, manipulating using a translate in a java embed, and then converting back using ParseEscapedXML. The trouble is occuring when there are "<" and ">" as element values. I'm not sure of a good way to convert the ">" to an escape value for only element values.
    I haven't been able to get the xsl:character-map function to work.
    Any tips would be greatly appreciated.

    HL7 is a flat file old style pipe and bar format for healthcare messaging. It has a section that lists the delimeters, which usually looks something like:
    MSH|^~\&|PMS|ASF|||200704200000||ADT^A04|1177045234.756.19114|P|2.4|||AL|AL
    Where the "&" is designated at the subcomponent separator. When Oracle's B2B tool parses the message and sticks it into an XML format it would break up the fields incorrectly if I had the customer put & lt ; in the flat file. I'm also trying to build a solution that is able to deal with this kind of issue without effecting the source feed.

  • How to access the value of application item in javascript

    How to access the value of application item in javascript?

    Hi,
    One way
    var myVariable = '&MY_APP_ITEM.';Br,Jari

  • Container element value late update in ECC6

    Hi All,
    I have a problem with container element "RECEIVED" which has incomplete value. I'm using function SAP_WAPI_READ_CONTAINER (simple container) in my custom object ZBUS2081 method priceapproval. When 2nd person want to approve the workitem, the container value of element name "RECEIVED" only has previous approval person instead of table that has 2 line values (previous person who has already approved and 2nd person who want to approve this workitem).
    We have upgrade our SAP version from 4.7 into ECC6/ERP6, which in 4.7 version this container element returned table of 2 line values.
    Since the container element value has late to update the value, then it did not recognise as a final approval at the end of workflow step and raise an error for agent determination. If there is any related SAP note, please let me know.
    Thanks,
    Charlie

    Hello Charlie !
                Your RECEIVED container stores approver details.
                Please check the binding between method container to task container to workflow container.Imperfect binding could be a reason why approver details are not populated properly.It seems your container is multiline container.Make sure the method,task and workflow containers are multiline enabled. 
               Check at SWO1, whether the PRICEAPPROVAL method behaves as expected and if you are using rule for agent determination, you have to check the rule at PFAC as well as binding details.Also check at workflow log.
                Hope you have delegated ZBUS2081.
    Regards,
    S.Suresh

Maybe you are looking for

  • SSRS - Is there a multi thread safe way of displaying information from a DataSet in a Report Header?

     In order to dynamically display data in the Report Header based in the current record of the Dataset, we started using Shared Variables, we initially used ReportItems!SomeTextbox.Value, but we noticed that when SomeTextbox was not rendered in the bo

  • Can i charge 30gig ipod with blackberry charger?

    it says on the charger dc output 5.0v > 0.5A. it says on iPod 5-30v > 1A max surely this should be fine but i dont want to plug it in without being sure. has anyone charged an ipod this way before??

  • How Do I Create A Slideshow in Iweb?

    How do I Create a slideshow in Iweb with arrows to right and left, just like this link: http://www.thinkfa.com/ Thanks in advance!

  • HT1689 my iphone wont sync my music...

    i plugged it in, and in my itunes my phone showed up and i had just got some new music so i normally just drag the song to my iphone thing on the side.. but now all of a sudden when im doing that its not going onto my phone /: heelp ?!

  • BPEL and Oracle Portal

    Hello. At the moment i try to find a beginning how to display Values from Oracle BPEL Process Manager to Oracle Portal. I would like to use Portlet Specification JSR-168, if it is possible. For a better understanding: here is a detailed description o