How to handle xml CDATA string element when OSB calling a webservice

Hi
Right, I'm new to OSB so bear with me.
The following is a response from am operation in a webservice.
As you can see there is a CDATA string in "<m:return>" element. I want to transform the CDATA string to XML.
I have searched the forum and found a couple of similar queries and tried following the answers and this is what I'm getting.
Please advise as to where I have gone wrong and how I can correct it.
<env:Body xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
     <m:ReservationCancelResponse xmlns:m="http://domain/jws">
          <m:return>
               <![CDATA[<?xml version="1.0" encoding="UTF-8"?><ReservationCancelNegativeAck><MessageId>HGv2OWS6hq</MessageId><ReservationNum>1234</ReservationNum><CsrId></CsrId><ErrorCode>02</ErrorCode><ErrorMessage>Reservation '1234' does not exist.</ErrorMessage></ReservationCancelNegativeAck>]]>
          </m:return>
     </m:ReservationCancelResponse>
</env:Body>
In my response pipeline I have an Assign and Replace action.
My Assign is:
Expression: fn-bea:inlinedXML($body)
Variable: reservationCancelReponse
When I log $reservationCancelReponseI get... so this bit is OK.
<ReservationCancelNegativeAck>
<MessageId>HGv2OWS6hq</MessageId>
<ReservationNum>1234</ReservationNum>
<CsrId/>
<ErrorCode>02</ErrorCode>
<ErrorMessage>Reservation '1234' does not exist.</ErrorMessage>
</ReservationCancelNegativeAck>
My Replace
XPath: executeResponse/executeReturn/text()
In Variable: body
Expression: responseTransform.xq (binding with $reservationCancelReponse)
Replace Node Contents is checked
When I test the operation using the proxy service I get the following:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<m:ReservationCancelResponse xmlns:m="http://com/ventyx/abws/jws">
<m:return>
&lt;?xml version="1.0" encoding="UTF-8"?>&lt;ReservationCancelNegativeAck>&lt;MessageId>HGv2OWS6hq&lt;/MessageId>&lt;ReservationNum>1234&lt;/ReservationNum>&lt;CsrId>&lt;/CsrId>&lt;ErrorCode>02&lt;/ErrorCode>&lt;ErrorMessage>Reservation &amp;apos;1234&amp;apos; does not exist.&lt;/ErrorMessage>&lt;/ReservationCancelNegativeAck>
</m:return>
</m:ReservationCancelResponse>
</env:Body>
</env:Envelope>
The CDATA string hasn't been transformed.
Please help. What I have I missed.
Thanks in advance.
MI

OK
I have made some amendments to the original process and made some progress but still isn't quite right.
I have created a schema:
<complexType name="ReservationCancelNegativeAckType">
     <sequence>
               <element name="MessageId" minOccurs="0">
                    <annotation>
                         <documentation>
                         </documentation>
                    </annotation>
                    <simpleType>
                         <restriction base="string" />
                    </simpleType>
               </element>
               <element name="ReservationNum" minOccurs="0">
                    <annotation>
                         <documentation>
                         </documentation>
                    </annotation>
                    <simpleType>
                         <restriction base="string" />
                    </simpleType>
               </element>
               <element name="CsrID" minOccurs="0">
                    <annotation>
                         <documentation>
                         </documentation>
                    </annotation>
                    <simpleType>
                         <restriction base="string" />
                    </simpleType>
               </element>
               <element name="ErrorCode" minOccurs="0">
                    <annotation>
                         <documentation>
                         </documentation>
                    </annotation>
                    <simpleType>
                         <restriction base="string" />
                    </simpleType>
               </element>
               <element name="ErrorDescription" minOccurs="0">
                    <annotation>
                         <documentation>
                         </documentation>
                    </annotation>
                    <simpleType>
                         <restriction base="string" />
                    </simpleType>
               </element>
     </sequence>
</complexType>
<element name="ReservationCancelNegativeAckType"
     type="tns:ReservationCancelNegativeAckType">
