XML Nodeset to String representation

I'm trying to assign/cast an XML nodeset to a string and retain all of the element tags in the string representation. I've tried using the string(), getNodeValue(), and get-content-as-string() expression functions, but all appear to strip the element tags from the string output. Anyone have an idea how to go about this?
Thanks,
Peter

Oddly enough, this transform did the trick...
<xsl:template match="/">
<ns0:Blahqueue>
<blahInstance>
<xsl:value-of select="orcl:get-content-as-string(/mstns:blahSchema)"/>
</blahInstance>
</ns0:Blahqueue>
</xsl:template>

Similar Messages

  • XML Element to string conversion returning null

    Hi,
    When i try to convert XML Element to string using toString() API, it returns something like [device: null] where device is element tag.
    Code is as follows -
    Document xmlDoc;
    DOMParser parser = (DOMParser)Class.forName("org.apache.xerces.parsers.DOMParser").newInstance();
    parser.setFeature( "http://apache.org/xml/features/dom/defer-node-expansion", true );
    parser.parse(new InputSource(new StringReader(tableStr)));
    xmlDoc = parser.getDocument();
    Element root = xmlDoc.getDocumentElement();
    NodeList nodeList = root.getElementsByTagName("device");
    Element deviceNode = (Element)nodeList.item(nodeList.getLength()-1);
    System.out.println(deviceNode.toString()); //prints [device: null] ????
    System.out.println(deviceNode.getAttribute("ipAddress")); //prints correct ip address
    Any idea why i am getting [device: null] when trying to convert Element to String though attribute value is retrieved.
    Thanks,
    Deepak

    Hello ,
    I want to get the root node (<ZTOP60_XML_TAG_STRUCTURE>
    ) of the following xml file .
    <?xml version="1.0" encoding="utf-8"?>
    <ZTOP60_XML_TAG_STRUCTURE>
         <MSGTYPE>NAPOBACK</MSGTYPE>
         <SNDPRN>657393485</SNDPRN>
         <RECEIVER/>
         <RCVPRN>GSOHUBDM1</RCVPRN>
         <PONUM/>
         <VENDCODE>0020040266</VENDCODE>
         <VENDUNS>002601768</VENDUNS>
         <PARTNERFUNC_WE>WE</PARTNERFUNC_WE>
         <PARTNERNUM_WE>C240</PARTNERNUM_WE>
         <LINE_ITEMS>
              <item>
                   <ITEMNUM>00687</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>7.000</GRQTY>
                   <NETVAL>339.65</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FE-26865-01</MATNUM>
                   <MATDESC>PTR, T632, LEXMARK 5-BIN MAILBOX</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00178</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>303.000</GRQTY>
                   <NETVAL>18.62</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FE-ZZYRG-01</MATNUM>
                   <MATDESC>FDD,FDI-PC,1.44MB,3.5 ,HH</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00157</ITEMNUM>
                   <POQTY>999999998.000</POQTY>
                   <BOQTY>24.000</BOQTY>
                   <GRQTY>303.000</GRQTY>
                   <NETVAL>26.25</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FE-25094-01</MATNUM>
                   <MATDESC>MOUSE,PC,3BUT,,INTELLIMOUSE,PS2</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00881</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>62.000</GRQTY>
                   <NETVAL>368.80</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FD-66515-01</MATNUM>
                   <MATDESC>ITU MODULE ASM</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00223</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>377.000</GRQTY>
                   <NETVAL>459.28</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FD-65336-01</MATNUM>
                   <MATDESC>MAIN SYSTEM BOARD T23 (2647)</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00081</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>19.000</BOQTY>
                   <GRQTY>810.000</GRQTY>
                   <NETVAL>217.21</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FD-64199-01</MATNUM>
                   <MATDESC>QST- CADET 100</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00271</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>136.000</GRQTY>
                   <NETVAL>813.76</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>FD-60065-01</MATNUM>
                   <MATDESC>SMART UPS 3000VA RM</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00791</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>3.000</GRQTY>
                   <NETVAL>201.73</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>3X-PBXGG-AA</MATNUM>
                   <MATDESC>ATI 7500 PCI GRAPHICS</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00173</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>32.000</GRQTY>
                   <NETVAL>7.50</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>12-56178-01</MATNUM>
                   <MATDESC>CARD GUIDE,SNAP-IN,LOW PROFILE,2.5 INCHE</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00309</ITEMNUM>
                   <POQTY>999999998.000</POQTY>
                   <BOQTY>15.000</BOQTY>
                   <GRQTY>71.000</GRQTY>
                   <NETVAL>51.23</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>30-51476-01</MATNUM>
                   <MATDESC>VHDI-CABLE WIDE 12 FT. DT-AB001-TQ</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
              <item>
                   <ITEMNUM>00194</ITEMNUM>
                   <POQTY>999999999.000</POQTY>
                   <BOQTY>1.000</BOQTY>
                   <GRQTY>147.000</GRQTY>
                   <NETVAL>345.48</NETVAL>
                   <PLANT>C240</PLANT>
                   <MATNUM>29-33689-01</MATNUM>
                   <MATDESC>PTR,IMP9,B/W,PAR/SER,110/240,R</MATDESC>
                   <PONUMBER>6500022388</PONUMBER>
                   <EKGRP>U17</EKGRP>
                   <DISPO>N07</DISPO>
              </item>
         </LINE_ITEMS>
    </ZTOP60_XML_TAG_STRUCTURE>
    I wrote the following lines of code ..
    FTI .. >> String strMsg =((javax.jms.TextMessage)msg).getText();
    StrMsg is a string that represents an xml file .
    DocumentBuilderFactory docfactory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder builder = docfactory.newDocumentBuilder();
                   Document doc = builder.parse(new InputSource(new StringReader(strMsg)));
                   Element root = doc.getDocumentElement();
                   System.out.println("The root is " + root);
                   String strFileName = root+".xml" ;
                   System.out.println("The file name is " + strFileName);
                   File f = new File (strFileName);
                   FileOutputStream fos = new FileOutputStream( f );
                   for ( int j =0 ; j < strMsg.length(); j++)
                        char c = strMsg.charAt(j);
                        fos.write((int)c);
    I am getting the following error ...
    The root is [ZTOP60_XML_TAG_STRUCTURE: null]
    The file name is [ZTOP60_XML_TAG_STRUCTURE: null].xml
    Whey the file name or root is with special character [ ] and null ..
    I want just ZTOP60_XML_TAG_STRUCTURE.xml .
    Can anyone help me .
    thanks
    mahesh

  • Calling a method via String representation of instance

    Is it possible to call a method of a specific (and already existing) instance of a class using a string representation of the instance?

    By "String representation of an instance," I simply mean a string that has the same format as a normal method call would have. So where a method would normally be called like this:
    ClassX itsInstance = new ClassX();
    itsInstance.methodX();
    The string representation would be:
    String instanceName = "itsInstance";
    And there would be some way of using this string to call the method referred to by instanceName.
    The idea here is that I want to use the existing instance, whereas using reflection, as below, would create a new instance:
    String className = "X";
    String methodName = "print";
    Class xClass = Class.forName(className);
    Method xMethod = xClass.getMethod(methodName,null);
    Object object = xClass.newInstance();
    xMethod.invoke(object,null);

  • How to read from a xml file(in String format) using a java program

    hi friends
    i have a string , which is xml format. i want read the values and display it.can any one suggest how to read a xml file of string format using a javaprogram
    thanks

            final DocumentBuilder db =  DocumentBuilderFactory.newInstance().newDocumentBuilder();      
            final InputStream documentStream = new ByteArrayInputStream(documentXMLSourceString.getBytes("utf-8"));
            final Document document = db.parse(documentStream);

  • Problem in sending XML input as String in BPEL

    Hi,
    We have a BPEL flow (assign, invoke, assign) which takes an XML input as String.
    <RegisterCustomerOnVAS><CustomerID>100</CustomerID><MSISDN>9999999</MSISDN><CustomerName>sanjeev</CustomerName><customerInfo>new user</customerInfo></RegisterCustomerOnVAS>
    Assignment is doing fine, but when Invoke calls partner link, the input is getting parsed and only the first text value (eg 100) is getting passed to the partner webservice instead of the entire XML as string.
    Can any one please help us in fixing in this problem.
    Thanks

    Hi,
    You should watch your assign activity (maybe a bad assigment level in copy rule). I think the probem is there.
    Cyryl

  • Converting XML Document to String

    Dear All,
    I am quite new to Java Web Services. I have made a Java Class which calls all the web services . I am displaying the results on a Command prompt. Below is my sample code:
    import javax.xml.rpc.Service;
    import javax.xml.rpc.Stub;
    import horusWS.Horus_x0020_Web_x0020_Services_Impl;
    import horusWS.Horus_x0020_Web_x0020_ServicesSoap;
    public class JavaClient {
    public static void main(String[] args)
    Horus_x0020_Web_x0020_Services_Impl service = new Horus_x0020_Web_x0020_Services_Impl();
    Horus_x0020_Web_x0020_ServicesSoap port = service.getHorus_x0020_Web_x0020_ServicesSoap();
    String str;
    str = port.getTextFeedbackLearner(1,"P001",1);
    //where getTextFeedbackLearner is the my Web Service.
    System.out.println(str);
    System.out.println returns the web service in string format. Now I want to compare this string to my actual getTextFeedbackLearner.xml file. But I think I need to convert getTextFeedbackLearner.xml to string first. Please let me know
    how can I convert an XML Document to String.
    Thanking you in Anticipation.
    cheers,
    Sunil Sabir

    You can read the XML document as you read any other file.
    Read it into a String variable.
    Check java.io.FileReader, java.io.BufferReader, etc.

  • XML into one string element

    Hello,
            In Graphical mapping, Could anyone pls tell me in detail about how to achieve One whole xml into one string element. This XML file i want to send to DATABASE.

    Thi blog might be of some help
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping

  • oms_error Message:[oms] empty or null xml map request string.

    I'm using mapviewer. I create a stored procedure in oracle that uses the utl_http package to make the map request. The omserver response with an error but when i make a map request via internet explorer the server response its ok and show me the correspondent map. This is my pl/sql code it fails in this line:
    UTL_HTTP.SET_HEADER(l_http_req, 'Content-Type', 'application/x-www-form-urlencoded');
         UTL_HTTP.SET_HEADER(l_http_req, 'Content-Lenght', LENGTH(map_request));
         UTL_HTTP.SET_HEADER(l_http_req, 'Host', 'cobogis09');
         UTL_HTTP.SET_HEADER(l_http_req, 'Port', '8888');
    As you can see it tells to me that the map request string is empty but im sending the map request in the next way:
         UTL_HTTP.WRITE_TEXT(l_http_req, '<?xml version="1.0" encoding="UTF-8"?><map_request datasource="stream" srid="8307" basemap="" width="960" height="768" antialiasing="false" format="GIF_URL" title="Demonstration"></map_request>');
         l_http_resp := utl_http.get_response(l_http_req);
         utl_http.read_text(l_http_resp, l_value);
         response := sys.XMLTYPE.createxml(l_value);
         utl_http.end_response(l_http_resp);
         img_url := response.EXTRACT('/map_response/map_image/map_content/@url').getstringval();
    img_url := response.EXTRACT('/map_response/map_image/map_content/@url').getstringval();
    obviously because the server response its not ok
    the server response is (i get this message in my l_value variable):
    <?xml version="1.0" encoding="UTF-8"?><oms_error>Message:[oms] empty or null xml map request string.
    Tue Jul 25 10:37:43 GMT-05:00 2006
    Severity: 0
    Description:
         at oracle.lbs.mapserver.oms.getXMLDocument(oms.java:860)
         at oracle.lbs.mapserver.oms.doPost(oms.java:303)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:595)
    </oms_error>
    What i want to know its why the server says that the map request string is empty. As you can see the map request is not empty, but when i send to the server something happens that sends this map request string empty to the server.
    The next is the console of the omserver:
    C:\oc4j_extended>cd\
    C:\>cd C:\oc4j_extended\j2ee\home
    C:\oc4j_extended\j2ee\home>java -hotspot -Xmx512M -jar oc4j.jar
    06/07/25 11:00:49 INFO [oracle.lbs.mapserver.oms] oms root path: C:\oc4j_extended\j2ee\home\lbs\mapviewer\web\
    06/07/25 11:00:49 Oracle Application Server Containers for J2EE 10g (10.1.2.0.2) initialized
    06/07/25 11:00:49 INFO [oracle.lbs.mapserver.core.MapperConfig] using default config file: C:\oc4j_extended\j2ee\home\lbs\mapviewer\web\WEB-INF\conf\mapViewerConfig.xml
    06/07/25 11:00:49 WARN [oracle.lbs.mapserver.core.MapperPool] destroying ALL mapmaker instances.
    06/07/25 11:00:50 INFO [oracle.lbs.mapserver.core.MapperConfig] setting logging level to finest
    06/07/25 11:00:50 Tue Jul 25 11:00:50 GMT-05:00 2006 INFO [oracle.sdovis.CacheMgr2] In memory cache limit set to: 512MB
    06/07/25 11:00:50 Tue Jul 25 11:00:50 GMT-05:00 2006 INFO [oracle.lbs.mapserver.core.MapperConfig] Disk-based cache is no longer supported.
    06/07/25 11:00:50 Tue Jul 25 11:00:50 GMT-05:00 2006 INFO [oracle.lbs.mapserver.core.MapperConfig] setting proxy to: coboisa01.ag.ad.local:8080
    06/07/25 11:00:50 Tue Jul 25 11:00:50 GMT-05:00 2006 FINEST [oracle.lbs.mapserver.core.MapperConfig]
    Allowed IPs:
    Excluded IPs:
    06/07/25 11:00:50 Tue Jul 25 11:00:50 GMT-05:00 2006 ERROR [oracle.lbs.mapserver.core.MapperConfig] ###### [MapperConfig] clear-text passwords in the mapViewrConfig.xml file must be prefixed with a '!' (exclamation mark).
    06/07/25 11:00:50 Tue Jul 25 11:00:50 GMT-05:00 2006 INFO [oracle.lbs.mapserver.core.MapperConfig] Map Recycling thread started.
    06/07/25 11:00:50 Tue Jul 25 11:00:50 GMT-05:00 2006 INFO [oracle.lbs.mapserver.oms] *** Oracle MapViewer started. ***
    06/07/25 11:01:03 Tue Jul 25 11:01:03 GMT-05:00 2006 FINEST [oracle.lbs.mapserver.oms] request.getRemoteUser = jazn.com/admin
    06/07/25 11:01:03 Tue Jul 25 11:01:03 GMT-05:00 2006 FINEST [oracle.lbs.mapserver.oms] request= <?xml version="1.0" standalone="yes"?>
    <non_map_request>
    <add_data_source name="stream"
    jdbc_host="cobodata01"
    jdbc_sid="stream"
    jdbc_port="1521"
    jdbc_user="***"
    jdbc_password="***"
    jdbc_mode="thin"
    number_of_mappers="3"/>
    </non_map_request>
    06/07/25 11:01:03 Tue Jul 25 11:01:03 GMT-05:00 2006 FINEST [oracle.lbs.mapserver.oms] getRequestType: nodeName=add_data_source
    06/07/25 11:01:03 Tue Jul 25 11:01:03 GMT-05:00 2006 INFO [oracle.lbs.mapserver.MapServerImpl] adding a map data src [name=stream]
    06/07/25 11:01:05 Tue Jul 25 11:01:05 GMT-05:00 2006 FINEST [oracle.sdovis.SRS] loaded 748 geodetic srids.
    06/07/25 11:01:05 Tue Jul 25 11:01:05 GMT-05:00 2006 INFO [oracle.sdovis.CacheMgr2] Spatial Data Cache opened. Region=SDOVIS_DATA.
    06/07/25 11:01:05 Tue Jul 25 11:01:05 GMT-05:00 2006 INFO [oracle.sdovis.CacheMgr2] max_cache_size=512 MB.
    06/07/25 11:01:05 Tue Jul 25 11:01:05 GMT-05:00 2006 INFO [oracle.sdovis.CacheMgr2] sub region sdovis_subreg_gis_jdbc:oracle:thin:@cobodata01:1521:stream created in cache.
    06/07/25 11:01:05 Tue Jul 25 11:01:05 GMT-05:00 2006 INFO [oracle.lbs.mapserver.core.MapperPool] added a mapper instance to the pool [data src=stream]
    06/07/25 11:01:05 Tue Jul 25 11:01:05 GMT-05:00 2006 INFO [oracle.lbs.mapserver.core.MapperPool] added a mapper instance to the pool [data src=stream]
    06/07/25 11:01:06 Tue Jul 25 11:01:06 GMT-05:00 2006 INFO [oracle.lbs.mapserver.core.MapperPool] added a mapper instance to the pool [data src=stream]
    06/07/25 11:01:36 Tue Jul 25 11:01:36 GMT-05:00 2006 FINEST [oracle.lbs.mapserver.oms] request.getRemoteUser = null
    06/07/25 11:01:36 Tue Jul 25 11:01:36 GMT-05:00 2006 FINEST [oracle.lbs.mapserver.oms] request= null
    As you can see the arrive empty to the server, what can be wrong

    Hi,
    in this map request, it looks that the basemap string is empty.
    UTL_HTTP.WRITE_TEXT(l_http_req, '<?xml version="1.0" encoding="UTF-8"?><map_request datasource="stream" srid="8307" basemap="" width="960" height="768" antialiasing="false" format="GIF_URL" title="Demonstration"></map_request>');

  • 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

  • Passing whole xml to a string

    Dear Experts,
          i want to pass the whole input xml as a string to the UDF which does a soap look up . how do we do it ?
    It is file to soap lookup to jdbc. 
         Qos would normally be that of the sender. In the case of soap lookup , where do we specify the QOS?
        Does the soap reciever adapter make use of wsdl while creating the soap request , and if yes , how ?
    Thanks,
    Aju

    Hi Aju,
    Passing the whole input as a string can be easily achieved through java mapping. Use the following code in the execute method of your java class:
         StringBuffer strbuffer = new StringBuffer();
         byte[] b = new byte[[4096]];
         for (int n; (n = in.read(b)) != -1;)
         strbuffer.append(new String(b, 0, n));
         data = strbuffer.toString();
    For more on SOAP lookUp use this blog:
    Webservice Calls From a User Defined Function.
    Thanks and Regards,
    Sanjeev.

  • XML file into String

    Hello,
        I want to convert total xml file into string in UDF, i am getting an error. can anybody tell me the solution. what is the wrong in bellow code.
    String str =a+b;
    String strLine;
    StringBuffer sbr=new StringBuffer();
    try{
         FileInputStream fileInputStream = new FileInputStream(str);
             DataInputStream dataInputStream = new DataInputStream(fileInputStream);
             BufferedReader bufferedReader = new BufferedReader(new   InputStreamReader(dataInputStream));
             while ((strLine = bufferedReader.readLine()) != null)   {
             sbr.append(strLine);
         catch (Exception e){      e.printStackTrace();       }
    return sbr.toString();}

    check this link
    How to store big XML string  in ABAB DB
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • Convertion of XML node to string using Xquery transformation in OSB

    How to convert XML node to string using a built in function using Xquery transformation in OSB? In BPEL we have the Xpath extension function ora:getContentAsString() to do the same.

    fn:bea-serialize() function converts xml node to string. but it assigns namespace prefix in every xml node during the conversion. So is there any function to remove the namespace prefix from XML node using Xquery built in function?

  • Numeric Value to String representation

    Hi!
    I was wondering if there was an easy way to getting the String representation of a number (specifically an integer). I am trying to format a message that would be like this:
    Three (3) records have been updated.
    Getting the (3) is easy, but my problem is getting the word Three. There are numerous records, which means an Array would be close to impossible coz it will take time to produce an output.
    Is there an easy way? (1 = One, 2 = Two,..., 20 = Twenty)
    Thanks!

    I'd guess that a switch statement will be about as fast as anything else, since it's a static structure and the compiler should be able to optimize it effectively.
    int number = setMeToAValue;
    switch (number) {
        case 0:  System.out.println("zero"); break;
        case 1:  System.out.println("one"); break;
        case 2:  System.out.println("two"); break;
        case 3:  System.out.println("three"); break;
        case 4:  System.out.println("four"); break;
        case 5:  System.out.println("five"); break;
        case 6:  System.out.println("six"); break;
        case 7:  System.out.println("seven"); break;
        case 8:  System.out.println("eight"); break;
        case 9:  System.out.println("nine"); break;
        case 10: System.out.println("ten"); break;
        case 11: System.out.println("eleven"); break;
        case 12: System.out.println("twelve"); break;
        case 19  System.out.println("nineteen"); break;
        case 20  System.out.println("twenty"); break;
        case 30  System.out.println("thirty"); break;
        case 40  System.out.println("forty"); break;
    To get 21 go after the parts and concantenate them. case 20 + case 1 produces 21, etc

  • Program accept xml as a string

    Hi frnd
    i need a java application that accept xml as a string and convert xml to xml dom object.
    Thnx
    Adhir

    Hi vladimir
    I have written a xml code inside the "D:/java/client.xml" and want to accept it as a string and then wanted to convert the xml string into xml dom object. plz have a look onto the below code and give me the right way for doing the scenario.
    package myPackage;
    import java.io.StringReader;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.xml.sax.InputSource;
    import java.io.File;
    public class MyxmlStringParser
            public static void main(String a[])
          String aString = "D:/java/client.xml";
        public static Document parse(String aString) throws Exception
            InputSource source = new InputSource(new StringReader(aString));
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            return db.parse(source);
    Thnx
    Adhir

Maybe you are looking for