Mapping an XML from an input element to Target

Hi ,
I have an XML coming in source Element as below :
<?xml version="1.0" encoding="UTF-8"?>
<ResponsePayload>
   <RespString><?xml version="1.0" encoding="UTF-8"?>
<Devices>
   <Device>1</Device>
   <Name>1</Name>
</Devices></RespString>
</ResponsePayload>
and I need to map it to the target where the target structure is as below .
<?xml version="1.0" encoding="UTF-8"?>
<Devices>
   <Device/>
   <Name/>
</Devices>
The entire target xml is coming in a source field  and that needs to be mapped.
How to perform this?Can any one suggest the methods to do this ?
Thanks
Rajesh

Add the libraries and Tweak as needed.. here's the gist.
public class GetResponse extends AbstractTransformation  {
public void transform(TransformationInput arg0, TransformationOutput arg1)
               throws StreamTransformationException {
String inputPayload = convertInputStreamToString(arg0.getInputPayload()
                    .getInputStream());
          String inputPayload = convertInputStreamToString(arg0.getInputPayload()
                    .getInputStream());
String outputPayload = "";
inputPayload = inputPayload.replaceAll("<ResponsePayload>", "");
inputPayload = inputPayload.replaceAll("</ResponsePayload>", "");
inputPayload = inputPayload.replaceAll("<RespString>", "");
inputPayload = inputPayload.replaceAll("</RespString>", "");
inputPayload = start + inputPayload + end;
                 outputPayload = inputPayload;
try {
               arg1.getOutputPayload().getOutputStream().write(
                         outputPayload.getBytes("UTF-8"));
          } catch (Exception exception1) {
public String convertInputStreamToString(InputStream in) {
          StringBuffer sb = new StringBuffer();
          try {
               InputStreamReader isr = new InputStreamReader(in);
               Reader reader = new BufferedReader(isr);
               int ch;
               while ((ch = in.read()) > -1) {
                    sb.append((char) ch);
               reader.close();
          } catch (Exception exception) {
          return sb.toString();
Mind you the code would change if there's and empty node.
Similarly you would also need to remove an extra version and encoding tag which you get from source.
Edited by: AMITH GOPALAKRISHNAN on Mar 22, 2011 4:57 PM

Similar Messages

  • Parsing XML from Socket input stream

    I create a sax parser to which I send the InputStream from the socket
    But my HandlerBase never gets the events. I get startDocument
    but that is it, I never get any other event.
    The code I have works just like expected when I make the InputStream
    come from a file. The only differeence I see is that when I file is used the
    InputStream is fully consumed while with the socket the InputStream
    is kept open (I MUST KEEP THE SOCKET OPEN ALL THE TIME). If the parser
    does not generate the events unless the InputStream is fully consumed,
    isn't that against the whole idea of SAX (sax event driven) .
    Has anyone been succesfull parsing XML from the InputStream of a socket?
    if yes how?
    I am using JAXP 1.0.1 but I can upgrade to JAXP 1.1.0
    which uses SAX 2.0
    Does anybody know if my needs can be met by JAXP 1.1.0?
    Thanks

    I did the same with client/server model.
    I have client program with SAX parser. Please try if you can make the server side. I was be able to write the program with help from this forum. Please search to see if you can get the forum from which I got help for this program.
    // JAXP packages
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    // JAVA packages
    import java.util.*;
    import java.io.*;
    import java.net.*;
    public class XMLSocketClient {
    final private static int buffSize = 1024*10;
    final private static int PORTNUM = 8888;
         final private static int threadSleepValue = 1000;
    private static void usage() {
    System.err.println("Usage: XMLSocketClient [-v] serverAddr");
    System.err.println(" -v = validation");
    System.exit(1);
    public static void main(String[] args) {
    String address = null;
    boolean validation = false;
    Socket socket = null;
    InputStreamReader isr_socket = null;
    BufferedReader br_socket = null;
    CharArrayReader car = null;
    BufferedReader br_car = null;
    char[] charBuff = new char[buffSize];
    int in_buff = 0;
    * Parse arguments of command options
    for (int i = 0; i < args.length; i++) {
    if (args.equals("-v")) {
    validation = true;
    } else {
    address = args[i];
    // Must be last arg
    if (i != args.length - 1) {
    usage();
    // Initialize the socket and streams
    try {
    socket = new Socket(address, PORTNUM);
    isr_socket = new InputStreamReader(socket.getInputStream());
    br_socket = new BufferedReader(isr_socket, buffSize);
    catch (IOException e) {
    System.err.println("Exception: couldn't create stream socket "
    + e.getMessage());
    System.exit(1);
    * Check whether the buffer has input.
    try {
    while (br_socket.ready() != true) {
                   try {
                        Thread.currentThread().sleep(threadSleepValue);     
                   catch (InterruptedException ie) {
              System.err.println("Interrupted error for sleep: "+ ie.getMessage());
                   System.exit(1);
    catch (IOException e) {
    System.err.println("I/O error for in.read(): "+ e.getMessage());
    System.exit(1);
    try {
    in_buff = br_socket.read(charBuff, 0, buffSize);
    System.out.println("in_buff = " + in_buff);
    System.out.println("charBuff length: " + charBuff.length);
    if (in_buff != -1) {
    System.out.println("End of file");
    } catch (IOException e) {
    System.out.println("Exception: " + e.getMessage());
    System.exit(1);
    System.out.println("reading XML file:");
    StringBuffer display = new StringBuffer();
    display.append(charBuff, 0, in_buff);
    System.out.println(display.toString());
    * Create BufferedReader from the charBuff
    * in order to put into XML parser.
    car = new CharArrayReader(charBuff, 0, in_buff); // these two lines have to be here.
    br_car = new BufferedReader(car);
    * Create a JAXP SAXParserFactory and configure it
    * This section is standard handling of XML document by SAX XML parser.
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setValidating(validation);
    XMLReader xmlReader = null;
    try {
    // Create a JAXP SAXParser
    SAXParser saxParser = spf.newSAXParser();
    // Get the encapsulated SAX XMLReader
    xmlReader = saxParser.getXMLReader();
    } catch (Exception ex) {
    System.err.println(ex);
    System.exit(1);
    // Set the ContentHandler of the XMLReader
    xmlReader.setContentHandler(new MyXMLHandler());
    // Set an ErrorHandler before parsing
    xmlReader.setErrorHandler(new MyErrorHandler(System.err));
    try {
    * Tell the XMLReader to parse the XML document
    xmlReader.parse(new InputSource(br_car));
    } catch (SAXException se) {
    System.err.println(se.getMessage());
    System.exit(1);
    } catch (IOException ioe) {
    System.err.println(ioe);
    System.exit(1);
    * Clearance of i/o functions after parsing.
    try {
    br_socket.close();
    } catch (IOException e) {
    System.out.println("Exception: " + e.getMessage());
    try {
    socket.close();
    } catch (IOException e) {
    System.out.println("Exception: " + e.getMessage());
    try {
    br_car.close();
    } catch (IOException e) {
    System.out.println("Exception: " + e.getMessage());
    * The XML handler used by this program
    class MyXMLHandler extends DefaultHandler {
    // A Hashtable with tag names as keys and Integers as values
    private Hashtable tags;
    // Parser calls this once at the beginning of a document
    public void startDocument() throws SAXException {
    System.out.println("startDocument()");
    tags = new Hashtable();
    // Parser calls this for each element in a document
    public void startElement(String namespaceURI, String localName,
    String rawName, Attributes atts)
    throws SAXException
    String key = localName;
    Object value = tags.get(key);
    System.out.println("startElement()");
    System.out.println("namespaceURI: " + namespaceURI);
    System.out.println("localName: " + localName);
    System.out.println("rawName: " + rawName);
    if (value == null) {
    // Add a new entry
    tags.put(key, new Integer(1));
    } else {
    // Get the current count and increment it
    int count = ((Integer)value).intValue();
    count++;
    tags.put(key, new Integer(count));
    // Parser calls this once after parsing a document
    public void endDocument() throws SAXException {
    Enumeration e = tags.keys();
    System.out.println("endDocument()");
    while (e.hasMoreElements()) {
    String tag = (String)e.nextElement();
    int count = ((Integer)tags.get(tag)).intValue();
    System.out.println("Tag <" + tag + "> occurs " + count
    + " times");
    * Error handler of XML parser to report errors and warnings
    * This is standard handling.
    class MyErrorHandler implements ErrorHandler {
    /** Error handler output goes here */
    private PrintStream out;
    MyErrorHandler(PrintStream out) {
    this.out = out;
    * Returns a string describing parse exception details
    private String getParseExceptionInfo(SAXParseException spe) {
    String systemId = spe.getSystemId();
    if (systemId == null) {
    systemId = "null";
    String info = "URI=" + systemId +
    " Line=" + spe.getLineNumber() +
    ": " + spe.getMessage();
    return info;
    * The following methods are standard SAX ErrorHandler methods.
    * See SAX documentation for more info.
    public void warning(SAXParseException spe) throws SAXException {
    out.println("Warning: " + getParseExceptionInfo(spe));
    public void error(SAXParseException spe) throws SAXException {
    String message = "Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);
    public void fatalError(SAXParseException spe) throws SAXException {
    String message = "Fatal Error: " + getParseExceptionInfo(spe);
    throw new SAXException(message);

  • JDev 11.1.1.2 - How to map fixed xml tags in "any" element of the target?

    I have a target schema that has "any" element as below:
    <xs:element name="USERAREA">
    <xs:complexType mixed="true">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
    <xs:any/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    I want to map as below in JDev xslt. The 2 new elements are fixed and do not change. I tried to use copy-of but did not know how to do this? Any sample would help.
    <USERAREA>
    <ORACLE.BOOKEDFLAG>Y</ORACLE.BOOKEDFLAG>
    <ORACLE.ORDERTYPE>Standard Order</ORACLE.ORDERTYPE>
    </USERAREA>
    Any help is appreciated.
    Thanks
    Shanthi

    I would think if you intanciate the XMLReference and use IIDXMLElement GetChildCount / GetNthChild would do what you are looking for.
    Ian

  • How to associate an xml from httpservice to datagrid if the xml element name contains periods in it

    Following is the xml from an http service, how to associate
    this xml to a data grid (employee name, number) since it contains
    periods(dots) in xml element name.
    An early help is appreciated.....
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <com.companyx>
    <person>
    <employee.data>
    <employee.name>mrx</employee.name>
    <employee.number>1001</employee.number>
    </employee.data>
    <employee.data>
    <employee.name>mry</employee.name>
    <employee.number>1002</employee.number>
    </employee.data>
    <employee.data>
    <employee.name>mrz</employee.name>
    <employee.number>1003</employee.number>
    </employee.data>
    <page>0</page>
    </person>
    </com.companyx>
    Thanks,
    Vijay Karthik

    HI
    GOOD
    IT IS POSSIBLE IN ABAP
    Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important role in the exchange of a wide variety of data on the Web and elsewhere.
    XSD->
    XML Schemas express shared vocabularies and allow machines to carry out rules made by people. They provide a means for defining the structure, content and semantics of XML documents. in more detail.
    XDS->
    XDS can process data images from CCD-, imaging-plate, and multiwire-detectors in a variety of formats. Detector specific Input file templates greatly simplify the use of XDS; they are provided as part of the documentation.
    XDS runs under Unix or Linux on a single server or a grid of up to 99 machines of the same type managed by the MOSIX system; in addition, by using OpenMP, it can be executed in parallel on up to 32 processors at each node that share the same address space.
    http://www2.stylusstudio.com/SSDN/default.asp?action=9&fid=23&read=2926
    /people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
    THANKS
    MRUTYUN

  • Java Mapping with an xml array as input

    Hi Gurus,
    I have to perform a java mapping to map some input xml contained in an array with a target message type. I have found a good java mapping example here:
    Re: Please provide Java Mapping example
    but my mapping input is not a single XML, but an XML array, thus I have a doubt...
    How can I map multiple XML contained in an array with a target XML? I have to solve this problem into a Java mapping prospective.
    Thanks to all!
    Message was edited by:
            Gabriele Morgante

    Hey Stefan, I think he is refering to a n:1 multimapping.
    If that is indeed the case, Gabriele, you will have to consider the initial tags inserted by mapping runtime to treat multimappings.
    Suppose your XML message is like
    <myMT xmlns="urn:mynamespace">
      <value>xpto</value>
    </myMT>
    Then, if your source message interface occurrence is defined as unbounded in your interface mapping, your mapping program (message mapping, xslt, java mapping, whatever) will receive, from mapping runtime, a message like this:
    <Messages xmlns="http://sap.com/xi/XI/SplitAndMerge">
      <Message1>
        <myMT xmlns="urn:mynamespace">
          <value>xpto1</value>
        </myMT>
        <myMT xmlns="urn:mynamespace">
          <value>xpto2</value>
        </myMT>
        <myMT xmlns="urn:mynamespace">
          <value>xpto3</value>
        </myMT>
      </Message1>
    </Messages>
    Also, if you have more than 1 message type as source of your interface mapping, your mapping program will receive the other message types in <Message2>, <Message3>... tags.
    The <Messages> and <MessageX> tags will always be automatically generated by mapping runtime when dealing with multimappings, which are mappings from m XML messages to n XML messages, with either m, n or both different of 1 (note that this definition includes mappings from 1 type to 1 type, when either source, target or both message types have max occurrence = ubounded).
    Finally, remember that the output that your mapping program generates will also have to include these <Messages> and <MessageX> tags (with proper namespace), since mapping runtime will be expecting them. Message mappings treat those by default, but your xslt and java multimappings will have to explicitely include these tags in the output.
    Regards,
    Henrique.

  • Creating XML from XSD, Only create The First Element

    Hi,
    I create a XML File from a xsd schema by this way:
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              factory.setNamespaceAware(true);
              factory.setValidating(true);
                   factory.setAttribute(JAXP_SCHEMA_LANGUAGE,W3C_XML_SCHEMA);
                   factory.setAttribute(JAXP_SCHEMA_SOURCE, new File(MY_SCHEMA));   
                    DocumentBuilder documentBuilder =factory.newDocumentBuilder();
              documentBuilder.setErrorHandler(new SimpleDOMHandler());
              Document parse = documentBuilder.parse(new File(MY_XML));The first lines of the schema:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
         targetNamespace="http://gencat.net/scsp/esquemes/peticion"
         elementFormDefault="qualified" attributeFormDefault="unqualified"
         id="Peticio" xmlns:p="http://gencat.net/scsp/esquemes/peticion">
         <xs:element name="Apellido1">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:maxLength value="40" />
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Apellido2">
            .............................The problem is that the created document only have the first element "Apellido1". I dont know if it is a wrong xsd, or i'm using a bad way to do it.
    Thanks a lot, and apologize for my english

    Hi,
    Is it possible to create and populate XML from an XSD
    without knowing what the XSD elements are beforehand
    (all the examples appear to know what the input XSD
    will be, and therefore know what the set and get
    methods should be called)? I think it is possible--you would have to recompile each time (unless you can dynamically recompile, which would be neat), but using the classes getMethod() function, you can list all the methods. You would then have to do some tricky logic to determine which of the getMethods you want (for example NOT getClass()), and you can basically call them in sequence. You also need to worry about handling lists & recursively call xxxType classes.
    I'm experimenting with this, and it can get a little frustrating because there are a lot of odd cases to handle (for example, while setting the elements of a list, you need to actually get the list & add elements to it), but I think it's possible.
    >
    Can a user browse for an xsd to input, and the java
    will dynamically create the get methods, and be able
    to create instances and populate variables before
    converting to XML?
    What I'm puzzled about is where you'd get the data to populate the variables? Perhaps a database, or a bean? If you just want to make a test xml file, then it doesn't matter, but with real data, I think you'd still have to change how you actually get the variables you want to populate the xml file with, right? In other words, if your schema changed, the parameters you're passing to the set methods would change as well.
    Maybe we'll see some more packages in the future to make this task easier.

  • Is it possible to create a Webservice in BI which takes XML as an input and gives PDF as output with an additional requirement that Siebel expecting the XSD from BI to send data in the BI requested format

    Is it possible to create a Webservice in BI which takes XML as an input and gives PDF as output with an additional requirement that Siebel expecting the XSD from BI to send data in the BI requested format. Siebel wants to send the data as xml to BI but not sure of the BI capabilities on giving WSDL embedded with XSD (input is a hierarchical)

    Hi All,
    I am able to fulfil above requirement. Now I am stuck at below point. Need your help!
    Is there any way to UPDATE the XML file attached to a Data Definition (XML Publisher > Data Definition) using a standard package or procedure call or may be an API from backend? I am creating an XML dynamically and I want to attach it to its Data Definition programmatically using SQL.
    Please let me know if there is any oracle functionality to do this.
    If not, please let me know the standard directories on application/database server where the XML files attached to Data Definitions are stored.
    For eg, /$APPL_TOP/ar/1.0/sql or something.
    Regards,
    Swapnil K.

  • Message Mapping: Map value from the first element in a context in target el

    Hi experts,
    I have a problem with a message mapping in XI. I hope you can help me. At first I will give you a source and a target structure. Then I will explain the problem.
    <u>Source structure:</u>
    <E1EDP01>
       <E1EDPT1>
          <TDID> ... </TDID>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
       </E1EDPT1>
    </E1EDP01>
    The structure can contain more than one E1EDP01-Elements, more than one E1EDPT1-Elements and more than one E1EDPT2-Elements.
    <u>target structure:</u>
    <LineItem>
       <vendmemo> ... </vendmemo>
    </LineItem>
    For every E1EDP01-Element my mapping creates one LineItem-Element in the target structure. To fill the element <vendmemo> the mapping should do the following steps:
    The mapping should search in E1EDP01 for a E1EDPT1 with the TDID = Z505. And from this E1EDPT1-Element (with the TDID=Z505) the mapping should take the value <TDLINE> from the first E1EDPT2-Element in the context of the E1EDPT1-Element (the E1EDPT1 with the TDID=Z505) and put this value in <vendmemo>.
    The mapping should do this action for every E1EDP01 -> so for every LineItem.
    I tried it with UDF but I didn't found a solution. Can anybody help me?
    best regards
    Christopher

    Hello experts,
    i was wrong ... my mapping isn't still working. I had created a test instance. and only for this test instance the mapping (see above) works.
    Can anybody help me? I'm trying the whole day but I can't find a solution. Here a second description of my problem:
    <u>Source Structure:</u>
    <E1EDP01>
       <E1EDPT1>
          <TDID> ... </TDID>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
       </E1EDPT1>
    </E1EDP01>
    <E1EDP01>
       <E1EDPT1>
          <TDID> ... </TDID>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
          <E1EDPT2>
             <TDLINE> ... </TDLINE>
          </E1EDPT2>
       </E1EDPT1>
    </E1EDP01>
    <u>Target Structure:</u>
    <LineItem>
       <vendmemo> ... </vendmemo>
    </LineItem>
    <LineItem>
       <vendmemo> ... </vendmemo>
    </LineItem>
    <u>Description of my Problem:</u>
    For each E1EDP01 in the source structure the mapping creates one LineItem in the target structure.
    The element "vendmemo" should be created in any case ... also if it will be empty.
    To fill the element "vendmemo" the mapping should search in E1EDP01 for a E1EDPT1 with the TDID=Z505. If there is an element E1EDPT1 with the TDID=Z505, the mapping should write the TDLINE from the first E1EDPT2 (under the element E1EDPT1 with the TDID=Z505) in the target field "vendmemo".
    The Problem is that TDLINE an TDID are not in the same context. I tried it with setting the context of both to E1EDP01. But it was not working ... have you any idea oder suggestion?
    Thank you very much
    best regards
    Christopher

  • AWM dimension mapping - is it possible to load data from two input tables ?

    Hello All
    I have two tables ProductFamily (parent level) and Products (child level).
    I want to load a dimension from these two tables where the parent-child relationships are maintained (I am using AWM).
    I created a mapping with these two tables as input, but the data loaded does not maintain the relationships.
    So how do I do that? Is it possible to load dimensions where different levels get data from multiple tables?
    Is there any type of joiner available in AWM?
    thanks
    Few Notes:
    - I do not want to use OWB here as my data is clean
    - In AWM, When I loaded the data from a single view which contained data from both input tables, it worked fine. But this is my worst case option.

    You should use the Snowflake Dimension option in the Dimension mapping screen for the Product Dimension (as opposed to the default dimension mapping style - star schema).
    This will modify the mapping inputs to include a separate parent level key for each hierarchy/level i.e. for each hierarchy/level (unless topmost level of hierarchy), you need to specify the parent level key in addition to the current level key, code/name/description/other attributes etc.
    You can do the mapping in either .... use icons at the top of the mapping screen.
    the drag/drop mode by dragging the relational column onto dimension model - hierarchy/level/attribute
    -or-
    the table expression mapping mode which gives the same effect.. dragging a column onto an attribute sets the expression in <schema>.<table>.<column> format.
    HTH
    Shankar
    Note1: Complete the mapping in one go.. Switching b/w the mapping modes cause the mappings to be reset.
    Note2: Assume your data is correct, foreign key to parent level table: ProductFamily exists in child level table: Products.

  • ABAP Mapping  is it Possiable to validate my XML from the payload.

    Is it possiable to validate my XML from the Payload with the given standard XSD, and one more is that can i verify the files in Archieve , this is due to , i must check whether my file already exist and if exist i should add prefix 1 to that file and store in my arichive , all this using only ABAP mapping
    Please help me
    thanking you
    Sridhar

    Workflow Business Events help creating Generate Function to generate an XML payload that in turn is made available to the Subscription's Rule Function. Also, at the time of Raising the Business Event, you could pass the XML payload (in the form of a CLOB) to the Raise API that will be passed along to the Business Event's Subscription Rule Function.
    Hope this helps.
    Vijay

  • Mapping XML to a text element

    Hello, everybody!
    I have a trouble with  mapping. There are source structure and target. But I have to send xml of the source structure to the string element of target structure. Is there any way to implement this?

    I have the source Message Type MT_GetNSI structure:
      <getNSI version="1.0">
      <tableName value="" />
      <fromTransID value="" />
      <filterField value="" />
      <filterValue value="" />
      <filterCond value="" />
      </getNSI>
    and the target External Message: GetBlockRequest (WSDL description was imported for this) structure:
      <GetBlockRequest>
      <Login/>
      <Password/>
      <Text/>
      </GetBlockRequest>
    I want source xml include into the tag <Text> of the target xml. And It must bu like that
      <GetBlockRequest>
      <Login/>
      <Password/>
      <Text>
      <getNSI version="1.0">
      <tableName value="" />
      <fromTransID value="" />
      <filterField value="" />
      <filterValue value="" />
      <filterCond value="" />
      </getNSI>
      </Text>
      </GetBlockRequest>

  • Error when mapping an XML coming as in Source Element

    Hi,
    We have a requirement where the XML is sent in an element as given below :
    The Incoming Payload is of the below format :
    Source :
    <?xml version="1.0" encoding="UTF-8"?>
    <ResponsePayload>
       <RespString><?xml version="1.0" encoding="UTF-8"?>
    <Devices>
       <Device>1</Device>
       <Name>1</Name>
    </Devices></RespString>
    </ResponsePayload>
    The target XML is below :
    Target:
    <?xml version="1.0" encoding="UTF-8"?>
    <Devices>
       <Device/>
       <Name/>
    </Devices>
    I used the below xslt mappings in two steps as suggested by Udo .
    Re: Xml String mapped to XML Node
    XSLT Mapping1 :
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output omit-xml-declaration="yes"/>
         <xsl:template match="/">
              <xsl:for-each select="//RespString">
                   <xsl:value-of select="." disable-output-escaping="yes"/>
              </xsl:for-each>
         </xsl:template>
    </xsl:stylesheet>
    XSLT Mapping 2 :
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:template match="/">
              <ResponsePayload>
                   <xsl:copy-of select="//Devices"/>
              </ResponsePayload>
         </xsl:template>
    </xsl:stylesheet>
    When executing Iam getting the belwo error :
    javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The processing instruction target matching "[xX][mM][lL]" is not allowed
    cansomeone help me the reason for the error and how I can correct it .
    Thanks
    Rajesh

    Hi Rajesh,
    i can give you different approach...if the sender side is an File adapter and if ur picking the XML or CSV then write a module in sender file adapter to change the XML file.
    Characters like "<" and "&" are illegal in XML elements.
    "<" will generate an error because the parser interprets it as the start of a new element.
    so u need to add "<![CDATA[" and ends with "]]>"......now the data will come into PI as <![CDATA[<?xml version="1.0" encoding="UTF-8"?>]].
    in the target side the data will be passed as <?xml version="1.0" encoding="UTF-8"?>.
    Regards,
    Phani

  • Remove spaces when generating xml from data mapped on object types

    My problem is kind of complex so I'll try to reduce it to a more manageable example:
    drop type msm force;
    drop type list_msm force;
    create type msm as object(
         nume char(20)
    create type list_msm as table of msm;
    select xmlserialize (document xmlelement("values",
         cast(multiset(
              select trim(p.den) from produse p) as list_msm
         ) as clob indent size=2
         ) as "xml"
         from dual;
    This is where it gets tricky.
    p.den is a field that contains spaces. I use trim(p.den) to remove them but because I cast this to list_msm, the values are then again mapped into msm objects, which have the "nume" field of char(20). So.. when generating the XML, the output still contains spaces.
    This is an excerpt of the result:
    <values>
    <LIST_MSM>
    <MSM>
    <NUME>Prod.1 </NUME>
    </MSM>
    <MSM>
    <NUME>Prod.2 </NUME>
    </MSM>
    <MSM>
    <NUME>Prod.3 </NUME>
    </MSM>
    <Later.. I see that the forum removes the extra spaces but I ensure you that after eg. "Prod.1" there are a lot of spaces, as the original field from the "produse" table is defined as char(20))
    So.. Is there a way to generate the XML without those extra spaces? Basically, I want to be able to trim them before I send them to the xml serializer, but the problem is that i have no control over the whole casting thing ( oracle magic happening that automatically creates all the xmlelements needed, etc.)
    Somehow, when the xml engine steps over the collection and accesses the fields, somehow, i need a trim there. Maybe some kind of accesor for the fields in the type can be declared so that the xml engine uses it instead of the field itself directly. The accesor would then return trim(field). Sorry for this mumbo jumbo gibberish but I want to be as clear as possible.
    Edited by: user9229988 on May 10, 2012 9:24 AM
    Edited by: user9229988 on May 10, 2012 9:25 AM
    Edited by: user9229988 on May 10, 2012 9:38 AM

    Hi.
    Check this:
    drop type msm force;
    drop type list_msm force;
    create type msm as object(
    nume VARchar2(20)     --VARCHAR2 NOT CHAR
    create type list_msm as table of msm;
    create table produse
    den char(20)
    INSERT INTO produse VALUES('Prod.1');
    INSERT INTO produse VALUES('Prod.2');
    INSERT INTO produse VALUES('Prod.3');
    COMMIT;
    select xmlserialize (document xmlelement("values",
    cast(multiset(
    select trim(p.den) from produse p) as list_msm
    ) as clob indent size=2
    ) as "xml"
    from dual;
    <values>
      <LIST_MSM>
        <MSM>
          <NUME>Prod.1</NUME>
        </MSM>
        <MSM>
          <NUME>Prod.2</NUME>
        </MSM>
        <MSM>
          <NUME>Prod.3</NUME>
        </MSM>
      </LIST_MSM>
    </values>Hope this helps.

  • FF differs from other browsers - keystroke is swallowed when creating input element

    Hi all
    I have found a workaround for this problem, so its importance is low, but I will be interested in any comments.
    I am creating a control in javascript which represents an editable grid - a bit like a spreadsheet. The cells consist of 'span' elements with text nodes. I can move around the grid with the keyboard or the mouse.
    The user can signal their intent to edit a cell in three ways - double-click, press F2, or just start typing. When any of these are detected, I hide the span element and replace it with a text input element.
    If they doubleclick or press F2, the initial content of the input element must be the same as the content of the text node. If they type a character, the initial content must be the character they typed.
    In all other browsers I have tested (IE8, Opera, Chrome and Safari) the keystroke entered is still 'active', so it automatically becomes the first character in the input element. In FF, it does not.
    My workaround is to store the keystroke entered in a variable, then create the input element, then update the 'value' attribute of the element with the string value of the keystroke, then call setSelectionRange(1, 1) so that the insertion point is positioned after the character.
    I can live with this, but it would be nice if I could get FF to behave the same as the others, and render the workaround unnecessary.

    A good place to ask advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.<br />
    The helpers at that forum are more knowledgeable about web development issues.<br />
    You need to register at the mozillaZine forum site in order to post at that forum.<br />
    <br />
    See http://forums.mozillazine.org/viewforum.php?f=25

  • Reading A xml file and sending that XML Data as input  to a Service

    Hi All,
    I have a requirement to read(I am using File adapter to read) a xml file and map the data in that xml to a service(schema) input variable.
    Example of  xml file that I have to read and the content of that xml file like below:
      <StudentList>
        <student>
           <Name> ravi</Name>
           <branch>EEE</branch>
          <fathername> raghu</fathername>
        </student>
      <student>
           <Name> raju</Name>
           <branch>ECE</branch>
          <fathername> ravi</fathername>
        </student>
    <StudentList>
    I have to pass the data(ravi,EEE,raghu etc) to a service input varible. That invoked Service input variable(schema) contains the schema similar to above schema.
    My flow is like below:
      ReadFile file adapter -------------------> BPEL process -----> Target Service.I am using transform activity in BPEL process to map the data from xml file to Service.
    I am using above xml file as sample in Native Data format(to create XSD schema file).
    After I built the process,I checked file adapter polls the data and receive the file(I am getting View xml document in EM console flow).
    But transform activity does not have anything and it is not mapping the data.I am getting blank data in the transform activity with only element names like below
    ---------------------------------------------------------------------------EM console Audit trail (I am giving this because u can clearly understand what is happening-----------------------------------------------------
       -ReceiveFile
            -some datedetails      received file
              View XML document  (This xml contains data and structure like above  xml )
        - transformData:
            <payload>
              <InvokeService_inputvariable>
                  <part name="body">
                     <StudentList>
                         <student>
                           <name/>
                            <branch/>
                            <fathername/>
                         </student>
                   </StudentList>
              </part>
             </InvokeService_inputvariable>
    'Why I am getting like this".Is there any problem with native data format configuration.?
    Please help me out regarding this issue as I am running out my time.

    Hi syam,
    Thank you very much for your replies so far so that I have some progrees in my task.
    As you told I could have put default directory in composite.xml,but what happenes is the everyday new final subdirectory gets created  in the 'soafolder' folder.What I mean is in  the c:/soafolder/1234_xmlfiles folder, the '1234_xmlfiles' is not manually created one.It is created automatically by executing some jar.
    Basically we can't know the sub folder name until it is created by jar with its own logic. whereas main folder is same(soafolder) ever.
    I will give you example with our folder name so that it would be more convenient for us to understand.
    1) yesterday's  the folder structure :  'c:/soafolder/130731_LS' .The  '130731_LS' folder is created automatically by executing some jar file(it has its own logic to control and create the subdirectories which is not in our control).
    2) Today's folder structure :  'c:/soafolder/130804_LS. The folder is created automatically(everytime the number part(130731,130804).I think that number is indicating 2013 july 31 st like that.I have to enquire about this)is changing) at a particular time and xml files will be loaded in the folder.
    Our challenge : It is not that we can put the default or further path in composite.xml and poll the file adapter.Not everytime we have to change the path in composite.xml.The process should know the folder path (I don't know whether it is possible or not.) and  everyday and file adapter poll the files in that created subfolders.
    I hope you can understand my requirement .Please help me out in this regard.

Maybe you are looking for

  • How to draw dynamic table in SAP Script !

    Hi,     <i>I like to draw a table in the main window, the table height should depends on number of rows displayed on it. Could any one please help on this. Thank you, Senthil</i>

  • Does anyone know how to slow the audio for published project

    I have been using Bridget in Captivate 7 with a VTML speed of 95 which in development sounds normal and the appropriate speed but when I published the project, its like she goes through the narration quick. I see it happens only when the sentences ar

  • Storing data in AbstractTableModel

    hi, i have a program that uses AbstractTableModel with Jtable....I need to store data in a file when the program closes... i heard that there is a way to some how convert data in Tablemodel to a binary file and retrieve data from the binary file...ot

  • [FLASH MX 2004] Validar una fecha en AS

    Buenos días, Como puedo validar si una fecha que me han metido en un formulario hecho en AS es correcta? Muchas gracias por la ayuda. Saludos

  • Events deleted from google calendar not deleting on ical

    Hi everyone, we're having an issue with google calendar. I have it synced to two macs in the office, one is fine, the other (my bosses who has recently upgradred) is getting new events in ical but when I delete things on google calendar, they don't d