</element>
I have amended the earlier Assign action to use an XQ to extract the CDATA string into the schema
My Assign is:
Expression: responseToSchema.xq
Variable: reservationCancelReponse
When I log $reservationCancelReponse variable I get... so this bit is OK.
<ReservationCancelNegativeAck>
<MessageId>HGv2OWS6hq</MessageId>
<ReservationNum>1234</ReservationNum>
<CsrId/>
<ErrorCode>02</ErrorCode>
<ErrorMessage>Reservation '1234' does not exist.</ErrorMessage>
</ReservationCancelNegativeAck>
I have also changed my Replace, this time I am using an XQ which will map the schema to the XSD WSDL "ReservationCancelResponse"operation.
XPath: .
In Variable: body
Expression: responseFromSchemaToService.xq (binding with $reservationCancelReponse)
Replace Node Contents is checked
XSD WSDL is:
<xsd:element name="ReservationCancelResponse"
     type="tns:ReservationCancelResponseType">
</xsd:element>
<xsd:complexType name="ReservationCancelResponseType">
     <xsd:sequence>
          <xsd:element name="ResponseCode"
               type="xsd:string">
          </xsd:element>
          <xsd:element name="ResponseDescription"
               type="xsd:string">
          </xsd:element>
          <xsd:element name="MessageID" type="xsd:string">
          </xsd:element>
          <xsd:element name="ReservationNum" type="xsd:string">
          </xsd:element>
          <xsd:element name="CsrId" type="xsd:string">
          </xsd:element>
          <xsd:element name="ErrorCode" type="xsd:string"
               minOccurs="0">
          </xsd:element>
          <xsd:element name="ErrorDescription" type="xsd:string" minOccurs="0"></xsd:element>
     </xsd:sequence>
</xsd:complexType>
This time the response is better but not right.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"/>
<env:Body xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<app:ReservationCancelResponse xmlns:app="http://www.example.org/AppointmentService/">
<ResponseCode>0</ResponseCode>
<ResponseDescription/>
<MessageID/>
<ReservationNum/>
<CsrId/>
</app:ReservationCancelResponse>
</env:Body>
</soapenv:Envelope>
As you can see the tags are empty. (For info: The "ResponseCode" and "ResponseDescription" are constants)
Where have I gone wrong?

