XML to SQL conversion using OracleXML putXML

Hi,
How many rowTag values can I use when I use OracleXML putXML ? I have an XML file in the following format.
I have to use "ABC" as rowTag. What Can I do with "GRANT_ROW" ? I have a table with
R_DATE and
GRANT columns
where GRANT is an object type with elements
NAME and ATYPE.
Thanks.
<?xml version = '1.0'?>
<EXCH>
<ABC num="1">
<R_DATE>5/21/2003 0:0:0</R_DATE>
<GRANT>
<GRANT_ROW num="1">
<NAME>GUNACAR</NAME>
<ATYPE>TE</ATYPE>
</GRANT_ROW>
<GRANT_ROW num="2">
<NAME>GUNACAR</NAME>
<TYPE>TE</TYPE>
</GRANT_ROW>
</GRANT>
</ABC>
</EXCH>
I get the following error when I run
java OracleXML putXML ....
oracle.xml.sql.OracleXMLSQLException: 'The XML element tag 'GRANT_ROW'
does not match the name of any of the columns/attributes of the
target database object.' encountered during processing ROW element 0.
Thanks....

RTF FormattingKit
http://www.schema.de/sitehtml/site-e/xmlnach0.htm

Similar Messages

  • 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 ?

  • 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

  • XML to database using OracleXML ...

    I am trying to insert xml file into CCX_persons table :
    I got the error message:
    C:\XML>java OracleXML putXML -user shrikant/akola@devdb -fileName xmlperson.xml
    "ccx_persons"
    oracle.xml.sql.OracleXMLSQLException: java.lang.ClassCastException: oracle.xml.p
    arser.v2.XMLPI
    at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:245)
    at OracleXML.Put_XML(OracleXML.java:352)
    at OracleXML.ExecutePutXML(Compiled Code)
    at OracleXML.Execute(OracleXML.java:164)
    at OracleXML.main(OracleXML.java:139)
    java.lang.ClassCastException: oracle.xml.parser.v2.XMLPI
    What could be wrong. Please help.
    Thanks
    Shri

    Do you have XML Processing instructions in the XML document that you're trying to insert?
    They'd look like:
    <?xxx ?>
    null

  • Building XPath with the XML having the Namespace using PL SQL

    While trying to build the path of each node, when the XML has no namespace in it , the below code works fine providing the result
    1~/
    2~/person/
    3~/person/age/
    4~/person/homecity/
    5~/person/name/
    6~/person/homecity/lat/
    7~/person/homecity/name/
    8~/person/homecity/long/
    But when the xml is changed to
    <person xmlns="urn:person" xmlns:lat="urn:lat">
    <name>Rob</name>
    <age>37</age>
    <homecity>
        <name>London</name>
        <lat>123.000</lat>
        <long>0.00</long>
    </homecity>
    </person>"
    The result on executing the below code is resulting into only into below result
    1~/
    2~/person/
    In the XML provided above, XML name space is not constant and it may vary for every XML. My requirement is to parse the complete XML, where i can read the XML with namespace and get the result as mentioned below
    1~/
    2~/person/
    3~/person/age/
    4~/person/homecity/
    5~/person/name/
    6~/person/homecity/lat:lat/
    7~/person/homecity/name/
    8~/person/homecity/long/
    Can you please help me resolving the issue mentioned. Thanks in advance. --Code Snippet below :
    DECLARE
      l_File VARCHAR2(32000) := '<person>
    <name>Rob</name>
    <age>37</age>
    <homecity>
        <name>London</name>
        <lat>123.000</lat>
        <long>0.00</long>
    </homecity>
    </person>';
    l_Where_Clause VARCHAR2(100) := '/*';
    l_Append_Var   VARCHAR2(100) := '/';
    TYPE Ty_Paths IS TABLE OF VARCHAR2(1000) INDEX BY PLS_INTEGER;
    l_Ty_Paths      Ty_Paths;
    l_Ty_Paths_Temp Ty_Paths;
    TYPE Ty_Verifier IS TABLE OF VARCHAR2(1000) INDEX BY VARCHAR2(1000);
    l_Ty_Varifier Ty_Verifier;
    l_Prev_Query_Rec VARCHAR2(100);
    l_Index_Num      NUMBER := 0;
    l_Cur_Exec_Row   NUMBER := 0;
    BEGIN
    l_Ty_Paths(Nvl(l_Ty_Paths.COUNT, 0) + 1) := l_Append_Var;
    l_Cur_Exec_Row := 1;
    --Dbms_Output.put_line('Before entering the loop');
    LOOP
       l_Ty_Paths_Temp.DELETE;
      SELECT DISTINCT REPLACE(l_Append_Var || '/' || t.Xml || '/', '//', '/') BULK COLLECT
       INTO   l_Ty_Paths_Temp
      FROM   (SELECT Xmltype(Extract(VALUE(e), '/').Getstringval()) .Getrootelement() AS Xml
               FROM   TABLE(Xmlsequence(Extract(Xmltype(l_File), l_Where_Clause))) e) t;
      l_Ty_Varifier(Nvl(l_Ty_Varifier.COUNT, 0) + 1) := l_Append_Var;
      --Dbms_Output.put_line('L_TY_PATHS_TEMP.Count::'||L_TY_PATHS_TEMP.Count);
      IF l_Ty_Paths_Temp.COUNT > 0 THEN
         l_Index_Num := Nvl(l_Ty_Paths.COUNT, 0) + 1;
         FOR i IN l_Ty_Paths_Temp.FIRST .. l_Ty_Paths_Temp.LAST LOOP
            l_Ty_Paths(l_Index_Num) := l_Ty_Paths_Temp(i);
            --Dbms_Output.put_line('L_INDEX_NUM::'||L_INDEX_NUM);
            --Dbms_Output.put_line('L_TY_PATHS(L_INDEX_NUM)::'||L_TY_PATHS(L_INDEX_NUM));
            l_Index_Num := l_Index_Num + 1;
         END LOOP;
      END IF;
      --Dbms_Output.put_line('L_TY_PATHS.Count::'||L_TY_PATHS.Count);
      --Dbms_Output.put_line('L_TY_PATHS.Count::'||L_CUR_EXEC_ROW);
      IF (NOT l_Ty_Paths.EXISTS(l_Cur_Exec_Row + 1)) OR (l_Cur_Exec_Row = l_Ty_Paths.COUNT) THEN
         --Dbms_Output.put_line('Exiting');
         EXIT;
      ELSE
         --Dbms_Output.put_line('Inside the Else part');
         l_Cur_Exec_Row := l_Cur_Exec_Row + 1;
         l_Append_Var   := l_Ty_Paths(l_Cur_Exec_Row);
         l_Where_Clause := l_Ty_Paths(l_Cur_Exec_Row) || '*';
      END IF;
      --To Display the record:
         --Dbms_Output.put_line(L_TY_PATHS.Count);
      END LOOP;
      IF l_Ty_Paths.COUNT > 0 THEN
        FOR i IN l_Ty_Paths.FIRST .. l_Ty_Paths.LAST LOOP
          Dbms_Output.Put_Line(i || ' record is ' || l_Ty_Paths(i));
       END LOOP;
    END IF;
    END;

    Hi,
    Thanks for the reply.
    Please find the details :
    1) What's your database version ?
    Database version  :
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    2) What's the practical use of extracting all the paths like this, what are you trying to achieve, besides a purely academic exercise ?
    The XML provided was for sample XML.
    The practical use being ,I wanted to parse the SEPA messages using the below code snippet dynamically.
    create table data_table (
         data xmltype
        xmltype column data store as securefile binary xml
    insert into data_table values (
        xmltype('<?xml version="1.0" encoding="UTF-8"?>
    <SCTScfBlkCredTrf xmlns="urn:S2SCTScf:xsd:$SCTScfBlkCredTrf">
      <SndgInst>CMCIFRPPXXX</SndgInst>
      <RcvgInst>RLBBAT2E083</RcvgInst>
      <FileRef>006FRID2516PH712</FileRef>
      <SrvcId>SCT</SrvcId>
      <TstCode>T</TstCode>
      <FType>SCF</FType>
      <FDtTm>2012-11-01T01:12:22</FDtTm>
      <NumCTBlk>1</NumCTBlk>
      <NumPCRBlk>0</NumPCRBlk>
      <NumRFRBlk>0</NumRFRBlk>
      <NumROIBlk>0</NumROIBlk>
    <FIToFICstmrCdtTrf xmlns="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.02">
      <GrpHdr>
        <MsgId>006MSID12511PH712</MsgId>
        <CreDtTm>2012-11-01T08:09:14</CreDtTm>
        <NbOfTxs>1</NbOfTxs>
        <TtlIntrBkSttlmAmt Ccy="EUR">20000</TtlIntrBkSttlmAmt>
        <IntrBkSttlmDt>2012-11-01</IntrBkSttlmDt>
        <SttlmInf>
          <SttlmMtd>INGA</SttlmMtd>
          <ClrSys>
            <Prtry></Prtry>
          </ClrSys>
        </SttlmInf>
        <InstgAgt>
          <FinInstnId>
            <BIC>RLBBAT2E083</BIC>
          </FinInstnId>
        </InstgAgt>
        <InstdAgt>
          <FinInstnId>
            <BIC>HELADEF1XXX</BIC>
          </FinInstnId>
        </InstdAgt>
      </GrpHdr>
      <CdtTrfTxInf>
        <PmtId>
          <EndToEndId>006SEOP23END1712</EndToEndId>
          <TxId>006SEOP231PH1712</TxId>
        </PmtId>
        <PmtTpInf>
          <SvcLvl>
            <Cd>SEPA</Cd>
          </SvcLvl>
        </PmtTpInf>
        <IntrBkSttlmAmt Ccy="EUR">20000</IntrBkSttlmAmt>
        <AccptncDtTm>2012-11-01T12:00:00</AccptncDtTm>
        <ChrgBr>SLEV</ChrgBr>
        <Dbtr>
          <Nm>Mrinmoy Sahu</Nm>
          <PstlAdr>
            <Ctry>FR</Ctry>     
            <AdrLine>6</AdrLine>
            <AdrLine>Bangalore</AdrLine>
          </PstlAdr>
          <Id>
            <PrvtId>
              <Othr>
                <Id>E20809</Id>
                <SchmeNm></SchmeNm>
                <Issr>ORACLE CORP</Issr>
              </Othr>
            </PrvtId>
          </Id>
        </Dbtr>
        <DbtrAcct>
          <Id>
            <IBAN>FR7030087330086000000000591</IBAN>
          </Id>
        </DbtrAcct>
        <DbtrAgt>
          <FinInstnId>
            <BIC>CMCIFRPPXXX</BIC>
          </FinInstnId>
        </DbtrAgt>
        <CdtrAgt>
          <FinInstnId>
            <BIC>RLBBAT2E083</BIC>
          </FinInstnId>
        </CdtrAgt>
        <Cdtr>
          <Nm>Mrinmoy Sahu</Nm>
          <PstlAdr>
            <Ctry>FR</Ctry>     
            <AdrLine>22 </AdrLine>
          </PstlAdr>
          <Id>
            <PrvtId>
              <Othr>
                <Id>F676869</Id>
                <SchmeNm></SchmeNm>
                <Issr>GOVT OF INDIA</Issr>
              </Othr>
            </PrvtId>
          </Id>
        </Cdtr>
        <CdtrAcct>
          <Id>
            <IBAN>FR7630087330086000000004266</IBAN>
          </Id>
        </CdtrAcct>
        <RmtInf>
            <Ustrd>abc</Ustrd>
          </RmtInf>
      </CdtTrfTxInf>   
      </FIToFICstmrCdtTrf>
    </SCTScfBlkCredTrf>
    alter session set nls_numeric_characters = ".,";
          SELECT Msgid, Msgid1, Sttlmmtd
       FROM   data_table t,Xmltable(Xmlnamespaces('urn:S2SCTScf:xsd:$SCTScfBlkCredTrf' AS "A", 'urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.02' AS "B")
                        ,'/A:SCTScfBlkCredTrf/B:FIToFICstmrCdtTrf' Passing t.data Columns
                        Msgid Path 'A:SndgInst'
                        ,Msgid1 Path 'B:GrpHdr/B:MsgId'
                        ,Sttlmmtd Path 'B:GrpHdr/B:SttlmInf/B:SttlmMtd');
    MSGID             ;MSGID1           ;STTLMMTD         ;
                     ;006MSID12511PH712;INGA             ;
    The idea was to :
    1). Map the Column Names for the XPath built using the previous code.
    2). Build the Select statement shown above dynamically based on the Xpath built in the previous code using a PLSQL block, and to process the data by doing a bulk collect on the XML.
    The above XML may contain multiple <FIToFICstmrCdtTrf></FIToFICstmrCdtTrf> nodes.
    Since the name space in the XML varies for each version of the SEPA messages , i need to get the names spaces ALSO to be picked up dynamically and parse the XML data based on the select statement as shown above.
    Could you please guide me with
    1). Is the approach taken appropriate?
    2). Any alternative approach should be looked for ?
    3). How to extract the name spaces available in the XML?
    Thanks.

  • OracleXML putXML error

    I upgraded the Oracle XML SQL Utility from 1.1.1 to 1.2 (and changed my ClassPath to use classes12.zip). When I run OracleXML putXML, rows are getting inserted into my table, but I'm getting the following error. Should I worry about it? I did not get this error message with XSU111. Thanks.
    ========================================
    E:\vj\Test>java OracleXML putXML -user scott/tiger -fileName test-out_MANUAL.xml
    t1
    A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)' has
    occurred in :
    'oracle/xml/sql/dml/OracleXMLSave.cleanLobList ()V': Interpreting method.
    Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cgi
    successfully inserted 3 rows into t1
    ========================================

    Please ignore this posting. My classpath was messed up. It's resolved.

  • Attach an xml to a pdf using ADS

    Hi all,
    I have a scenario where we are sending a Base64 encoded PDF (a bill) and the corresponding xml data from SAP backend on level 4.6C to PI 7.1. In PI we should attach the xml data to the PDF. I have already succeeded to do this using iText but we have a requirement to do this with ADS instead. In Netweaver Developer Studio I created an example project where I am reading a PDF as a byte array, also reading an XML file and try to attach the XML to the PDF using the ADS api. The project successfully built in NWDS but when I am running the project it failes.
    I am using standard code to attach the xml stream to the pdf, the error message is thrown when the following line is executed:
    IWDPDFDocument document = context.execute();
    Exception in thread "main" java.lang.ExceptionInInitializerError
         at com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.impl.PDFDocumentAccessibleContextWDImpl.execute(PDFDocumentAccessibleContextWDImpl.java:99)
         at com.eon.xi.dijnet.base64.PdfWithAttachment.addAttachmentWithSap(PdfWithAttachment.java:129)
         at com.eon.xi.dijnet.base64.PdfWithAttachment.main(PdfWithAttachment.java:218)
    Caused by: java.lang.NullPointerException
         at com.sap.tc.webdynpro.services.sal.deployment.core.DeployableObjectInternal.getSystemDeployableObjectName(DeployableObjectInternal.java:53)
         at com.sap.tc.webdynpro.clientserver.uielib.adobe.impl.AdobeFormHelper.<clinit>(AdobeFormHelper.java:115)
         ... 3 more
    Is it the problem with the PDF that it is not an Interactive Form?
    Or the problem is simply that I am trying to run the project on my local machine where ADS is not available?
    Thanks for your help.
    Pal
    Edited by: Pal Somogyi on Oct 17, 2010 10:30 PM
    Edited by: Pal Somogyi on Oct 18, 2010 11:44 AM

    Hi Pal,
    There is a requirement to generate an Adobe Form using SAP Interactive forms, and then, send this PDF to a non-SAP system using Base-64 encoding. The receiving system will decode this file and re-generate a PDF.
    I have heard that this could be done in the PI layer, using the Conversion Agent.
    Another approach which I can think of is convert PDF to binary and then use the cl_http_utility=>encode_base64 to convert binary to base64.
    You have mentioned that you have had to send a base 64 encoded pdf. Could you pelase guide me through the process?
    Thanks,
    Preethi.

  • When Deploying SSIS Packages to SQL Server using SSMS Import feature, is the package configuration file deployed at the same time?

    Hello, everyone,
    I have an SSIS package with a XML package configuration file. I deployed it to the sql server using the import feature in SSMS (in Stored Packages, right click MSDB, select Import, select the package to deploy in file system). My question is 
    Is the XML package configuration file also deployed? If so, which folder is it stored so that I can change the values in it? If not, is setting up the Configuration tab when scheduling a agent job the way to go manually bring the configuration file in?
    Your help and information is much appreciated.
    Regards

    Thank you Arthur for your reply. I appreciate it.
    A followup questions:
    I used direct setting for the configuration file path on C:\. But it needs to be on D:\ on the remote server. I can't create the D:\ path because I don't have D:\ drive on my computer (I understand I could use indirect setting to change the path in the remote
    server. But that's not the concern here).
    My question is:  since the configuration is not deployed, can I make it up by setting up the Configurations in creating the agent job step? That is, copy the configuration file to the D:\ drive on the remote server, in Configurations tab, add the configuration
    file on D:\ to the configuration. Will it work? Will the package still look for the original config file on C:\?  and if it doesn't find it there, will it cause any error?
    Thank you in advance for your help.
    Regards

  • 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>

  • VIEW XML IN SQL*PLUS

    how can we view xml on sql*plus?
    when xmltype is viewed on sql*prompt it shows incomplete xml.
    example:
    SQL> select xmlelement("ROOT",xmlforest(1 as A, 2 as B, 3 as C)) from dual;
    XMLELEMENT("ROOT",XMLFOREST(1ASA,2ASB,3ASC))
    <ROOT>
    <A>1</A>
    <B>2</B>
    <C>3</C>
    </ROOT>
    but i generate an xml from table so it becomes quite huge. say a forest is populated with 6-8 tags. it shows broken output.
    SQL> /
    ID LIST
    <DEPT>
    <EMPLOYEE>
    <ID>2109</ID>
    <ID>3108</ID>
    <ID>4107</ID>
    <ID>5106</ID>
    <ID
    i have tried increasing bufferwidth and bufferlength tp max value (1000 and 2000 respectively) eventhen it displays the output as shown above.
    how can i view my xml?

    use this sql plus command:
    set long 2000000
    You can increase\decrease the value as required.

  • Xml  with sql loader

    Hi,
    i tried to load the xml datas into database using sql loader.
    CREATE DIRECTORY xml_dir AS '/:';
    GRANT READ ON DIRECTORY xml_dir TO wiki;
    xml.ctl
    OPTIONS (ERRORS=100, SILENT=(FEEDBACK))
    LOAD DATA
    INFILE 'emp.xml'
    APPEND
    INTO TABLE emp
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    (empno,ename,job,mgr,hiredate,sal,comm,deptno)
    *emp.xml*
    <name>
    <empno>1</empno>
    <ename>1</ename>
    <job>1</job>
    <mgr>1</mgr>
    <hiredate></hiredate>
    <sal>1</sal>
    <comm>1</comm>
    <deptno>1</deptno>
    </name>
    i got the following errors in log
    Record 1: Rejected - Error on table EMP, column ENAME.
    Column not found before end of logical record (use TRAILING NULLCOLS)
    Record 2: Rejected - Error on table EMP, column ENAME.
    how to the sql*loader identify seperator in xml file.
    please help me out that.

    Hi,
    i tried to load the xml datas into database using sql loader.
    CREATE DIRECTORY xml_dir AS '/:';
    GRANT READ ON DIRECTORY xml_dir TO wiki;
    xml.ctl
    OPTIONS (ERRORS=100, SILENT=(FEEDBACK))
    LOAD DATA
    INFILE 'emp.xml'
    APPEND
    INTO TABLE emp
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    (empno,ename,job,mgr,hiredate,sal,comm,deptno)
    *emp.xml*
    <name>
    <empno>1</empno>
    <ename>1</ename>
    <job>1</job>
    <mgr>1</mgr>
    <hiredate></hiredate>
    <sal>1</sal>
    <comm>1</comm>
    <deptno>1</deptno>
    </name>
    i got the following errors in log
    Record 1: Rejected - Error on table EMP, column ENAME.
    Column not found before end of logical record (use TRAILING NULLCOLS)
    Record 2: Rejected - Error on table EMP, column ENAME.
    how to the sql*loader identify seperator in xml file.
    please help me out that.

  • Import HL7 data in sql server using ssis

    Could I know how to import HL7 data in sql server using ssis.
    I am not aware of any .NET code.
    Could someone provide me with any kind of custom code so I can try to understand and use it to my specifications.
    Thanks
    Latha

    As COZYROC said, HL7 is a type of EDI file. There is nothing built into SQL Server to handle this type of parsing.  You will either need to buy something or write your own, which I do not recommend because it is much more difficult than you imagine.
    You can use BizTalk to parse the data into an XML format which can then be processed by SQL Server.
    http://msdn.microsoft.com/en-us/library/bb981217(v=bts.10).aspx

  • 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?

  • Generating XML from SQL queries and saving to an xml file?

    Hi there,
    I was wondering if somebody could help with regards to the following:
    Generating XML from SQL queries and saving to a xml file?
    We want to have a procedure(PL/SQL) that accepts an order number as an input parameter(the procedure
    is accessed by our software on the client machine).
    Using this order number we do a couple of SQL queries.
    My first question: What would be our best option to convert the result of the
    queries to xml?
    Second Question: Once the XML has been generated, how do we save that XML to a file?
    (The XML file is going to be saved on the file system of the server that
    the database is running on.)
    Now our procedure will also have a output parameter which returns the filename to us. eg. Order1001.xml
    Our software on the client machine will then ftp this XML file(based on the output parameter[filename]) to
    the client hard drive.
    Any information would be greatly appreciated.
    Thanking you,
    Francois

    If you are using 9iR2 you do not need to do any of this..
    You can create an XML as an XMLType using the new SQL/XML operators. You can insert this XML into the XML DB repository using DBMS_XDB.createResource. You can then access the document from the resource. You can also return the XMLType containing the XML directly from the PL/SQL Procedure.

  • Generating XML from SQL queries and saving to a xml file?

    Hi there,
    I was wondering if somebody could help with regards to the following:
    Generating XML from SQL queries and saving to a xml file?
    We want to have a stored procedure(PL/SQL) that accepts an order number as an input parameter(the procedure
    is accessed by our software on the client machine).
    Using this order number we do a couple of SQL queries.
    My first question: What would be our best option to convert the result of the
    queries to xml?
    Second Question: Once the XML has been generated, how do we save that XML to a file?
    (The XML file is going to be saved on the file system of the server that
    the database is running on.)
    Now our procedure will also have a output parameter which returns the filename to us. eg. Order1001.xml
    Our software on the client machine will then ftp this XML file(based on the output parameter[filename]) to
    the client hard drive.
    Any information would be greatly appreciated.
    Thanking you,
    Francois

    Hi
    Here is an example of some code that i am using on Oracle 817.
    The create_file procedure is the one that creates the file.
    The orher procedures are utility procedures that can be used with any XML file.
    PROCEDURE create_file_with_root(po_xmldoc OUT xmldom.DOMDocument,
    pi_root_tag IN VARCHAR2,
                                            po_root_element OUT xmldom.domelement,
                                            po_root_node OUT xmldom.domnode,
                                            pi_doctype_url IN VARCHAR2) IS
    xmldoc xmldom.DOMDocument;
    root xmldom.domnode;
    root_node xmldom.domnode;
    root_element xmldom.domelement;
    record_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    xmldom.setDoctype(xmldoc, pi_root_tag, pi_doctype_url,'');
    -- Create the root --
    root := xmldom.makeNode(xmldoc);
    -- Create the root element in the file --
    create_element_and_append(xmldoc, pi_root_tag, root, root_element, root_node);
    po_xmldoc := xmldoc;
    po_root_node := root_node;
    po_root_element := root_element;
    END create_file_with_root;
    PROCEDURE create_element_and_append(pi_xmldoc IN OUT xmldom.DOMDocument,
    pi_element_name IN VARCHAR2,
                                            pi_parent_node IN xmldom.domnode,
                                            po_new_element OUT xmldom.domelement,
                                            po_new_node OUT xmldom.domnode) IS
    element xmldom.domelement;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    element := xmldom.createElement(pi_xmldoc, pi_element_name);
    child_node := xmldom.makeNode(element);
    -- Append the new node to the parent --
    newelenode := xmldom.appendchild(pi_parent_node, child_node);
    po_new_node := child_node;
    po_new_element := element;
    END create_element_and_append;
    FUNCTION create_text_element(pio_xmldoc IN OUT xmldom.DOMDocument, pi_element_name IN VARCHAR2,
    pi_element_data IN VARCHAR2, pi_parent_node IN xmldom.domnode) RETURN xmldom.domnode IS
    parent_node xmldom.domnode;                                   
    child_node xmldom.domnode;
    child_element xmldom.domelement;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    create_element_and_append(pio_xmldoc, pi_element_name, pi_parent_node, child_element, child_node);
    parent_node := child_node;
    -- Create a text node --
    textele := xmldom.createTextNode(pio_xmldoc, pi_element_data);
    child_node := xmldom.makeNode(textele);
    -- Link the text node to the new node --
    compnode := xmldom.appendChild(parent_node, child_node);
    RETURN newelenode;
    END create_text_element;
    PROCEDURE create_file IS
    xmldoc xmldom.DOMDocument;
    root_node xmldom.domnode;
    xml_doctype xmldom.DOMDocumentType;
    root_element xmldom.domelement;
    record_element xmldom.domelement;
    record_node xmldom.domnode;
    parent_node xmldom.domnode;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    create_file_with_root(xmldoc, 'root', root_element, root_node, 'test.dtd');
    xmldom.setAttribute(root_element, 'interface_type', 'EXCHANGE_RATES');
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mr', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'Joe', record_node);
    parent_node := create_text_element(xmldoc,'surname', 'Blogs', record_node);
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mrs', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'A', record_node);
    parent_node := create_text_element(xmldoc, 'surname', 'B', record_node);
    -- write the newly created dom document into the buffer assuming it is less than 32K
    xmldom.writeTofile(xmldoc, 'c:\laiki\willow_data\test.xml');
    EXCEPTION
    WHEN xmldom.INDEX_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Index Size error');
    WHEN xmldom.DOMSTRING_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'String Size error');
    WHEN xmldom.HIERARCHY_REQUEST_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Hierarchy request error');
    WHEN xmldom.WRONG_DOCUMENT_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Wrong doc error');
    WHEN xmldom.INVALID_CHARACTER_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Invalid Char error');
    WHEN xmldom.NO_DATA_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Nod data allowed error');
    WHEN xmldom.NO_MODIFICATION_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'No mod allowed error');
    WHEN xmldom.NOT_FOUND_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not found error');
    WHEN xmldom.NOT_SUPPORTED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not supported error');
    WHEN xmldom.INUSE_ATTRIBUTE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'In use attr error');
    WHEN OTHERS THEN
    dbms_output.put_line('exception occured' || SQLCODE || SUBSTR(SQLERRM, 1, 100));
    END create_file;

Maybe you are looking for

  • How can I Control ITunes on my Desktop from my Laptop without Express???

    i have a g4 powerbook with airport card and a brand new imac. i have bose speakers (companion 5). they use a usb connection. bose and apple employees have suggested that the audio quality will decrease drastically if i used an adaptor to connect the

  • Download data into a pipe delimited file

    I want to download data from an internal table into a pipe delimited file. I plan to use FM: SAP_CONVERT_TO_TEX_FORMAT but the system I am working on is BW 3.1. This FM does not exists in BW 3.1 How can I download data from an internal table into a p

  • HELP! my iPhone 3gs has deleted all my texts!

    Does anyone know if it's possible to retrieve any text messages after a sync with iTunes? My battery went flat, plugged it into my laptop so a sync has occurred & when I looked every single message had gone. Is there any way to restore them? Please?

  • Apple Mobile Device Service started then stopped

    AMDS will not run !Error The AMD Service on Local Computer started then stopped. Some stop automatically if they are not in use by other services or programs.  This came with 10.2 errors. I uninstalled iTunes 10.2 and installed 10.1.2.17 still have s

  • Invalid Directory when importing pictures from my camera chip

    I get the following error message "The directory name is invalid" when trying to import pictures from my camera chip