Xml to DNAList Conversion

Hi everyone,
what is the best way to convert a xml document to a DNAList...DNAList is a data structure from Blue Martini product suite, which is basically a HashMap like data structure with name, type and value pair...I will post an example below...
Here is the xml I generated from resultset object.
<?xml version="1.0" encoding="UTF-8"?>
<dna xmlns="http://bluemartini.com/eng/arch/dna/name/" xmlns:dna="http://bluemartini.com/eng/arch/dna/type/">
<priceOverrideAccomBasePrice type="dna">
<use_quote_override_price type="dna">
<B2B type="boolean">true</B2B>
<B2C type="boolean">false</B2C>
</use_quote_override_price>
</priceOverrideAccomBasePrice>
</dna>
and here is the DNAList i want this converted to :
DNA {
"priceOverrideAccomBasePrice" DNA {
"use_quote_override_price" DNA {
"B2B" Boolean "true",
"B2C" Boolean "false"
Any pointers or XSL templates towards this direction will be highly appreciated.
Thanks
falcyon

Check This FM IDOC_XML_FROM_FILE.
See This Link
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/46759682-0401-0010-1791-bd1972bc0b8a
Ranga

Similar Messages

  • J2SE adapter PI 7.1 issue with XML to flat conversion and namespace length

    Dear reader,
    We are facing an issue with J2SE Adapter PI7.1 for a number of flows.
    The flow requirements:
    [1] Namespace length for interfaces is up to 100 characters
    [2] The XML message must be converted to Flat on the adapter channel
    Our PI system is at patch level 7 and we implement J2SE adapter on patch level 7 as well.
    We found that the J2SE adapter on patch level 7 does not support long namespaces [1] (as it should since this is an PI 7.1 j2SE adapter) but no issues where found with the XML to flat conversion [2].
    Experimenting with J2SE adapter on patch level 6 we found the long namespaces [1] are supported however an issue is found with the XML to flat conversion [2] as stated in SAP note 1335527.
    An SAP Customer Message is raised on this issue however your input is highly appricated!
    With Kind Regards,
    Harald Kastelijn
    Edited by: Harald Kastelijn on Mar 6, 2010 9:17 AM
    Edited by: Harald Kastelijn on Mar 6, 2010 9:19 AM

    We found that the J2SE adapter on patch level 7 does not support long namespaces [1] (as it should since this is an PI 7.1
    j2SE adapter) but no issues where found with the XML to flat conversion [2]
    I think the restriction of namespace length still remains in design time (IR).....the same however has been extended in configuration and runtime...this SAP note has some information: https://service.sap.com/sap/support/notes/870809

  • XML-2-TXT conversion

    All,
    We have a small, annoying problem with xml-2-text conversion.  During the conversion, the "&amp;: in the XML file is not translated to "&" (ampersand).
    We encounter this issue with the xml-2-txt convertor of the file adapter of the standalone J2SE adapter.
    Anyone having a simple workaround for this small but annoying issue?
    Kind regards, Guy Crets

    I have not used the J2Se adapter, however I wrote a java mapping program that converts XML2TXT, it is highly experimental. You may use it as the last mapping in the mapping program "chain". The XSLT is at the end.
    I have tested this with
    XML -> fileadapter -> SAP XI javamapping -> http adapter -> MS IIS.
    Good luck /Otto
    Created on 2005-dec-05
    To change the template for this generated file go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    @author 01ottfro Otto Frost Capgemini
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import java.util.HashMap;
    import com.sap.aii.mapping.api. AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    //import java.io.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    //import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    //import java.io.File;
    import java.io.IOException;
    import java.io.ByteArrayInputStream;
    //import java.io.ByteArrayOutputStream;
    import java.io.StringReader;
    //import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.UnsupportedEncodingException;
    import org.w3c.dom.Document;
    //import org.w3c.dom.DOMException;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    //import javax.xml.parsers.*;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.NamedNodeMap;
    public class XML2TEXT implements StreamTransformation {
      private Map           param = null;
      private AbstractTrace  trace = null;
      private StringBuffer sbTrace = new StringBuffer();
      public void setParameter (Map param) {
        this.param = param;
        //if (param == zero) {
        if ((param == null)) {
               this.param = new HashMap();
      public void execute(InputStream in, OutputStream out) {
        try {
          //javax.xml.parsers.DocumentBuilderFactory = "";
           trace = (AbstractTrace)param.get(
             StreamTransformationConstants.MAPPING_TRACE);
           trace.addInfo("Start");
           trace.addInfo(System.getProperty("javax.xml.parsers.DocumentBuilderFactory "));
           InputStreamReader isr = new InputStreamReader(in,"UTF-8");
           in.reset();
           StringBuffer sb2 = new StringBuffer();
           char c;
           int i = isr.read();
           while (i != -1) {
                c = (char) i;
              sb2.append(c);
              i = isr.read();
           String ss = new String(sb2);
           trace.addInfo(ss);
           in.reset();
           String receiverName = (String)param.get(
             StreamTransformationConstants.RECEIVER_NAME);
           //static Document document;
           Document document;
           StringBuffer sb = new StringBuffer();
           StringBuffer sbTrace = new StringBuffer();
           sb.append("");
           sb.append("<?xml version=\"1.0\"?>");
           sb.append("<DOC>");
    //          sb.append("<greeter>An XSLT Programmer</greeter>");
    //          sb.append("<greeting>Hello, World!</greeting>");
           sb.append("<TEXT>x_content_x</TEXT>");
           sb.append("</DOC>");
           //String s = sb.ToString();
           StringReader sr = new StringReader(sb.toString());
           DocumentBuilderFactory dbf = new DocumentBuilderFactory();
           dbf.setCoalescing(true);
           dbf.setExpandEntityReferences(true);
           dbf.setIgnoringComments(true);
           dbf.setIgnoringElementContentWhitespace(false);
           dbf.setNamespaceAware(true);
           dbf.setValidating(true);
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           factory.setCoalescing(true);
           factory.setExpandEntityReferences(true);
           factory.setIgnoringComments(true);
           factory.setIgnoringElementContentWhitespace(false);
           factory.setNamespaceAware(true);
           factory.setValidating(false);
           try {
              DocumentBuilder builder = factory.newDocumentBuilder();
             builder.setErrorHandler(
               new org.xml.sax.ErrorHandler() {  // ignore fatal errors (an  exception is guaranteed)
                 public void fatalError(SAXParseException exception)
                 throws SAXException {
                 // treat validation errors as fatal
                 public void error(SAXParseException e)
                 throws SAXParseException {
                   throw e;
                 // dump warnings too
                 public void warning(SAXParseException err)
                 throws SAXParseException {
                   System.out.println("** Warning"
                      + ", line " + err.getLineNumber()
                      + ", uri " + err.getSystemId());
                        trace.addInfo("** Warning"
                        + ", line " + err.getLineNumber()
                        + ", uri " + err.getSystemId());  
                   System.out.println("   " + err.getMessage());
                     trace.addInfo("   " + err.getMessage());
              //document = builder.parse( new File(args[0]) );
              ByteArrayInputStream bais = new
              ByteArrayInputStream(sb.toString().getBytes("UTF-8"));
                //System.out.println (bais.toString());
              //document = builder.parse(bais);
              document = builder.parse(in);
              Element documentRootElement = document.getDocumentElement();
              trace.addInfo("root" + documentRootElement.getNodeValue());
              trace.addInfo("root" + Short.toString(documentRootElement.getNodeType()));
              trace.addInfo("root" + documentRootElement.getNodeName());
    //          Element textElement = (Element) documentRootElement.getFirstChild();
              NodeList nodeList = documentRootElement.getElementsByTagName("TEXT");
            StringBuffer sbText = new StringBuffer();
              for(i = 0; i<nodeList.getLength() ;i++) {
                   Element textElement = (Element) nodeList.item(i);
                   Node text = textElement.getFirstChild();
                   sbText.append(text.getNodeValue());
              nodeList = documentRootElement.getElementsByTagName("CHARSETNAME");
              StringBuffer sbCharset = new StringBuffer();
              for(i = 0; i<nodeList.getLength() ;i++) {
                   Element textElement = (Element) nodeList.item(i);
                   Node text = textElement.getFirstChild();
                   sbCharset.append(text.getNodeValue());
    //          System.out.println(textElement.getNodeValue());
    //          System.out.println(textElement.getNodeType());
    //          System.out.println(textElement.getNodeName());
              trace.addInfo("te" + textElement.getNodeValue());
              short nodeType = textElement.getNodeType();
              trace.addInfo("te" + Short.toString(nodeType));
              trace.addInfo("te" + textElement.getNodeName());
              Node textNode = textElement.getFirstChild();
              Node mt_textdocument = document.getFirstChild();
              Node text = mt_textdocument.getFirstChild();
              Node hashtext = text.getFirstChild();
              textNode = hashtext;
              String s = new String();
              if (textNode != null) {          
                   trace.addInfo(textNode.getNodeValue());
                   trace.addInfo(Short.toString(textNode.getNodeType()));
                   trace.addInfo(textNode.getNodeName());
                  s = new String(textNode.getNodeValue());
              else {
                   s = "ERROR";
                   trace.addInfo(s);
    //          traverse1(document);
    //          trace.addInfo(sbTrace.toString());
    //          OutputStream baos = new ByteArrayOutputStream();
            String s = sbText.toString();
            String charset = sbCharset.toString();
              byte[] bytes = s.getBytes(charset);
    //          baos.write(bytes,0,bytes.length);
            out.write(bytes,0,bytes.length);
           } catch (SAXException sxe) {
               // Error generated during parsing
               Exception  x = sxe;
               if (sxe.getException() != null)
                    x = sxe.getException();
               x.printStackTrace();
           } catch (ParserConfigurationException pce) {
               // Parser with specified options can't be built
               pce.printStackTrace();
           } catch (IOException ioe) {
               // I/O error
               ioe.printStackTrace();
         catch (UnsupportedEncodingException uee) {
              trace.addInfo("UnsupportedEncodingException");
        catch (IOException ioe) {
          // I/O error
          //  ioe.printStackTrace();
           trace.addInfo("IOException");
        finally {
              trace.addInfo("finally");
      public void traverse1(Node node) {
           do {
               System.out.println("Node: name=" + node.getNodeName() +
               ", value=" + node.getNodeValue() + ", type=" +
               node.getNodeType());
               sbTrace.append("Node: name=" + node.getNodeName() +
              ", value=" + node.getNodeValue() + ", type=" +
              node.getNodeType() + "\n");
              trace.addInfo("Node: name=" + node.getNodeName() +
              ", value=" + node.getNodeValue() + ", type=" +
              node.getNodeType() + "\n");
               if (node.getFirstChild() != null) {
                System.out.println("Processing children:");
                sbTrace.append("Processing children:"+"\n");
                trace.addInfo("Processing children:"+"\n");
                traverse1(node.getFirstChild());
           }  while ((node = node.getNextSibling()) != null);
         public void traverse2(Node node) {
              //Get the children of this Node
                NodeList children = node.getChildNodes();
                //go through all the children of the node
                for (int i=0; i<children.getLength(); i++) {
                    //get the next child
                    Node child = children.item(i);
                    //get the type of the child
                    short childType = child.getNodeType();
                    if (childType == Node.ELEMENT_NODE) {
                   //if the child is an Element then print the start and end
                   //tags and recurse the content       
                   String nodeName = child.getNodeName();
                   System.out.print("<" + nodeName + ">");
                   sbTrace.append("<" + nodeName + ">");
                   trace.addInfo("<" + nodeName + ">");
                   traverse2(child);
                   System.out.print("</" + nodeName + ">");
                   sbTrace.append("</" + nodeName + ">");
                   trace.addInfo("</" + nodeName + ">");
                } else if (childType == Node.TEXT_NODE) {
                   //if the child is a Text node just print the text content
                   String data = child.getNodeValue();
                   System.out.print(data);
                   sbTrace.append(data);
                   trace.addInfo(data);
         public void traverse3(Node node, int indent) {
              for (int i = 0; i < indent; i++) {
                System.out.print("   ");
                sbTrace.append("   ");
                trace.addInfo("   ");
              int type = node.getNodeType();
              switch (type) {
              case Node.ATTRIBUTE_NODE:
                System.out.println("ATTRIBUTE_NODE");
                sbTrace.append("ATTRIBUTE_NODE"+"\n");
                trace.addInfo("ATTRIBUTE_NODE"+"\n");
                break;
              case Node.CDATA_SECTION_NODE:
                System.out.println("CDATA_SECTION_NODE");
                sbTrace.append("CDATA_SECTION_NODE"+"\n");
                trace.addInfo("CDATA_SECTION_NODE"+"\n");
                break;
              case Node.COMMENT_NODE:
                System.out.println("COMMENT_NODE");
                sbTrace.append("COMMENT_NODE"+"\n");
                trace.addInfo("COMMENT_NODE"+"\n");
                break;
              case Node.DOCUMENT_FRAGMENT_NODE:
                System.out.println("DOCUMENT_FRAGMENT_NODE");
                sbTrace.append("DOCUMENT_FRAGMENT_NODE"+"\n");
                trace.addInfo("DOCUMENT_FRAGMENT_NODE"+"\n");
                break;
              case Node.DOCUMENT_NODE:
                System.out.println("DOCUMENT_NODE");
                sbTrace.append("DOCUMENT_NODE"+"\n");
                trace.addInfo("DOCUMENT_NODE"+"\n");
                break;
              case Node.DOCUMENT_TYPE_NODE:
                System.out.println("DOCUMENT_TYPE_NODE");
                sbTrace.append("DOCUMENT_TYPE_NODE"+"\n");
                trace.addInfo("DOCUMENT_TYPE_NODE"+"\n");
                break;
              case Node.ELEMENT_NODE:
                System.out.println("ELEMENT_NODE");
                sbTrace.append("ELEMENT_NODE"+"\n");
                trace.addInfo("ELEMENT_NODE"+"\n");
                NamedNodeMap atts = node.getAttributes();
                for (int i = 0; i < atts.getLength(); i++) {
                   Node att = atts.item(i);
                   traverse3(att, indent + 1);
                break;
              case Node.ENTITY_NODE:
                System.out.println("ENTITY_NODE");
                sbTrace.append("ENTITY_NODE"+"\n");
                trace.addInfo("ENTITY_NODE"+"\n");
                break;
              case Node.ENTITY_REFERENCE_NODE:
                System.out.println("ENTITY_REFERENCE_NODE");
                sbTrace.append("ENTITY_REFERENCE_NODE"+"\n");
                trace.addInfo("ENTITY_REFERENCE_NODE"+"\n");
                break;
              case Node.NOTATION_NODE:
                System.out.println("NOTATION_NODE");
                sbTrace.append("NOTATION_NODE"+"\n");
                trace.addInfo("NOTATION_NODE"+"\n");
                break;
              case Node.PROCESSING_INSTRUCTION_NODE:
                System.out.println("PROCESSING_INSTRUCTION_NODE");
                sbTrace.append("PROCESSING_INSTRUCTION_NODE"+"\n");
                trace.addInfo("PROCESSING_INSTRUCTION_NODE"+"\n");
                break;
              case Node.TEXT_NODE:
                System.out.println("TEXT");
                sbTrace.append("TEXT"+"\n");
                trace.addInfo("TEXT"+"\n");
                break;
              default:
                System.out.println("???");
                sbTrace.append("???"+"\n");
                trace.addInfo("???"+"\n");
                break;
              for (Node c = node.getFirstChild(); c != null; c =
              c.getNextSibling()) {
                traverse3(c, indent + 1);
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:trema-com:trema:trema" targetNamespace="urn:trema-com:trema:trema">
         <xsd:element name="MT_TEXTDOCUMENT" type="DT_TEXTDOCUMENT" />
         <xsd:complexType name="DT_TEXTDOCUMENT">
              <xsd:annotation>
                   <xsd:appinfo source="http://sap.com/xi/TextID">
                   70d8cec1675c11da822400132107c3b7
                   </xsd:appinfo>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="TEXT" type="xsd:string">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             cc2dc340659311dab38eeb8f0ace6159
                             </xsd:appinfo>
                        </xsd:annotation>
                   </xsd:element>
                   <xsd:element name="CHARSETNAME" type="xsd:string">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             bf0f424065c211da893ceb8f0ace6159
                             </xsd:appinfo>
                        </xsd:annotation>
                   </xsd:element>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>
    example xml
    <?xml version="1.0" encoding="utf-8"?>
    <MT_TEXTDOCUMENT><TEXT>your text</TEXT><CHARSETNAME>UTF-8</CHARSETNAME></MT_TEXTDOCUMENT>

  • XSU error oracle.xml.sql.OracleXMLSQLException: Conversion to String failed

    Appication Server: 10g, Database: Oracle 9i and Oracle 10g
    I have a table 'sw_icd2' in the database that has one column of XMLType.
    The code below, attempts to query this table as 'select * from sw_icd2' and display the result. I was able to execute this query in sqlplus.
    But when I run a program using XSU in JDeveloper:
    OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from sw_icd2");
    XMLDocument domDoc = (XMLDocument)qry.getXMLDOM();
    domDoc.print(System.out);
    StringWriter s = new StringWriter(10000);
    domDoc.print(new PrintWriter(s));
    System.out.println(s.toString());
    qry.close();
    I get the following Error:
    "oracle.xml.sql.OracleXMLSQLException: Conversion to String failed"
    Any ideas on how I can resolve this issue? Your help would be appreciated.
    Thanks!

    Okay, it looks like the problem has something to do with the TIMESTAMP data type in tables.
    oracle.xml.sql.query.OracleXMLQuery can't seem to handle tables with the TIMESTAMP data type.
    this code ran fine on my machine :
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    import java.lang.*;
    import java.sql.*;
    public class testXMLSQL {
         public static void main(String[] args) {
    try {
    // Create the connection
    System.out.println("before getConnection ");
    Connection conn = getConnection("scott","tiger");
    System.out.println("after getConnection ");
    // Create the query class
    OracleXMLQuery qry = new OracleXMLQuery(conn, "SELECT * FROM EMP");
    System.out.println("after OracleXMLQuery object created ");
    // Get the XML string
    String str = qry.getXMLString();
    // Print the XML output
    System.out.println("The XML output is:\n"+str);
    // Always close the query to get rid of any resources..
    qry.close();
    } catch(SQLException e) {
    System.out.println(e.toString());
    // Get the connection given the user name and password.!
    private static Connection getConnection(String username,
    String password)
    throws SQLException
    // register the JDBC driver..
    DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
    // Create the connection using the OCI8 driver
    Connection conn =
    DriverManager.getConnection(
    "jdbc:oracle:thin:@<server_name>:1521:<sid>",
    username,password);
    return conn;
    Then I created another table :
    create table emp_test as select * from emp;
    added a timestamp to it :
    alter table emp_test add (time timestamp(6));
    and filled it with timestamp information :
    update emp_test set time = timestamp'2005-09-22 09:26:50.124';
    ran the same code but changed the SQL to :
    "SELECT * FROM EMP_TEST"
    and got the error message :
    The XML output is:
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: Conversion to String failed</ERROR>
    looks like bug in OracleXMLQuery object??

  • Error in StrictXml2PlainBean (XML to Text Conversion)

    Hi All,
    I am trying to convert the XML to Plain file in receiver file adapter. I am using module - StrictXml2PlainBean.
    Below is my target structure
    B2B_HEADER (1..1)                    Level1
    SHIPMENT_HEADER(1...1)          Level1
    SHIPMENT_CUSTOMER  (1..Unbounded)     Level1
       CARTON_HEADER     (1..Unbounded)         Level2 Child node of Shipment_customer
         CARTON_DETAIL  (1..Unbounded)         Level3 Child node of Carton_header
    I have mention below parameters in module tab,
                          B2B_Header.endSeparator             \n
         B2B_Header.fieldLengthExceeded     cut
         B2B_Header.fieldLengths     8,8,8,16,15,14,5,38,14,66,8
         Carton_Detail.endSeparator     \n
         Carton_Detail.fieldLengthExceeded     cut
         Carton_Detail.fieldLengths     6,14,4,10,14,10,35,10,6
         Carton_Header.endSeparator     \n
         Carton_Header.fieldLengthExceeded     cut
         Carton_Header.fieldLengths     6,20,20,12,2,7,2
         Shipment_Customer.endSeparator     \n
         Shipment_Customer.fieldLengthExceeded     cut
         Shipment_Customer.fieldLengths     6,8,10,40,40,40,40,40,10,2,15,40,1
         Shipment_Header.endSeparator     \n
         Shipment_Header.fieldLengthExceeded     cut
         Shipment_Header.fieldLengths     6,20,4,20,35,30,10,30,3,3,35,35,30,10,30,3,30,10,30,30,9,10,3,30,6,12,14,3
         recordTypes     B2B_Header,Shipment_Header,Shipment_Customer,Carton_Header,Carton_Detail
    I have getting below error in communicatipon channel monitoring...
    *Message processing failed. Cause: com.sap.aii.af.app.modules.conversion.xml2plain.ConversionException: The element nesting level for the structure Shipment_Customer is too deep (reference: 3 levels, found: 4 levels) at XML element CreateAndAcknowledgePickPackShipmentGIS_Async_V01,Shipment_Customer,Carton_Header,RecordIndicator
    RecordIndicator is a field in Carton_Header. Am i missing something in the configuration?
    Regards
    Amol
    Edited by: AMOL BHARTI on Dec 24, 2010 8:59 AM

    Hi Amol,
    You XML structure contains deep levels. As far as i understand about the StrictXML2PlainBean module, this is not capable of handling deep structures.
    This module is just an alternative to use FCC type functionality for other receiver adapters.
    Please take a look at these links:
    https://help.sap.com/saphelp_nwpi711/helpdata/EN/44/748d595dab6fb5e10000000a155369/content.htm
    StrictXml2PlainBean - to have an XML - EDI conversion?
    In case you want to achieve nested level content conversion, you may try this:
    /people/karthiknarayan.kesavan2/blog/2007/08/22/file-content-conversion-for-multi-hierarchical-structure
    I hope this helps.
    Regards, Gaurav.

  • XML to ABAP Conversion Error - CX_SY_CONVERSION_DATA_LOSS

    REPORT  y_rpt_test                              .
    TYPE-POOLS sscr.
    DATA: restrict TYPE sscr_restrict,
    opt_list TYPE sscr_opt_list,
    *** TYPE sscr_***.
    DATA: options TYPE STANDARD TABLE OF rfc_db_opt ,
    fields TYPE STANDARD TABLE OF rfc_db_fld ,
    meta TYPE STANDARD TABLE OF ywas_metadata ,
    xml_out TYPE string .
    data: xml_out_x type xstring.
    DATA: wa_options LIKE LINE OF options,
    wa_fields LIKE LINE OF fields ,
    wa_meta LIKE LINE OF meta .
    FIELD-SYMBOLS: <outtab> TYPE ANY TABLE,
    <l_line> TYPE ANY,
    <l_field> TYPE ANY.
    DATA: new_table TYPE REF TO data.
    DATA: new_line TYPE REF TO data.
    DATA: xslt_error TYPE REF TO cx_xslt_exception ,
    xslt_message TYPE string .
    DATA: it_fieldcat TYPE lvc_t_fcat,
    is_fieldcat LIKE LINE OF it_fieldcat.
    TYPES: BEGIN OF s_text,
             partnum(18)     TYPE c,
             LONG_DESC(3000)    TYPE c,
           END OF s_text.
    data: lt_outtab type standard table of s_text,
          is_outtab type s_text.
    data: it_temp_text(1000)  TYPE c OCCURS 0 with header line.
    data : l_file TYPE string value 'C:xmlload.xml'.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = l_file
        FILETYPE                      = 'ASC'
      tables
        data_tab                      = it_temp_text.
    loop at it_temp_text.
        concatenate xml_out it_temp_text into xml_out.
    endloop.
        IF NOT xml_out IS INITIAL .
          TRY .
              CALL TRANSFORMATION (`ZTEST1`)
              SOURCE XML xml_out
              RESULT outtab = lt_outtab.
            CATCH cx_xslt_exception INTO xslt_error.
              xslt_message = xslt_error->get_text( ).
              WRITE:/ xslt_message .
          ENDTRY.
        ENDIF .
        break-point.
        write : / 'test'.
    ==========================================================
    I am using above code to convert input XML file into internal table I am getting conversion error. My input XML file looks is as follows. It is throwing this error in call transformation. Appreciate your help in Advance.
    <MODIFIED BY MODERATOR - RESPECT THE 2,500 CHAR LIMIT>
    Code Formatted by: Alvaro Tejada Galindo on Jan 4, 2010 3:31 PM

    Thanks for quick response.
    I think the problem is with special characters in the input XML file. If I don't have special characters in XML file then it works fine.
    Anyway here is the XSLT code. This is a generic XSLT code which I used from one of the examples
    posted on this site.
    <?xml version="1.0" encoding="iso-8859-1"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xa="urn:schemas-microsoft-com:xml-analysis:mddataset" xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <xsl:output method="xml" />
    <xsl:variable name="fieldNames" select="//asx:abap/asx:values/FIELDCAT" />
    <xsl:template match="/">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    <asx:values>
    <!--FIELDCAT>
    <xsl:apply-templates select="//YWAS_METADATA" />
    </FIELDCAT-->
    <OUTTAB>
    <xsl:apply-templates select="//item" />
    </OUTTAB>
    </asx:values>
    </asx:abap>
    </xsl:template>
    <xsl:template match="//YWAS_METADATA">
    <item>
    <xsl:for-each select="*">
    <!--column ><xsl:apply-templates/></column-->
    <xsl:copy>
    <xsl:apply-templates select="@*|*|text()"/>
    </xsl:copy>
    </xsl:for-each>
    </item>
    </xsl:template>
    <xsl:template match="//item">
    <item>
    <xsl:for-each select="*">
    <!--column ><xsl:apply-templates/></column-->
    <xsl:copy>
    <xsl:apply-templates select="@*|*|text()"/>
    </xsl:copy>
    </xsl:for-each>
    </item>
    </xsl:template>
    </xsl:stylesheet>

  • Flat File to XML using content conversion.

    Hi Experts,
    I am converting a flat file to xml structure.
    i need the structure of xml like :
    <LineA>
    </LineA>
    <LineB>
          <LineC>
          </LineC>
    </LineB>
    I am able to generate it in hierarchy
    <LineA>
    </LineA>
    <LineB>
    </LineB>
    <LineC>
    </LineC>
    How should i write structure of Recordset so that for  LineC so that it comes under the LineB tag ? I also dont want the name of recordset in my output, how can i do that ?
    Kulwinder.

    Hi
    Refer
    File Receiver with Content Conversion
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    Configuring the Receiver File/FTP Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/95/bb623c6369f454e10000000a114084/frameset.htm
    File content conversion sites
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2
    /people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file
    /people/shabarish.vijayakumar/blog/2005/08/17/nab-the-tab-file-adapter
    /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns
    /people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
    Please see the below links for file content conversion..
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter - FCC
    /people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter - FCC
    File Content Conversion for Unequal Number of Columns
    /people/jeyakumar.muthu2/blog/2005/11/29/file-content-conversion-for-unequal-number-of-columns - FCC
    Content Conversion (Pattern/Random content in input file)
    /people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file - FCC
    /people/harrison.holland5/blog/2006/12/20/xi-configuration-for-mdm-integration--sample-scenario - FCC - MDM
    XI in the role of a FTP
    /people/shabarish.vijayakumar/blog/2006/04/03/xi-in-the-role-of-a-ftp - FCC
    File to R/3 via ABAP Proxy
    /people/prateek.shah/blog/2005/06/14/file-to-r3-via-abap-proxy - FCC
    /people/mickael.huchet/blog/2006/09/18/xipi-how-to-exclude-files-in-a-sender-file-adapter - EOIO - File
    http://help.sap.com/saphelp_nw04/helpdata/en/ee/c9f0b4925af54cb17c454788d8e466/frameset.htm - cc
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/95/bb623c6369f454e10000000a114084/content.htm - fcc cOUNTER
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/da1e7c16-0c01-0010-278a-eaed5eae5a5f - conversion agent

  • Xml to html conversion using xslt

    xml contains exponential no i.e. number in scientific notation. When it is converd to HTML, we get NaN for that number. It happens in JDK 1.4 i.e. WLS8.1 with jdk 1.4 bea jrockit jvm.
    It worked fine with wls7 using xalan-j_2_1_0/bin/xalan.jar
    ANy solution?

    Do you know of a method in the xdk that takes a well formed HTML doc and using xsd / xslt convert back to original xml spec?
    Because you created (and as long as you create) the HTML from XML it will be well formed (every tag will be ended with an end-tag) and you can therefore transform it back into XML.
    Most times it will not be possible to convert HTML found on the 'internet' into XML because this HTML is not well formed. For example, many people forget to end a paragraph of text within HTML with the </p> tag.
    We are evaluating using xslt to convert the XML to a form based medium for content maintenance. Wondering if once a XML document is parsed to HTML (DOM) can it be parsed back to XML for subsequent update to stored value in blob column. Specifically interested in conversion (parser) from HTML to XML
    Simply can HTML (in DOM format validated against a xsd) be transformed back to XML ?

  • Xml 2 Fmb conversion in Oracle 9i

    I have converted several forms into XML with command "iff2xml90.bat *.fmb"
    All files *.fmb have been converted into _fmb.xml
    Then I have converted xml files into FMB with command "ifxml2f90.bat *.xml"
    All files _fmb.xml have been converted into _fmb.fmb instead of *.fmb
    If I use ifxml2f90.bat command with only file it's OK, but if I use it with several ones
    it doesn't work.
    Why ? What workaround exists ?

    Wilcards are not supported for the conversion command line - you can specifiy multiple files one after the other but not wildcards. IF you want to use wildcards then write your own Batch file or shell script that does that.

  • XML to CLOB conversion

    Hello
    I have a XMLTYPE field.
    And I need to remove all the XML Tags and save it as CLOB.
    I tried using Regexp_replace or replace but it throws
    ORA-19011: Character string buffer too small error?
    Any other techniques?
    Parth

    Hi,
    You can use getCLOBval() for conversion.
    CREATE TABLE EMP2 (EMPCODE NUMBER(8),EMPNAME VARCHAR2(100),EMPDEPTNO NUMBER(8),EMPSAL NUMBER(34,2));
    create table EMPXML(XMLCLOB XMLTYPE);
    BEGIN
    FOR X IN (SELECT * FROM USER_OBJECTS S WHERE ROWNUM<=50)
    LOOP
    INSERT INTO EMP2 VALUES (X.OBJECT_ID,X.OBJECT_NAME,20,X.OBJECT_ID+10);
    END LOOP;
    COMMIT;
    END;
    DECLARE
    v_xmldata CLOB;
    BEGIN
    SELECT Xmlelement("Employee",
    Xmlagg(Xmlforest(e.Empcode AS "EmpId",
    e.Empname AS "EmpName",
    e.Empsal AS "EmpSal"))).getclobval() INTO v_xmldata
    FROM Emp2 e;
    INSERT INTO empxml VALUES (xmltype(v_xmldata));
    END;
    SELECT * FROM empxml;
    DROP TABLE emp2 PURGE;
    DROP TABLE empxml PURGE;

  • XML to Forms conversion gives error for menus

    We are trying the ORACLE <---> XML conversion Utility.
    We want to convert a MMB to XML and store it in our repository. When we want to modify it we get the XML from the repository, convert it back to a MMB and edit it. This saves space in the repository DB.
    Problem when we convert or MMB --> XML using like this frmf2xml.bat OVERWRITE=YES TRANS_MENU.mmb
    the XML file is created.
    Now when we try to convert the XML back to a MMB using this code frmxml2f OVERWRITE=YES PRINTTREE=YES USERID=userid/pwd@db TRANS_MENU_mmb.xml we get this error:
    Oracle Forms 10.1.2 XML to Forms Tool
    Copyright(c) 2001, 2005, Oracle. All rights reserved.
    file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 164, Column 73>: XML-24523: (Error) Invalid value ' INTERNATIONAL_OUT_GOING_CALL_D_MENU ' for attribute: 'Name'
    file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 773, Column 73>: XML-24523: (Error) Invalid value 'BILLING_PROCESS_MASTER_FILE_UP_MENU' for attribute: 'Name'
    file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 823, Column 69>: XML-24523: (Error) Invalid value 'BANK_PAYMENT_AUDIT_REPORTS_MENU' for attribute: 'Name'
    file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 864, Column 73>: XML-24523: (Error) Invalid value 'INFO_CONNECT_ACCOUNTING_INTERF_MENU' for attribute: 'Name'
    file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 887, Column 73>: XML-24523: (Error) Invalid value 'DEALER_SOLD_SUBSCRIPTION_TRANS_MENU' for attribute: 'Name'
    file:/F:/Channa/XML_Forms_Conversion/I/TRANS_MENU_mmb.xml<Line 917, Column 73>: XML-24523: (Error) Invalid value 'CHANNA_LEVEL_42444444444444444_MENU' for attribute: 'Name'
    Invalid XML - file TRANS_MENU_mmb.xml does not validate against Forms XML Schema:
    Invalid value 'INTERNATIONAL_OUT_GOING_CALL_D_MENU' for attribute: 'Name'
    I found the problem. For submenus the XML adds a _MENU to the end of the name attribute and when the name of the menu is over 26 chars 26+5 = 31 becomes more than 30 characters.  So when the XML is converted to the MMB we get an error because forms objects cannot have names of lengths > 30.
    I think this could be a bug. We cannot modify the menu just for this since it is not practical.
    Is this a known bug? Any workaround?
    Edited by: Channa on Mar 5, 2010 2:11 AM
    Edited by: Channa on Mar 5, 2010 2:12 AM
    Edited by: Channa on Mar 5, 2010 2:13 AM
    Edited by: Channa on Mar 5, 2010 2:13 AM
    Edited by: Channa on Mar 18, 2010 9:22 PM
    Edited by: Channa on Mar 18, 2010 9:25 PM

    Hi Amol,
    You XML structure contains deep levels. As far as i understand about the StrictXML2PlainBean module, this is not capable of handling deep structures.
    This module is just an alternative to use FCC type functionality for other receiver adapters.
    Please take a look at these links:
    https://help.sap.com/saphelp_nwpi711/helpdata/EN/44/748d595dab6fb5e10000000a155369/content.htm
    StrictXml2PlainBean - to have an XML - EDI conversion?
    In case you want to achieve nested level content conversion, you may try this:
    /people/karthiknarayan.kesavan2/blog/2007/08/22/file-content-conversion-for-multi-hierarchical-structure
    I hope this helps.
    Regards, Gaurav.

  • Reg XML to Plain Conversion using B2B add on

    Hi All,
    This is an outbound scenario where the  message is sent to AS2 receiver channel and the output is Plain file. I have added all the module parameters
    and the content type as application/plain. While testing I am facing the error,
    Exception caught by adapter framework: XML-Parser error occured while parsing: Cannot initialize XML to plain handlerCan not find a matching configuration for sender party "", service , receiver party ,service , namespace , action  in table B2B_PLA_CTRL_IF.
    Can anyone help me on this issue.
    Cheers,
    Neethu

    Hi Neethu,
    Did you import the content? See How to install the new B2B add-on , see step 5.1
    You need to do this for the message type you want to exchange ((EDI, ansi X.12, ...).
    Also, please do step 5.2. I guess this is not the case.
    Kind regards,
    Dimitri

  • Problem in XML to ITAB conversion - Application server files

    Hi Friends
    Earlier we used FTP concept, so I received XML file and length frpm FTP function modules, but now instead of FTP I am going to use the following function modules
    SCMS_BINARY_TO_XSTRING
    SMUM_XML_PARSE
    for that I need to pass the lenght of the file.But I dont know how to calculate the file length while receiving the files using Open Dateset concept.
    Kindly provide your inputs.
    Thanks
    Gowrishankar

    Could you please tell us how you solve it?
    Greetings,
    Blag.

  • XML to ABAP Conversion

    Hi Experts,
    I am using SFP transaction.
       CALL METHOD cl_gui_frontend_services=>file_open_dialog
    CHANGING
    file_table = lt_file_table
    rc = lv_rc
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    file_open_dialog_failed = 1
    cntl_error = 2
    error_no_gui = 3
    not_supported_by_gui = 4
    OTHERS = 5.
    READ TABLE lt_file_table
    INTO lv_filename
    INDEX 1.
    cl_gui_frontend_services=>gui_upload(
    EXPORTING
    filename = lv_filename
    filetype = 'BIN' "Binary
    IMPORTING
    filelength = lv_filelength
    CHANGING
    data_tab = lt_rawtab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    not_supported_by_gui = 17
    error_no_gui = 18
    OTHERS = 19 ).
    Get FP reference
    DATA: lo_fp TYPE REF TO if_fp VALUE IS INITIAL.
    lo_fp = cl_fp=>get_reference( ).
    For handling exceptions
    DATA: lo_fpex TYPE REF TO cx_fp_runtime VALUE IS INITIAL.
    TRY.
    Create PDF Object using destination 'ADS' (<-- this is how it is
    defined in SM59)
    DATA: lo_pdfobj TYPE REF TO if_fp_pdf_object VALUE IS INITIAL.
    lo_pdfobj = lo_fp->create_pdf_object( connection = 'ADS' ).
    FIELD-SYMBOLS: <ls_rawtab> LIKE LINE OF lt_rawtab.
    Move to XSTRING
    LOOP AT lt_rawtab ASSIGNING <ls_rawtab>.
    CONCATENATE pdf_data <ls_rawtab>-data INTO pdf_data IN BYTE MODE.
    ENDLOOP.
    Set document
    lo_pdfobj->set_document(
    EXPORTING
    pdfdata = PDF_DATA).
    CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
      EXPORTING
        IM_XSTRING = XML_DATA
      IMPORTING
        EX_STRING  = LV_XML_DATA_STRING.
    Remove NEW-LINE character from XML data in STRING format
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    REPLACE ALL OCCURrENCES OF cl_abap_char_utilities=>newline IN
    lv_xml_data_string WITH ''.
    Make the XML envelope compliant with identity transform
    REPLACE '<?xml version="1.0" encoding="UTF-8"?><data>'
    IN lv_xml_data_string
    WITH '<?xml version="1.0" encoding="iso-8859-1"?><asx:abap xmlns :asx="http://www.sap.com/abapxml" version="1.0"><asx:values>'.
    REPLACE '</data>' IN lv_xml_data_string WITH '</asx:values></asx:abap>'.
    Apply the identity transform and convert XML into ABAP in one step
    CALL TRANSFORMATION ('ID')
    SOURCE XML lv_xml_data_string
    RESULT out = out.
    But getting error
    Short text
        XSLT: No valid XML source
    Runtime Errors         XSLT_BAD_SOURCE_CONTEXT
    Except.                CX_XSLT_RUNTIME_ERROR
    How i call -->call transforamtion...Can any one please tell me how to convert XML to abap internal table?...
    Thanks

    Hi,
       I just catch the exception.
    Regards,
    Mathi

  • Xml to oracle conversion error

    hai guys
    i am having a procedure as follows to convert xml file into oracle.
    Create or replace procedure xml(xml_doc varchar2,table_name varchar2)
    as
    v_buf varchar2(30000);
    v_insctx dbms_xmlsave.ctxtype;
    v_rows number;
    v_file varchar2(30000);
    begin
    xmldom.writetofile(xmlparser.parse(xml_doc), v_file);
    v_insctx := dbms_xmlsave.newcontext(table_name); -- get the context handle
    v_rows := dbms_xmlsave.insertxml(v_insctx,v_file); -- this inserts the document
    dbms_output.put_line(to_char(v_rows) || ' rows inserted');
    dbms_xmlsave.closecontext(v_insctx);
    end;
    Execution
    Exec xml( '/home/main/SAMPLE.xml','SAMPLE');
    I am Getting the error
    Error
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException: name can't be null
    ORA-06512: at "SYS.XMLDOCUMENTCOVER", line 0
    ORA-06512: at "SYS.XMLDOM", line 1829
    ORA-06512: at "SCOTT.XML", line 8
    ORA-06512: at line 7
    if Any one find solution please reply
    thanks

    xmldom.writetofile(xmlparser.parse(xml_doc), v_file);You haven't assigned anything to v_file. That would seem to be a good fit with an error message complaining about names being null.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

Maybe you are looking for