Similar Messages

  • How to pass a xml CDATA in string element when OSB calling a webservice?

    How to pass a xml CDATA in string element when OSB calling a webservice?
    I have a business service (biz) that route to operation of a webservice.
    A example of request to this webservice legacy:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eg="example">
    <soapenv:Header/>
    <soapenv:Body>
    <ex:execute>
    <ex:arg><![CDATA[<searchCustomerByDocumentNumber>
    <documentNumber>12345678909</documentNumber>
    </searchCustomerByDocumentNumber>]]></ex:arg>
    </ex:execute>
    </soapenv:Body>
    </soapenv:Envelope>
    the type of ex:arg is a string.
    How to pass this CDATA structure to webservice in OSB?

    Steps to solve this problem:
    1. Create a XML Schema. E.g.:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         elementFormDefault="unqualified">
         <xs:complexType name="searchCustomerByDocumentNumber">
              <xs:sequence>
                   <xs:element name="documentNumber" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation>
                             </xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                             <xs:restriction base="xs:string" />
                        </xs:simpleType>
                   </xs:element>
         </xs:sequence>
         </xs:complexType>
         <xs:element name="searchCustomerByDocumentNumber" type="searchCustomerByDocumentNumber"></xs:element>
    </xs:schema>
    With this XSD, the XML can be generate:
    <?xml version="1.0" encoding="UTF-8"?>
    <searchCustomerByDocumentNumber xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="searchCustomerByDocumentNumber.xsd">
    <documentNumber>documentNumber</documentNumber>
    </searchCustomerByDocumentNumber>
    2. Create a XQuery to create a searchCustomerByDocumentNumber ComplexType. E.g.:
    (:: pragma bea:global-element-return element="searchCustomerByDocumentNumber" location="searchCustomerByDocumentNumber.xsd" ::)
    declare namespace xf = "http://tempuri.org/NovoSia/CreateSearchCustomerByDocumentNumber/";
    declare function xf:CreateSearchCustomerByDocumentNumber($documentNumber as xs:string)
    as element(searchCustomerByDocumentNumber) {
    <searchCustomerByDocumentNumber>
    <documentNumber>{ $documentNumber }</documentNumber>
    </searchCustomerByDocumentNumber>
    declare variable $documentNumber as xs:string external;
    xf:CreateSearchCustomerByDocumentNumber($documentNumber)
    3. In your stage in pipeline proxy add a assign calling the XQuery created passing the document number of your payload.
    Assign to a variable (e.g.: called searchCustomerByDocumentNumberRequest)
    4. Create another XQuery Transformation (XQ) to create a request to the webservice legacy. E.g.:
    <ex:arg>{fn-bea:serialize($searchCustomerByDocumentNumberRequest)}</ex:arg>
    For more information about xquery serialize function:
    41.2.6 fn-bea:serialize()
    You can use the fn-bea:serialize() function if you need to represent an XML document as a string instead of as an XML element. For example, you may want to exchange an XML document through an EJB interface and the EJB method takes String as argument. The function has the following signature:
    fn-bea:serialize($input as item()) as xs:string
    Source: http://docs.oracle.com/cd/E14571_01/doc.1111/e15867/xquery.htm

  • How to receive a xml CDATA in string element when OSB calling a webservice?

    How to receive a xml CDATA in string element when OSB calling a webservice?
    I have a business service (biz) that route to operation of a webservice.
    A example of response to this webservice legacy:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eg="example">
    <soapenv:Header/>
    <soapenv:Body>
    <ex:executeResponse>
    <ex:arg><![CDATA[<searchCustomerByDocumentNumberResponse>
    <name>John John</name>
    </searchCustomerByDocumentNumberResponse>]]></ex:arg>
    </ex:executeResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    the type of ex:arg is a string.
    How to receive this CDATA structure to webservice in OSB?

    Similiar to the answer How to pass a xml CDATA in string element when OSB calling a webservice?
    Use the xquery function fn-bea:inlinedXML rather than fn-ben:serialize
    Steps to solve this problem:
    1. Create a XML Schema. E.g.:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="unqualified">
    <xs:complexType name="searchCustomerByDocumentNumberResponse">
    <xs:sequence>
    <xs:element name="name" minOccurs="0">
    <xs:annotation>
    <xs:documentation>
    </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
    <xs:restriction base="xs:string" />
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="searchCustomerByDocumentNumberResponse" type="searchCustomerByDocumentNumberResponse"></xs:element>
    </xs:schema>
    2. Create a XQuery to create a searchCustomerByDocumentNumber ComplexType. E.g.:
    3. Create a XQuery Transformation (XQ) to get the CDATA response to the webservice legacy. E.g.:
    declare namespace ns0 = "novosiaws";
    declare function xf:getReponse($searchCustomerByDocumentNumberResponse as element(ns0:searchCustomerByDocumentNumberResponse))
    as element(searchCustomerByDocumentNumberResponse) {
    fn-bea:inlinedXML($searchCustomerByDocumentNumberResponse/ns0:arg)
    For more information about xquery function:
    fn-bea:inlinedXML
    The fn-bea:inlinedXML() function parses textual XML and returns an instance of the XQuery 1.0 Data Model.
    The function has the following signature:
    fn-bea:inlinedXML($text as xs:string) as node()*
    where $text is the textual XML to parse.
    Examples:
    fn-bea:inlinedXML(“<e>text</e>”) returns element “e”.
    fn-bea:inlinedXML(“<?xml version=”1.0”><e>text</e>”) returns a document with root element “e”.
    Source: http://docs.oracle.com/cd/E13162_01/odsi/docs10gr3/xquery/extensions.html

  • How to turn on the light for when a call comes in ?

    how to turn on the light for when a call comes in?

    Settings>General>Accessibility>Hearing>LED Flash for Alerts>Off.

  • I updated my iphone to ios 7.1.1 and after that my contact photo when i call or call others to me is a small cycle of that picture i choose ... How can i make a big picture when i call my contant and when others call me ?

    I updated my iphone to ios 7.1.1 and after that my contact photo when i call or call others to me is a small cycle of that picture i choose ... How can i make a big picture when i call my contant and when others call me ?

    It's not clear why Apple made this change; speculation (which is not really allowed in these forums) is that it was done to protect the privacy of the caller.

  • How to handle xml message in proxy inbound processing?

    Hi Experts,
    I have a scenario that is SOAP Client====>XI===>ECC.
    But i don't need to use the XI mapping,i skip mapping
    in XI and use the generated proxy inbound processing.
    Here is a message structure as below.
    <commodityList>
    &#9632;<commodity>
    &#9632;&#9632;<detailNo>303303</detailNo>
    &#9632;&#9632;<makerName>sony</makerName>
    &#9632;&#9632;<ChargeInfoList>
    &#9632;&#9632;&#9632;<productId>aaaa</productId>
    &#9632;&#9632;&#9632;<name>bbb</name>
    &#9632;&#9632;</ChargeInfoList>
    &#9632;</commodity>
    </commodityList>
    When i sent the message without field entry of <productId>
    and <name> i got the response in soap client as below.
    <commodityList>
    &#9632;<commodity>
    &#9632;&#9632;<detailNo>303303</detailNo>
    &#9632;&#9632;<makerName>sony</makerName>
    &#9632;</commodity>
    </commodityList>
    The field tag <ChargeInfoList> doesn't display.
    But i want it to display as below.
    <commodityList>
    &#9632;<commodity>
    &#9632;&#9632;<detailNo>303303</detailNo>
    &#9632;&#9632;<makerName>sony</makerName>
    &#9632;&#9632;<ChargeInfoList>
    &#9632;</commodity>
    </commodityList>
    In case of field entry is empty,how to  let the response
    contains tag?
    As i know ,there is a CONTROLLER in proxy .
    But i don't know if it is relevant to this
    case and i don't know how to handle it.
    Brand

    Hi Mrudula,
    As far as i know there are no content conversion methodology for HTTPS as the recevier adapter.
    Also you can read through these links to confirm the same:
    http://help.sap.com/saphelp_nw04/helpdata/en/0d/5ab43b274a960de10000000a114084/content.htm
    http://publib.boulder.ibm.com/infocenter/wbihelp/v6rxmx/index.jsp?topic=/com.ibm.wbia_adapters.doc/doc/sap_xi/sapximst30.htm
    SAP NetWeaver - XML Communication Interface (CA-XML) [original link is broken]
    Regards,
    abhy
    note: reward the helpful.

  • How to Parse XML into String in BPEL?

    Hi,
    Can anyone tell me, how can I parse XML into String?
    I am taking input from File Adapter, File adapter is reading that XML.
    Then in assign activity i am using XPath expression(built functions) using XMLParser(),doTranslateToNative() etc.. many functions I have tried but XML is not getting parsed into String Variable.
    Please help me asap.
    Thanks
    Shikha

    Thanks a lot Eric.
    I am trying this, oraext:get-content-as-string('receiveInput_Read_InputVariable','body','/ns3:orders')
    but getting this error
    <bpelFault><faultType>0</faultType><subLanguageExecutionFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>XPath expression failed to execute. An error occurs while processing the XPath expression; the expression is oraext:get-content-as-string('receiveInput_Read_InputVariable','body','/ns3:orders'). The XPath expression failed to execute; the reason was: internal xpath error. Check the detailed root cause described in the exception message text and verify that the XPath query is correct. </summary></part><part name="code"><code>XPathExecutionError</code></part></subLanguageExecutionFault></bpelFault>

  • How to handle JCO Exceptions at JCO (RFC) function call

    Hello Forum,
    I am implementing an JCO Server scenario.
    I use dynamic repositories like Example7.java from the JCO documentation.
    Example7 throws an JCO.AbapException if anything went wrong, e.g. the function is not implemented.
    How to react on this AbapException?
    The examples in SAP Help documentation only catch
    SYSTEM_FAILURE and COMMUNICATION_FAILURE.
    All other RFC modules I have seen which declare the function modules to be used by dynamic JCO repositories (like Example7.java) do not define any other Exception parameters.
    But these two are only thrown and caught when something with communication went completely wrong, e.g. RFC not found.
    But when RFC can be reached and the JCO Server is executing the Java method, an AbapException could be thrown on error. How to react on this?
    In my implementation based on the examples I always get a ABAP dump. The dump says:
    Exception named  without message text. Why that name?
    How to handle this type of exception in order to avoid the dump?
    Can anyone post an example please?
    Thanks,
    Carsten
    Edited by: Carsten Schön on Apr 15, 2008 4:22 PM
    Edited by: Carsten Schön on Apr 15, 2008 4:24 PM

    Hi Micky,
    thanks for your quick response.
    If so, to throw JCO.AbapException on JCO Server side is not correct?
    What I do is throwing the JCO.AbapException (like in the JCO Example 7).
    At the RFC call in APAB I handle both exceptions SYSTEM_FAILURE and COMMUNICATION_FAILURE like
    CALL FUNCTION 'MY_JCO_FUNCTION_MODULE'
        DESTINATION JCO_DEST
        <...>
        EXCEPTIONS
          SYSTEM_FAILURE        = 1  MESSAGE RFC_MESS
          COMMUNICATION_FAILURE = 2  MESSAGE RFC_MESS.
    This works as far something with RFC is wrong, e.g. Server can not find the function or Server not reachable.
    But the AbapException thrown by the JCO Server (Java) is not handled that way. Why?
    Sorry if this is the wrong forum but I tried posting in Netweaver integration and got no answer for 1 week and because it's ABAP related I thought the topic suites here.
    Carsten
    Edited by: Carsten Schön on Apr 15, 2008 5:10 PM

  • What is an element,when we call a function write_from?

    what is an element,when we cal a function write_from what to assign for ELEMENT  and WINDOW...?
    Edited by: Alvaro Tejada Galindo on Feb 20, 2008 4:37 PM

    Hi shekar,
    The main reason of specifying the Function module Write_Form is to make the values visible in the particular window of the form.
    For Ref, see the Below Function Module:
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
        ELEMENT = 'HEADER'
        WINDOW =  'MAIN'
    EXCEPTIONS
        ELEMENT = 1.
    In the above example, I need to declare a element in the Main window. So I have passed 'MAIN' in window and 'HEADER' in element.
    REASON OF SPECIFYING:
    Suppose you want to display the values the internal table say suppose it_itab. If you specify this in the sap script like &it_itab-f1& or &wa_itab-f1& without using write_form wont work.
    So this will be specified as,
    SE38:
    Loop at it_itab into wa_itab.
    CALL FUNCTION 'WRITE_FORM'
    EXPORTING
        ELEMENT = 'HEADER'
        WINDOW =  'MAIN'
    EXCEPTIONS
        ELEMENT = 1.
    endloop.
    Inside Script:
    Inside the Main window:
    /E     HEADER
          &wa_itab-f1&
    what happens is after the loop statement as soon as it encounters the write_form, it searches for the element 'HEADER' in the Main window and values become visible in the form.
    If u need any more details, please tell.
    <REMOVED BY MODERATOR>
    Thanks,
    karthik
    Edited by: Alvaro Tejada Galindo on Feb 20, 2008 4:36 PM

  • How do i put a ringtone so when people call they hear music

    How do i put song on phone so when people call me they hear the song

    Do you mean put a song as your voicemail message?
    If so check with your service provider.
    If not, you can't make the people who are calling you hear the ringtone you have put for them (unless of course they are in the same room as you are).

  • Layout - not recognize the element when i call the function write_form

    Hi experts,
    I got a layout(se71) that not recognize the element that i add in the MAIN window when i call the layout from a program.
    what could it be?
    i add the element in se71.
    any help will be appreciated.
    Michal.

    Hi!
    the write form that u are calling should be as below....
    CALL FUNCTION 'WRITE_FORM'
       EXPORTING
          element                  = 'ELEMENT'
          window                   = 'MAIN'
        EXCEPTIONS
          element                  = 1
          function                 = 2
          type                     = 3
          unopened                 = 4
          unstarted                = 5
          window                   = 6
          bad_pageformat_for_print = 7
         spool_error              = 8
          codepage                 = 9
          OTHERS                   = 10.
      IF sy-subrc <> 0.
        MESSAGE 'MAIN window not called properly'(006) TYPE 'E'.
      ENDIF.                               " IF SY-SUBRC NE 0
    in the layout see if the code there with data element is proper as...
    /E  ELEMENT
       &var&
    Also this write_form FUNCTION MODULE should be called  b/w OPEN_FORM and CLOSE_FORM Function Modules.
    Regards

  • How can I change the display name when I call someone?

    I recently gave a re-provisioned 8300 to a new employee. I wiped out the phone, and re-setup the phone in our exchange server to match the new user's settings.
    The only problem he's having is that when he calls someone, the display name shows the previous users name as the person calling.
    How do I change that?
    Thanks in advance,
    howe132

    You don't say what model the device is, but if GSM, make sure the SIM card has not been edited to the preview name.
    Options > Advanced > SIM card > Menu > Edit Sim Phone Number
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Hi How can I put my number confidential when I call people

    I have a private practice in counselling
    When I have my iphone 4 I use to be able to put my number confidential for when I call my client whit my iPhone4. I just buy a iPhone 5s now and I realise this setting seem not existe anymore.

    Settings -> Phone -> Show My Caller ID

  • How to handle XML string with Single Quotes as a parameter to SP dynamically?

    Hi,
    I would like to know if there is a way to handle the Single Quotes in XML value when it is passed to Stored Procedure?
    I should be able to handle it without adding another Single Quote to it.
    Thanks,
    Chandra Shekar

    Hi Chandra,
    Your requirement is not precise. Based on my understanding and guessing, are you metioning something like the below sample?
    /*If the xml is generated you have no need to escape the singe quote(')*/
    DECLARE @xmlTbl TABLE (ID INT,name VARCHAR(99));
    INSERT INTO @xmlTbl VALUES(1,'Eric''s')
    INSERT INTO @xmlTbl VALUES(2,'Zhang''s')
    DECLARE @xmlDoc1 XML
    SELECT @xmlDoc1
    FROM @xmlTbl FOR XML PATH('PERSON'),ROOT('PERSONS')
    EXEC yourProcedure @xmlDoc1
    /*If your copy and paste the xml, you have to escape the single quote(') with 2s('')*/
    DECLARE @xmlDoc2 XML
    SET @xmlDoc2 = '<PERSONS>
    <PERSON>
    <ID>1</ID>
    <name>Eric''s</name>
    </PERSON>
    <PERSON>
    <ID>2</ID>
    <name>Zhang''s</name>
    </PERSON>
    </PERSONS>'
    EXEC yourProcedure @xmlDoc2
    If that is not regarding your requirement, please elaborate with more details.
    Eric Zhang
    TechNet Community Support

  • How to handle unknown root node type when parsing?

    Hello all, hoping someone knows how to accomplish this...
    I'm trying to use XMLBeans to parse RIXML 2.0 documents. This schema allows for
    multiple root node types, so I don't know when I'm trying to parse a file if the
    root node is a Research node or a Product node, for example. If I try to invoke
    parse and there is a type mismatch I get the following error:
    com.bea.xml.XmlException: D:\RIXML\V2TestDoc.xml:0: error: The document is not
    a Research@http://www.rixml.org/2002/6/RIXML: document element local name mismatch
    expected Researchgot Product
         at com.bea.xbean.store.Root.verifyDocumentType(Root.java:472)
         at com.bea.xbean.store.Root.autoTypedDocument(Root.java:394)
         at com.bea.xbean.store.Root.loadXml(Root.java:763)
         at com.bea.xbean.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:286)
         at com.bea.xbean.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:224)
         at org.rixml.x2002.x6.rixml.ResearchDocument$Factory.parse(Unknown Source)
         at Test.main(Test.java:21)
    Exception in thread "main"
    So how do I generically handle parsing when I don't know what type of root node
    I'm going to get?
    Thanks,
    Joe

    Hello Joe -- You might try parsing the document as XmlObject (which your
    schema-generated types extend). Then you could use an XmlCursor to discover
    what the root element's local name is. Something like the following code
    might be a way to do it. You could also simply re-parse the document after
    discovering its root element name, but that would probably be more
    expensive.
    XmlObject xml = XmlObject.Factory.parse(mydoc.xml);
    XmlCursor cursor = xml.newCursor();
    cursor.toFirstContentToken();
    if (cursor.getName().getLocalPart().equals("Research"))
    // cast the XmlObject to your ResearchDocument type and use it.
    else if (cursor.getName().getLocalPart().equals("Product"))
    // cast the XmlObject to your ProductDocument type and use it.
    cursor.dispose();
    Steve
    "Joe Celentano" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hello all, hoping someone knows how to accomplish this...
    I'm trying to use XMLBeans to parse RIXML 2.0 documents. This schemaallows for
    multiple root node types, so I don't know when I'm trying to parse a fileif the
    root node is a Research node or a Product node, for example. If I try toinvoke
    parse and there is a type mismatch I get the following error:
    com.bea.xml.XmlException: D:\RIXML\V2TestDoc.xml:0: error: The document isnot
    a Research@http://www.rixml.org/2002/6/RIXML: document element local name
    mismatch
    expected Researchgot Product
    at com.bea.xbean.store.Root.verifyDocumentType(Root.java:472)
    at com.bea.xbean.store.Root.autoTypedDocument(Root.java:394)
    at com.bea.xbean.store.Root.loadXml(Root.java:763)
    atcom.bea.xbean.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:28
    6)
    atcom.bea.xbean.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:22
    4)
    at org.rixml.x2002.x6.rixml.ResearchDocument$Factory.parse(Unknown Source)
    at Test.main(Test.java:21)
    Exception in thread "main"
    So how do I generically handle parsing when I don't know what type of rootnode
    I'm going to get?
    Thanks,
    Joe

Maybe you are looking for

  • My Xerox Phaser 6120 is no longer compatible with Firefox. There is no new driver. How can I revert to a previous version so I can browse AND print?

    For a few months, I have been unable to print from Firefox. I assumed it was a setting or something on my network, but today figured out it's my old printer driver that is no longer compatible. There is no new driver, nor will there be one. I love my

  • Copy and Paste from an excel spreadsheet to a JTable

    Hi, does someone know how to copy and paste data from an excel spreadsheet to a JTable. It seems like copy and paste do not fuction from an to a JTable. Thanks, Fred.

  • Problem in import adaptive RFC

    Hi, I am trying to import a simple RFC using Import adaptive RFC model. There is no problem in the RFC execution, since i have tested it. Problem is output is not getting displayed. The output field is blank. Note: RFC while importing, is in warning

  • Update 4.3.5

    Hey all. I just updated my iPad 2 to the 4.3.5 version. But when it was finished my iPad 2 restored by itself. So when it finished restoring I saw that every single app was gone ( the apps I downloaded myself, not the default ones ). So is there anyw

  • Mutilp regions in one page

    I am using ADF BC and Jdev11g 1.1.4, Search for the samples or documents for multiple regions in only one page, but can not get it, Can the expert let me have it ? Thanks!!!! Rgds!