Parsing to XML

Hello everybody.
I'm trying to make an XMLDocument from a String with the next context I have read from a file:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE ReporteHoras SYSTEM "ReporteHoras.dtd"><ReporteHoras><Persona nombre="Daniel"><Fecha dia="1/11/2004"><Proyecto cod="001"><Tarea nombre="x"><Horas>8</Horas></Tarea><Tarea nombre="y"><Horas>5</Horas></Tarea></Proyecto></Fecha><Fecha dia="2/11/2004"><Proyecto cod="010"><Tarea nombre="z"><Horas>8</Horas></Tarea></Proyecto></Fecha></Persona></ReporteHoras>
This is the code used for creating the Document:
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
CharArrayReader characterStream = new CharArrayReader(xmlstring.toCharArray());
InputSource is = new InputSource(characterStream);
Document documentXML = documentBuilder.parse(is);
where xmlstring is the string with the xml content showed above.
I have the following exception when doing the parse:
org.xml.sax.SAXParseException: Content is not allowed in trailing section.
I look for spaces in the text and there aren't any. I think the xml is well formed because I can see it weel with a web browser. Also I have the dtd in the correct path.
I hope you can help me.
Thanks a lot.

Also I have the dtd in the correct path.What does this mean? Your XML does not come from a file; your DTD is declared via a path relative to the XML's path. There is no "correct path" for the DTD in this case.
You could add this line of code:is.setSystemId("a URI relative to which your DTD should be located")to fix that problem. (Put the real URI in there, not that string.) That may or may not make the error go away, XML parsers do not always give helpful error messages.
(And why didn't you just use a StringReader, instead of the more complex thing you did?)

Similar Messages

  • Parsing an xml output of a ws-client using JDOM

    how do i use jdom to parse an output from a web service client,
    ive been using JDev. 10g, was able to create a web service client to consume and return the output in the form of an xml.
    i want to be able to parse the xml doc into variables such that i can insert them into the database.
    is it possible to parse without saving it?
    cheers,
    Shivek Sachdev

    how do i use jdom to parse an output from a web service client,
    ive been using JDev. 10g, was able to create a web service client to consume and return the output in the form of an xml.
    i want to be able to parse the xml doc into variables such that i can insert them into the database.
    is it possible to parse without saving it?
    cheers,
    Shivek Sachdev

  • "Error while parsing SOAP XML payload: no element found" received when invoking Web Service

    Running PB 12.1 Build 7000.  Using Easysoap.  Error ""Error while parsing SOAP XML payload: no element found" received when invoking Web Service".  This error does not appear to be coming from the application code.  Noticed that there were some erroneous characters showing up within the header portion of the XML ("&Quot;").  Not sure where these are coming from.  When I do a find within the PB code for ""&quot;" it gets located within two objects, whereas they both reference a "temp_xml_letter".  Not sure where or what temp_xml_letter resides???   The developer of this is no longer with us and my exposure to WSDL and Web Services is rather limited.  Need to get this resolved...please.
    This is the result of the search.  Notice the extraneous characters ("&quot;"):
    dar1main.pbl(d_as400_mq_xml)
    darlettr.pbl(d_email_xml)
    ---------- Search: Searching Target darwin for 'temp_xml'    (9:52:41 AM)
    ---------- 2 Matches Found On "temp_xml":
    dar1main.pbl(d_as400_mq_xml).d_as400_mq_xml:  export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0  template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> number </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
    darlettr.pbl(d_email_xml).d_email_xml:  export.xml(usetemplate="temp_xml_letter" headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0  template=(comment="" encoding="UTF-8" name="temp_xml_letter" xml="<?xml version=~"1.0~" encoding=~"UTF-16LE~" standalone=~"yes~"?><EmailServiceTransaction xmlns=~"http://xml.xxnamespace.com/Utility/Email/EmailService" ~" xmlns:imc=~"http://xml.xxnamespace.com/IMC~" xmlns:xsi=~"http://www.w3.org/2001/XMLSchema-instance~" xmlns:root=~"http://xml.xxnamespace.com/RootTypes~" xmlns:email=~"http://xml.xxnamespace.com/Utility/Email~" xsi:schemaLocation=~"http://xml.xxnamespace.com/Utility/Email/EmailService http://dev.xxnamespace.com/Utility/Email/EmailService/V10-TRX-EmailService.xsd~"><EmailServiceInformation><EmailServiceDetail __pbband=~"detail~"><ApplicationIdentifier> applicationidentifier </ApplicationIdentifier><AddresseeInformation><AddresseeDetail><Number> imcnumber </Number></AddresseeDetail></AddresseeInformation><EmailMessageInformation><Ema
    ---------- Done 2 Matches Found On "temp_xml":
    ---------- Finished Searching Target darwin for 'temp_xml'    (9:52:41 AM)

    Maybe "extraneous" is an incorrect term.  Apparantly, based upon the writeup within Wiki, the parser I am using does not interpret the "&quot;"?  How do I find which parser is being utilized and how to control it?
    <<<
    If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.
    If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset.
    >>>

  • Unable to display tree view; Error when parsing an XML document (Premature end of file.)

    Hi folks,
    I am using a cascaded mapping in my OM. I have a graphical mapping followed by the Java mapping. It is a flat file to IDOC mapping. Everything works fine in Dev but when I transport the same objects to QA, the Operation mapping though it doesn't fail in ESR testing tool, gives the following message and there is no output generated for the same payload which is successfully tested in DEV. Please advise on what could be the possible reasons.
    Unable to display tree view; Error when parsing an XML document (Premature end of file.)

    kalyan,
    There seems to be an invalid xml payload which causes this error in ESR not generating the tree view. Please find the similar error screenshot and rectify the payload.
    Mutti

  • Parsing an xml document inside a Thread

    Hi Friends
    I have to do some processing in my application for which i need to use multithreading.
    Inside every new thread created i have to parse an xml document using s parsing tool like castor or jibx.
    My question is that is it possible to parse a xml document inside a new thread everytime it gets created.
    is it a good coding practice as it involves java code to do it.
    Thanks
    Vikeng

    vikeng wrote:
    Hi
    Thanks for the reply.
    Well i need to do some kind of a batch processing in my application.
    I need to parse an xml document and upload the data i get after parsing into columns in the database.
    Since its a batch what i was asking was is it possible to do it for every request as batch needs to handle hundreds of records during the daily or nightly sync.
    Is it a good practice to do parsing for every record in a batch
    Thanks
    VikengI don't get it. One batch is one document, and that document contains e.g. 100 records? What's one request? A request for one batch? I would execute one batch in one thread.
    Kaj

  • Parseing an XML Document as a String

    Hi all,
    i am trying to parse an XML document to a parser. I get the file as a request parameter, which is filled in to at String variable.
    But for some reason i get an SAXException, does anyone se the problem?
    Thank you for your help...
    Below is the code
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.text.*;
    import java.net.*;
    import java.net.URL;
    import java.sql.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import javax.xml.parsers.*;
    import javax.xml.transform.stream.StreamSource;
    public class StartServlet extends HttpServlet
    private boolean debug = true;
    private final static String CONTENT = "content";
    private final static String COOKIES = "cookies";
    String resp = new String();
    private static String NODE_TYPES[] = new String[] {
         "ELEMENT",
         "ATTRIBUTE",
         "TEXT",
         "CDATA_SECTION",
         "ENTITY_REFERENCE",
         "ENTITY",
         "PROCESSING_INSTRUCTION",
         "COMMENT",
         "DOCUMENT",
         "DOCUMENT_TYPE",
         "DOCUMENT_FRAGMENT",
         "NOTATION" };
    public static void println(String s, int indent) {
         for(int i = 0 ; i < indent; i++) {
                   System.out.println(" ");
         System.out.println(s);
    public static void println(String s) {
         System.out.println(s);
    public static void print(Node node){
         printImpl(node, 0);
    public static void printImpl(Node node, int indent){
         if(node == null) {
              return;
         String nodeType = NODE_TYPES[node.getNodeType()];
         String nodeName = node.getNodeName();
         String nodeValue = node.getNodeValue();
         if(nodeValue != null) {
              nodeValue = nodeValue.trim();
         if(nodeType.equals("TEXT") && nodeValue.equals("")) {
              ; //Ignore emty node
         else {
              println(nodeType + " - " + nodeName + " - " + nodeValue, indent);
         NamedNodeMap attributes = node.getAttributes();
         if (attributes != null) {
              for(int i = 0; i < attributes.getLength(); i++) {
                   printImpl(attributes.item(i), indent + 1);
         NodeList children = node.getChildNodes();
         if(children != null) {
              for(int i = 0; i < children.getLength(); i++){
                   printImpl(children.item(i), indent + 1);
    public static DocumentBuilder newBuilder(boolean validation)
                        throws ParserConfigurationException {
         DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
         domFactory.setValidating(validation);
         domFactory.setNamespaceAware(true);
         DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
         //domBuilder.setErrorHandler(new PrintErrorHandler());
         return domBuilder;
    public static Document newDocument()
                        throws ParserConfigurationException{
         DocumentBuilder domBuilder = newBuilder(false);
         Document document = domBuilder.newDocument();
         return document;
    public static Document parse( String xml, boolean validation)
                        throws ParserConfigurationException, IOException, SAXException {
              DocumentBuilder domBuilder = newBuilder(validation);
              Document document = domBuilder.parse(xml);
              return document;
    public void init() {
    public void service( javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) {
              String[] cookies = null;
              try{
                   Hashtable document = getDocument("http://.../first.xml", cookies);
                   resp = (String) document.get(CONTENT);
                   debug(resp);
                   print(parse(resp, false));
              catch (SAXParseException e){
                   System.out.println("Saxfejl");
                   //System.exit(1);
              catch (Exception e){
                   e.printStackTrace();
                   System.exit(1);
    public void debug(String msg) {
         if(debug) {
              System.out.println(msg);
    public void performTask(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) {
         try
              // Insert user code from here.
         catch(Throwable theException)
              // uncomment the following line when unexpected exceptions
              // are occuring to aid in debugging the problem.
              //theException.printStackTrace();
    public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
         performTask(request, response);
    public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException {
         performTask(request, response);
    private Hashtable getDocument(String urlCode, String[] oldCookies) {
         Hashtable document = new Hashtable();
         HttpURLConnection http = null;
         try {
              URL httpURL = new URL(urlCode);
              // If HTTP Protocol, then open connection using the Request method indicated
              URLConnection conn = httpURL.openConnection();
              http = (HttpURLConnection) conn;
              //http.setRequestMethod("GET");
              http.setDoInput(true);
              http.setDoOutput(true);
              http.setUseCaches(false);
              http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
              if (oldCookies != null) {
                   for (int j = 0; j < oldCookies.length; j++) {
                        String cookie = oldCookies[j];
                        http.setRequestProperty("Cookie", cookie);
              http.connect();
              http.getContent();
              StringBuffer tsb = new StringBuffer("");
              if (http.getResponseCode() == 200) {
                   InputStream cis = http.getInputStream();
                   byte[] a = new byte[1024];
                   int n = cis.read(a);
                   while (n >= 0) {
                        tsb.append(new String(a, 0, n));
                        n = cis.read(a);
                   cis.close();
                   document.put(CONTENT, tsb.toString());
              String[] cookies = null;
              if (cookies == null) {
                   int headerFieldIndex = 0;
                   String headerFieldValue = http.getHeaderField(headerFieldIndex);
                   Vector cookieValues = new Vector();
                   while (headerFieldValue != null) {
                        String headerFieldName = http.getHeaderFieldKey(headerFieldIndex);
                        if ((headerFieldName != null) && headerFieldName.toLowerCase().equals("set-cookie")) {
                             int index = headerFieldValue.indexOf(";");
                             if (index > -1) {
                                  headerFieldValue = headerFieldValue.substring(0, index);
                             cookieValues.addElement(headerFieldValue);
                        headerFieldValue = http.getHeaderField(++headerFieldIndex);
                   cookies = new String[cookieValues.size()];
                   cookieValues.copyInto(cookies);
              document.put(COOKIES, cookies);
         catch (Exception e) {
              debug("url problem" + e);
         finally {
              if (http != null) {
                   http.disconnect();
         return document;
    }

    Hi,
    Use this code it will helpful to you.
    resultXMLDocument=(XmlDocument)documentDoc;
    StringWriter sw = new StringWriter();
    resultXMLDocument.write((Writer) sw);
    xmlString=sw.toString();
    thnaks,
    suneel

  • Can someone help me with a problem of parsing an XML file?

    Hello,
    I'm having some problems parsing an xml file. I get a SAXNotSupportedException when setting a property value.
    Here is the piece of code where I have the problem:
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespaceAware(true);
    SAXParser saxParser = spf.newSAXParser();
    XMLReader xmlReader = saxParser.getXMLReader();
    DefaultHandler defHandler = new DefaultHandler();
    xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", defHandler);
    and the log is:
    Problem with the parser org.xml.sax.SAXNotSupportedException: PAR012 For propertyID "http://xml.org/sax/properties/lexical-handler", the value "org.xml.sax.helpers.DefaultHandler@4ff4f74a" cannot be cast to LexicalHandler.
    http://xml.org/sax/properties/lexical-handler org.xml.sax.helpers.DefaultHandler@4ff4f74a LexicalHandler
    I've been working on this problem but I can't find the error.
    Does anyone have an idea of what to do to solve it?
    Thanx in advance,
    M@G

    before deciding which XML technology to use, you should see if your application fit in the category below:
    use SAX:
    1. The XML file is rather large (30 or 40+ MB)
    2. I don't need the xml document in memory. I will parse the document and store the data in my own object.
    use DOM or JDOM
    1. The XML file is relatively small (less than 30 MB) or I can increase the runtime memory for larger xml file.
    2. I will need to walk up and down the xml document tree severals time.
    3. My application is in Java and it's not going to be rewritten in C++, etc (use JDOM)
    NOTE:
    JDOM is rather easier to use (for Java developer), but it's not an www.org.com standardlized xml parser.
    personally, i like JDOM for traversing the DOM.

  • Parsing of xml file in oracle stored procedure on linux server

    We have an XML file in the "/database/stats/dev/xml1/" path and tried to parse the file using the below code :
    p := xmlparser.newParser;
    xmlparser.setValidationMode(p, FALSE);
    -- xmlparser.setErrorLog(p, errfile);
    xmlparser.setBaseDir(p, dir);
    xmlparser.parse(p, inpfile);
    doc := xmlparser.getDocument(p);
    xmlparser.freeParser(p);
    The above procedure is throwing below mentioned exception at "xmlparser.parse(p, inpfile);".
    SQLCODE: ORA-31001
    SQLERRM: ORA-31001: Invalid resource handle or path name "/xml1.dtd"
    The xml file contains the following line, which is giving an error, while parsing the xml file.
    <!DOCTYPE CCIOrder SYSTEM "xml1.dtd">
    Directory Structure:
    OWNER DIRECTORY_NAME DIRECTORY_PATH
    SYS XML1 /database/stats/dev/xml1

    you'll need to use server-side code to check the xml file names in that folder, return that list to flash and display the list to the user.
    or, if you can get by presenting a hard-coded list of xml files, you won't need any server-side coding.

  • Parse a xml file from clob column.

    Dear,
    i have been suffreing a problem about xml.
    i have a table with two columns, one is bfile data type other is clob data type. A xml data is stored into both cloumns
    as clob and bfile. My xml data format is correct.
    when i took xml data from bfile column, then dbms_xmlparser.parseClob successfully parse my xml data.
    Code below:
    =======================================
    dbms_lob.createtemporary(l_clob, cache=>FALSE);
    dbms_lob.loadFromFile(dest_lob => l_clob,
    src_lob => l_bfile,
    amount => dbms_lob.getLength(l_bfile));
    l_parser := dbms_xmlparser.newParser;
    dbms_xmlparser.parseClob(l_parser, l_clob); ========================================
    But when i took xml data form clob clumn directly, then dbms_xmlparser.parseClob parse failed and go to exception.
    Code below:
    ====================================================================
    dbms_lob.createtemporary(l_clob, cache=>FALSE);
    select xml_cfile,xml_bfile                    
    into l_clob ,l_bfile
    from xml_load_in
    l_parser := dbms_xmlparser.newParser;
    dbms_xmlparser.parseClob(l_parser, l_clob); --failed parse    
    ====================================================================
    declare
    l_bfile BFILE;
    l_clob CLOB;
    l_parser dbms_xmlparser.Parser;
    l_doc dbms_xmldom.DOMDocument;
    begin
    dbms_lob.createtemporary(l_clob, cache=>FALSE);
    select xml_cfile,xml_bfile
    into l_clob ,l_bfile
    from xml_load_in
    l_parser := dbms_xmlparser.newParser;
    dbms_xmlparser.parseClob(l_parser, l_clob);
    l_doc := dbms_xmlparser.getDocument(l_parser);
    dbms_lob.freetemporary(l_clob);
    dbms_xmlparser.freeParser(l_parser);
    exception
    dbms_lob.freetemporary(l_clob);
    dbms_xmlparser.freeParser(l_parser);
    dbms_xmldom.freeDocument(l_doc);
    End;
    Example:
    ======--File_name := Outward.xml;
    CREATE OR REPLACE DIRECTORY
    MY_INWARD AS
    'D:\PBM\Inward\';
    CREATE TABLE XML_LOAD_IN
    ( XML_CFILE CLOB,
    XML_BFILE BFILE
    INSERT INTO XML_LOAD_IN ( XML_CFILE, XML_BFILE )
    VALUES (
    '<?xml version="1.0" encoding="UTF-8"?>
    <BACPSInterface>
    <OCE>
    <EHR>
    <StandardLevel>03</StandardLevel>
    <TestFiledIndicator>T</TestFiledIndicator>
    <ImmediateDestRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </ImmediateDestRoutingNumber>
    <ImmediateOriginRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </ImmediateOriginRoutingNumber>
    <FileCreationDate>20090714</FileCreationDate>
    <FileCreationTime>1047</FileCreationTime>
    <ResendIndicator>N</ResendIndicator>
    <ECESettlementDate>20090714</ECESettlementDate>
    <ECESessionTime>1047</ECESessionTime>
    <ECESettlementTime>1047</ECESettlementTime>
    <ECEtype>01</ECEtype>
    <CountryCode>BD</CountryCode>
    </EHR>
    <Collection>
    <CHR>
    <CashLetterBusinessDate>20090714</CashLetterBusinessDate>
    <CashLetterCreationDate>20090714</CashLetterCreationDate>
    <CashLetterCreationTime>1047</CashLetterCreationTime>
    <CashLetterRecordTypeInd>I</CashLetterRecordTypeInd>
    <CashLetterDocTypeIndicator>G</CashLetterDocTypeIndicator>
    <CashLetterID>1</CashLetterID>
    <OriginatorContactName>Bank Asia</OriginatorContactName>
    <OriginatorContactPhoneNumber>XXX</OriginatorContactPhoneNumber>
    </CHR>
    <ForwardBundle>
    <BHR>
    <CollectionTypeIndicator>I</CollectionTypeIndicator>
    <DestRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </DestRoutingNumber>
    <ECEInstitutionRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </ECEInstitutionRoutingNumber>
    <BundleBusinessDate>20090714</BundleBusinessDate>
    <BundleCreationDate>20090714</BundleCreationDate>
    <BundleID>1</BundleID>
    <ReturnLocationRoutingNumber>070127538</ReturnLocationRoutingNumber>
    </BHR>
    <CDR>
    <CDR num="1">
    <ECESettlementDate>20090714</ECESettlementDate>
    <ECESessionTime>1047</ECESessionTime>
    <ECESettlementTime>1047</ECESettlementTime>
    <ECEItemType>N</ECEItemType>
    <IssuingBranchRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </IssuingBranchRoutingNumber>
    <AccountNumber>0000334008221</AccountNumber>
    <ChequeSequenceNumber>1601735</ChequeSequenceNumber>
    <ItemAmount>500</ItemAmount>
    <ECEInstitutionItemSequencNum>0701275380000001</ECEInstitutionItemSequencNum>
    <DocumentationTypeIndicator>I</DocumentationTypeIndicator>
    <ReturnAcceptanceIndicator>6</ReturnAcceptanceIndicator>
    <MICRValidIndicator>1</MICRValidIndicator>
    <BOFDIndicator>Y</BOFDIndicator>
    <ChequeDetailRecAddendumCount>0</ChequeDetailRecAddendumCount>
    <CorrectionIndicator>0</CorrectionIndicator>
    <RepresentmentIndicator>0</RepresentmentIndicator>
    <ArchiveTypeIndicator>F</ArchiveTypeIndicator>
    </CDR>
    <CDR num="2">
    <ECESettlementDate>20090714</ECESettlementDate>
    <ECESessionTime>1047</ECESessionTime>
    <ECESettlementTime>1047</ECESettlementTime>
    <ECEItemType>N</ECEItemType>
    <IssuingBranchRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </IssuingBranchRoutingNumber>
    <AccountNumber>0000345682256</AccountNumber>
    <ChequeSequenceNumber>1234567</ChequeSequenceNumber>
    <ItemAmount>1000</ItemAmount>
    <ECEInstitutionItemSequencNum>0701275380000002</ECEInstitutionItemSequencNum>
    <DocumentationTypeIndicator>I</DocumentationTypeIndicator>
    <ReturnAcceptanceIndicator>6</ReturnAcceptanceIndicator>
    <MICRValidIndicator>1</MICRValidIndicator>
    <BOFDIndicator>Y</BOFDIndicator>
    <ChequeDetailRecAddendumCount>0</ChequeDetailRecAddendumCount>
    <CorrectionIndicator>0</CorrectionIndicator>
    <RepresentmentIndicator>0</RepresentmentIndicator>
    <ArchiveTypeIndicator>F</ArchiveTypeIndicator>
    </CDR>
    </CDR>
    <CDA>
    <CDA num="1">
    <AddendumRecordNumber>1</AddendumRecordNumber>
    <BOFDRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>75</DistrictCode>
    <BranchCode>12</BranchCode>
    <CheckDigit>8</CheckDigit>
    </BOFDRoutingNumber>
    <BOFDBusinessEndorsementDate>20090714</BOFDBusinessEndorsementDate>
    <BOFDDepositAccountNumber>0000334008221</BOFDDepositAccountNumber>
    <BOFDDepositBranch>753</BOFDDepositBranch>
    <PayeeName>XXX</PayeeName>
    <TruncationIndicator>Y</TruncationIndicator>
    <BOFDConversionIndicator>2</BOFDConversionIndicator>
    <BOFDCorrectionIndicator>0</BOFDCorrectionIndicator>
    </CDA>
    <CDA num="2">
    <AddendumRecordNumber>1</AddendumRecordNumber>
    <BOFDRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>75</DistrictCode>
    <BranchCode>12</BranchCode>
    <CheckDigit>8</CheckDigit>
    </BOFDRoutingNumber>
    <BOFDBusinessEndorsementDate>20090714</BOFDBusinessEndorsementDate>
    <BOFDDepositAccountNumber>0000345682256</BOFDDepositAccountNumber>
    <BOFDDepositBranch>753</BOFDDepositBranch>
    <PayeeName>XXX</PayeeName>
    <TruncationIndicator>Y</TruncationIndicator>
    <BOFDConversionIndicator>2</BOFDConversionIndicator>
    <BOFDCorrectionIndicator>0</BOFDCorrectionIndicator>
    </CDA>
    </CDA>
    <CDC>
    <CDC num="1">
    <AddendumCRecordNumber>1</AddendumCRecordNumber>
    <EndorsingBankRountingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </EndorsingBankRountingNumber>
    <EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
    <EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
    <EndorsingBankItemSequenceNum>0701275380000001</EndorsingBankItemSequenceNum>
    <TruncationIndicator>Y</TruncationIndicator>
    <EndorsingBankConversionInd>2</EndorsingBankConversionInd>
    <EndorsingBankCorrectionInd>0</EndorsingBankCorrectionInd>
    </CDC>
    <CDC num="2">
    <AddendumCRecordNumber>1</AddendumCRecordNumber>
    <EndorsingBankRountingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </EndorsingBankRountingNumber>
    <EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
    <EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
    <EndorsingBankItemSequenceNum>0701275380000002</EndorsingBankItemSequenceNum>
    <TruncationIndicator>Y</TruncationIndicator>
    <EndorsingBankConversionInd>2</EndorsingBankConversionInd>
    <EndorsingBankCorrectionInd>0</EndorsingBankCorrectionInd>
    </CDC>
    </CDC>
    <IVD>
    <IVD num="1">
    <ImageIndicator>1</ImageIndicator>
    <ImageCreatorRountingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </ImageCreatorRountingNumber>
    <ImageCreatorDate>20090714</ImageCreatorDate>
    <ImageViewFormatIndicator>0</ImageViewFormatIndicator>
    <ImageViewCompressionAlg>0</ImageViewCompressionAlg>
    <ViewSideIndicator>0</ViewSideIndicator>
    <ViewDescriptor>0</ViewDescriptor>
    <DigitalSignatureIndicator>1</DigitalSignatureIndicator>
    <DigitalSignatureMethod>0</DigitalSignatureMethod>
    <SecurityKeySize>12235</SecurityKeySize>
    <ImageRecreateIndicator>0</ImageRecreateIndicator>
    </IVD>
    <IVD num="2">
    <ImageIndicator>1</ImageIndicator>
    <ImageCreatorRountingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </ImageCreatorRountingNumber>
    <ImageCreatorDate>20090714</ImageCreatorDate>
    <ImageViewFormatIndicator>0</ImageViewFormatIndicator>
    <ImageViewCompressionAlg>0</ImageViewCompressionAlg>
    <ViewSideIndicator>0</ViewSideIndicator>
    <ViewDescriptor>0</ViewDescriptor>
    <DigitalSignatureIndicator>1</DigitalSignatureIndicator>
    <DigitalSignatureMethod>0</DigitalSignatureMethod>
    <SecurityKeySize>12235</SecurityKeySize>
    <ImageRecreateIndicator>0</ImageRecreateIndicator>
    </IVD>
    </IVD>
    <IVT>
    <IVT num="1">
    <ECEInstitutionRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </ECEInstitutionRoutingNumber>
    <BundleBusinessDate>20090714</BundleBusinessDate>
    <CycleNumber>0</CycleNumber>
    <ECEInstitutionItemSeqNumber>0701275380000001</ECEInstitutionItemSeqNumber>
    <ClippingOrigin>
    <Origin>0</Origin>
    <CoordinateH1>0000</CoordinateH1>
    <CoordinateH2>0000</CoordinateH2>
    <CoordinateV1>0000</CoordinateV1>
    <CoordinateV2>0000</CoordinateV2>
    </ClippingOrigin>
    <LengthofImageReferenceKey>0</LengthofImageReferenceKey>
    <LengthofDigitalSignature>0</LengthofDigitalSignature>
    <LengthofImageData>1</LengthofImageData>
    <OffsetToImageData>01001000</OffsetToImageData>
    </IVT>
    <IVT num="2">
    <ECEInstitutionRoutingNumber>
    <BankCode>070</BankCode>
    <DistrictCode>12</DistrictCode>
    <BranchCode>75</BranchCode>
    <CheckDigit>8</CheckDigit>
    </ECEInstitutionRoutingNumber>
    <BundleBusinessDate>20090714</BundleBusinessDate>
    <CycleNumber>0</CycleNumber>
    <ECEInstitutionItemSeqNumber>0701275380000002</ECEInstitutionItemSeqNumber>
    <ClippingOrigin>
    <Origin>0</Origin>
    <CoordinateH1>0000</CoordinateH1>
    <CoordinateH2>0000</CoordinateH2>
    <CoordinateV1>0000</CoordinateV1>
    <CoordinateV2>0000</CoordinateV2>
    </ClippingOrigin>
    <LengthofImageReferenceKey>0</LengthofImageReferenceKey>
    <LengthofDigitalSignature>0</LengthofDigitalSignature>
    <LengthofImageData>1</LengthofImageData>
    <OffsetToImageData>01001000</OffsetToImageData>
    </IVT>
    </IVT>
    <IVA>
    <IVA num="1">
    <GlobalImageQuality>0</GlobalImageQuality>
    <GlobalImageUsability>1</GlobalImageUsability>
    <ImagingBankSpecificTest>1</ImagingBankSpecificTest>
    </IVA>
    <IVA num="2">
    <GlobalImageQuality>0</GlobalImageQuality>
    <GlobalImageUsability>1</GlobalImageUsability>
    <ImagingBankSpecificTest>1</ImagingBankSpecificTest>
    </IVA>
    </IVA>
    <BCR>
    <ItemsWithinBundleCount>2</ItemsWithinBundleCount>
    <BundleTotalAmount>1500</BundleTotalAmount>
    <MICRValidTotalAmount>1500</MICRValidTotalAmount>
    </BCR>
    </ForwardBundle>
    <CCR>
    <BundleCount>1</BundleCount>
    <ItemWithinCashLetterCount>2</ItemWithinCashLetterCount>
    <CashLetterTotalAmount>1500</CashLetterTotalAmount>
    <ImagesWithinCashLetterCount>2</ImagesWithinCashLetterCount>
    <ECEInstitutionName>Bank Asia</ECEInstitutionName>
    <SettlementDate>20090714</SettlementDate>
    </CCR>
    </Collection>
    <ECR>
    <CashLetterCount>1</CashLetterCount>
    <TotalRecordCount>2</TotalRecordCount>
    <TotalItemCount>2</TotalItemCount>
    <FileTotalAmount>1500</FileTotalAmount>
    <ImmediateOriginContactName>Bank Asia</ImmediateOriginContactName>
    <ImmediateOriginContactNumber>XXX</ImmediateOriginContactNumber>
    </ECR>
    </OCE>
    </BACPSInterface>'
    , BFILENAME('MY_INWARD','Outward.xml'));
    COMMIT;

    What version of Oracle (4 digits) and what is the error?
    This runs without error on 10.2.0.4 (though you can go directly from a CLOB to a DOMDocument via dbms_xmldom)
    -- Created on 9/14/2009 by JH20567
    declare
      -- Local variables here
      l_clob   CLOB;
      l_parser dbms_xmlparser.Parser;
      l_doc    dbms_xmldom.DOMDocument;
    begin
      -- Test statements here
       l_clob := '<?xml version="1.0" encoding="UTF-8"?>
    <BACPSInterface>
       <OCE>
          <EHR>
             <StandardLevel>03</StandardLevel>
             <TestFiledIndicator>T</TestFiledIndicator>
             <ImmediateDestRoutingNumber>
                <BankCode>070</BankCode>
                <DistrictCode>12</DistrictCode>
                <BranchCode>75</BranchCode>
                <CheckDigit>8</CheckDigit>
             </ImmediateDestRoutingNumber>
             <ImmediateOriginRoutingNumber>
                <BankCode>070</BankCode>
                <DistrictCode>12</DistrictCode>
                <BranchCode>75</BranchCode>
                <CheckDigit>8</CheckDigit>
             </ImmediateOriginRoutingNumber>
             <FileCreationDate>20090714</FileCreationDate>
             <FileCreationTime>1047</FileCreationTime>
             <ResendIndicator>N</ResendIndicator>
             <ECESettlementDate>20090714</ECESettlementDate>
             <ECESessionTime>1047</ECESessionTime>
             <ECESettlementTime>1047</ECESettlementTime>
             <ECEtype>01</ECEtype>
             <CountryCode>BD</CountryCode>
          </EHR>
          <Collection>
             <CHR>
                <CashLetterBusinessDate>20090714</CashLetterBusinessDate>
                <CashLetterCreationDate>20090714</CashLetterCreationDate>
                <CashLetterCreationTime>1047</CashLetterCreationTime>
                <CashLetterRecordTypeInd>I</CashLetterRecordTypeInd>
                <CashLetterDocTypeIndicator>G</CashLetterDocTypeIndicator>
                <CashLetterID>1</CashLetterID>
                <OriginatorContactName>Bank Asia</OriginatorContactName>
                <OriginatorContactPhoneNumber>XXX</OriginatorContactPhoneNumber>
             </CHR>
             <ForwardBundle>
                <BHR>
                   <CollectionTypeIndicator>I</CollectionTypeIndicator>
                   <DestRoutingNumber>
                      <BankCode>070</BankCode>
                      <DistrictCode>12</DistrictCode>
                      <BranchCode>75</BranchCode>
                      <CheckDigit>8</CheckDigit>
                   </DestRoutingNumber>
                   <ECEInstitutionRoutingNumber>
                      <BankCode>070</BankCode>
                      <DistrictCode>12</DistrictCode>
                      <BranchCode>75</BranchCode>
                      <CheckDigit>8</CheckDigit>
                   </ECEInstitutionRoutingNumber>
                   <BundleBusinessDate>20090714</BundleBusinessDate>
                   <BundleCreationDate>20090714</BundleCreationDate>
                   <BundleID>1</BundleID>
                   <ReturnLocationRoutingNumber>070127538</ReturnLocationRoutingNumber>
                </BHR>
                <CDR>
                   <CDR num="1">
                      <ECESettlementDate>20090714</ECESettlementDate>
                      <ECESessionTime>1047</ECESessionTime>
                      <ECESettlementTime>1047</ECESettlementTime>
                      <ECEItemType>N</ECEItemType>
                      <IssuingBranchRoutingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>12</DistrictCode>
                         <BranchCode>75</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </IssuingBranchRoutingNumber>
                      <AccountNumber>0000334008221</AccountNumber>
                      <ChequeSequenceNumber>1601735</ChequeSequenceNumber>
                      <ItemAmount>500</ItemAmount>
                      <ECEInstitutionItemSequencNum>0701275380000001</ECEInstitutionItemSequencNum>
                      <DocumentationTypeIndicator>I</DocumentationTypeIndicator>
                      <ReturnAcceptanceIndicator>6</ReturnAcceptanceIndicator>
                      <MICRValidIndicator>1</MICRValidIndicator>
                      <BOFDIndicator>Y</BOFDIndicator>
                      <ChequeDetailRecAddendumCount>0</ChequeDetailRecAddendumCount>
                      <CorrectionIndicator>0</CorrectionIndicator>
                      <RepresentmentIndicator>0</RepresentmentIndicator>
                      <ArchiveTypeIndicator>F</ArchiveTypeIndicator>
                   </CDR>
                   <CDR num="2">
                      <ECESettlementDate>20090714</ECESettlementDate>
                      <ECESessionTime>1047</ECESessionTime>
                      <ECESettlementTime>1047</ECESettlementTime>
                      <ECEItemType>N</ECEItemType>
                      <IssuingBranchRoutingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>12</DistrictCode>
                         <BranchCode>75</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </IssuingBranchRoutingNumber>
                      <AccountNumber>0000345682256</AccountNumber>
                      <ChequeSequenceNumber>1234567</ChequeSequenceNumber>
                      <ItemAmount>1000</ItemAmount>
                      <ECEInstitutionItemSequencNum>0701275380000002</ECEInstitutionItemSequencNum>
                      <DocumentationTypeIndicator>I</DocumentationTypeIndicator>
                      <ReturnAcceptanceIndicator>6</ReturnAcceptanceIndicator>
                      <MICRValidIndicator>1</MICRValidIndicator>
                      <BOFDIndicator>Y</BOFDIndicator>
                      <ChequeDetailRecAddendumCount>0</ChequeDetailRecAddendumCount>
                      <CorrectionIndicator>0</CorrectionIndicator>
                      <RepresentmentIndicator>0</RepresentmentIndicator>
                      <ArchiveTypeIndicator>F</ArchiveTypeIndicator>
                   </CDR>
                </CDR>
                <CDA>
                   <CDA num="1">
                      <AddendumRecordNumber>1</AddendumRecordNumber>
                      <BOFDRoutingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>75</DistrictCode>
                         <BranchCode>12</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </BOFDRoutingNumber>
                      <BOFDBusinessEndorsementDate>20090714</BOFDBusinessEndorsementDate>
                      <BOFDDepositAccountNumber>0000334008221</BOFDDepositAccountNumber>
                      <BOFDDepositBranch>753</BOFDDepositBranch>
                      <PayeeName>XXX</PayeeName>
                      <TruncationIndicator>Y</TruncationIndicator>
                      <BOFDConversionIndicator>2</BOFDConversionIndicator>
                      <BOFDCorrectionIndicator>0</BOFDCorrectionIndicator>
                   </CDA>
                   <CDA num="2">
                      <AddendumRecordNumber>1</AddendumRecordNumber>
                      <BOFDRoutingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>75</DistrictCode>
                         <BranchCode>12</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </BOFDRoutingNumber>
                      <BOFDBusinessEndorsementDate>20090714</BOFDBusinessEndorsementDate>
                      <BOFDDepositAccountNumber>0000345682256</BOFDDepositAccountNumber>
                      <BOFDDepositBranch>753</BOFDDepositBranch>
                      <PayeeName>XXX</PayeeName>
                      <TruncationIndicator>Y</TruncationIndicator>
                      <BOFDConversionIndicator>2</BOFDConversionIndicator>
                      <BOFDCorrectionIndicator>0</BOFDCorrectionIndicator>
                   </CDA>
                </CDA>
                <CDC>
                   <CDC num="1">
                      <AddendumCRecordNumber>1</AddendumCRecordNumber>
                      <EndorsingBankRountingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>12</DistrictCode>
                         <BranchCode>75</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </EndorsingBankRountingNumber>
                      <EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
                      <EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
                      <EndorsingBankItemSequenceNum>0701275380000001</EndorsingBankItemSequenceNum>
                      <TruncationIndicator>Y</TruncationIndicator>
                      <EndorsingBankConversionInd>2</EndorsingBankConversionInd>
                      <EndorsingBankCorrectionInd>0</EndorsingBankCorrectionInd>
                   </CDC>
                   <CDC num="2">
                      <AddendumCRecordNumber>1</AddendumCRecordNumber>
                      <EndorsingBankRountingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>12</DistrictCode>
                         <BranchCode>75</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </EndorsingBankRountingNumber>
                      <EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
                      <EndorsingBankEndorsementDate>20090714</EndorsingBankEndorsementDate>
                      <EndorsingBankItemSequenceNum>0701275380000002</EndorsingBankItemSequenceNum>
                      <TruncationIndicator>Y</TruncationIndicator>
                      <EndorsingBankConversionInd>2</EndorsingBankConversionInd>
                      <EndorsingBankCorrectionInd>0</EndorsingBankCorrectionInd>
                   </CDC>
                </CDC>
                <IVD>
                   <IVD num="1">
                      <ImageIndicator>1</ImageIndicator>
                      <ImageCreatorRountingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>12</DistrictCode>
                         <BranchCode>75</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </ImageCreatorRountingNumber>
                      <ImageCreatorDate>20090714</ImageCreatorDate>
                      <ImageViewFormatIndicator>0</ImageViewFormatIndicator>
                      <ImageViewCompressionAlg>0</ImageViewCompressionAlg>
                      <ViewSideIndicator>0</ViewSideIndicator>
                      <ViewDescriptor>0</ViewDescriptor>
                      <DigitalSignatureIndicator>1</DigitalSignatureIndicator>
                      <DigitalSignatureMethod>0</DigitalSignatureMethod>
                      <SecurityKeySize>12235</SecurityKeySize>
                      <ImageRecreateIndicator>0</ImageRecreateIndicator>
                   </IVD>
                   <IVD num="2">
                      <ImageIndicator>1</ImageIndicator>
                      <ImageCreatorRountingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>12</DistrictCode>
                         <BranchCode>75</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </ImageCreatorRountingNumber>
                      <ImageCreatorDate>20090714</ImageCreatorDate>
                      <ImageViewFormatIndicator>0</ImageViewFormatIndicator>
                      <ImageViewCompressionAlg>0</ImageViewCompressionAlg>
                      <ViewSideIndicator>0</ViewSideIndicator>
                      <ViewDescriptor>0</ViewDescriptor>
                      <DigitalSignatureIndicator>1</DigitalSignatureIndicator>
                      <DigitalSignatureMethod>0</DigitalSignatureMethod>
                      <SecurityKeySize>12235</SecurityKeySize>
                      <ImageRecreateIndicator>0</ImageRecreateIndicator>
                   </IVD>
                </IVD>
                <IVT>
                   <IVT num="1">
                      <ECEInstitutionRoutingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>12</DistrictCode>
                         <BranchCode>75</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </ECEInstitutionRoutingNumber>
                      <BundleBusinessDate>20090714</BundleBusinessDate>
                      <CycleNumber>0</CycleNumber>
                      <ECEInstitutionItemSeqNumber>0701275380000001</ECEInstitutionItemSeqNumber>
                      <ClippingOrigin>
                         <Origin>0</Origin>
                         <CoordinateH1>0000</CoordinateH1>
                         <CoordinateH2>0000</CoordinateH2>
                         <CoordinateV1>0000</CoordinateV1>
                         <CoordinateV2>0000</CoordinateV2>
                      </ClippingOrigin>
                      <LengthofImageReferenceKey>0</LengthofImageReferenceKey>
                      <LengthofDigitalSignature>0</LengthofDigitalSignature>
                      <LengthofImageData>1</LengthofImageData>
                      <OffsetToImageData>01001000</OffsetToImageData>
                   </IVT>
                   <IVT num="2">
                      <ECEInstitutionRoutingNumber>
                         <BankCode>070</BankCode>
                         <DistrictCode>12</DistrictCode>
                         <BranchCode>75</BranchCode>
                         <CheckDigit>8</CheckDigit>
                      </ECEInstitutionRoutingNumber>
                      <BundleBusinessDate>20090714</BundleBusinessDate>
                      <CycleNumber>0</CycleNumber>
                      <ECEInstitutionItemSeqNumber>0701275380000002</ECEInstitutionItemSeqNumber>
                      <ClippingOrigin>
                         <Origin>0</Origin>
                         <CoordinateH1>0000</CoordinateH1>
                         <CoordinateH2>0000</CoordinateH2>
                         <CoordinateV1>0000</CoordinateV1>
                         <CoordinateV2>0000</CoordinateV2>
                      </ClippingOrigin>
                      <LengthofImageReferenceKey>0</LengthofImageReferenceKey>
                      <LengthofDigitalSignature>0</LengthofDigitalSignature>
                      <LengthofImageData>1</LengthofImageData>
                      <OffsetToImageData>01001000</OffsetToImageData>
                   </IVT>
                </IVT>
                <IVA>
                   <IVA num="1">
                      <GlobalImageQuality>0</GlobalImageQuality>
                      <GlobalImageUsability>1</GlobalImageUsability>
                      <ImagingBankSpecificTest>1</ImagingBankSpecificTest>
                   </IVA>
                   <IVA num="2">
                      <GlobalImageQuality>0</GlobalImageQuality>
                      <GlobalImageUsability>1</GlobalImageUsability>
                      <ImagingBankSpecificTest>1</ImagingBankSpecificTest>
                   </IVA>
                </IVA>
                <BCR>
                   <ItemsWithinBundleCount>2</ItemsWithinBundleCount>
                   <BundleTotalAmount>1500</BundleTotalAmount>
                   <MICRValidTotalAmount>1500</MICRValidTotalAmount>
                </BCR>
             </ForwardBundle>
             <CCR>
                <BundleCount>1</BundleCount>
                <ItemWithinCashLetterCount>2</ItemWithinCashLetterCount>
                <CashLetterTotalAmount>1500</CashLetterTotalAmount>
                <ImagesWithinCashLetterCount>2</ImagesWithinCashLetterCount>
                <ECEInstitutionName>Bank Asia</ECEInstitutionName>
                <SettlementDate>20090714</SettlementDate>
             </CCR>
          </Collection>
          <ECR>
             <CashLetterCount>1</CashLetterCount>
             <TotalRecordCount>2</TotalRecordCount>
             <TotalItemCount>2</TotalItemCount>
             <FileTotalAmount>1500</FileTotalAmount>
                   <ImmediateOriginContactName>Bank Asia</ImmediateOriginContactName>
                   <ImmediateOriginContactNumber>XXX</ImmediateOriginContactNumber>
              </ECR>
         </OCE>
    </BACPSInterface>';
       l_parser := dbms_xmlparser.newParser;
       dbms_xmlparser.parseClob(l_parser, l_clob);
       l_doc := dbms_xmlparser.getDocument(l_parser);
       dbms_lob.freetemporary(l_clob);
       dbms_xmlparser.freeParser(l_parser); 
       dbms_xmldom.freeDocument(l_doc);
    end;

  • How to Parse an XML file using SAXParser in java.

    Hi all
    Am a bit new to XML files and have no idea about SAXParsers ... Now my problem is to parse this XML file below
    <?xml version="1.0" encoding="UTF-8"?>
    <sc:memory_segmentation xmlns:sc="sc_memory_segmentation.xsd">
       <sc:architecture name="MPC55xx"></sc:architecture>
       <sc:derivative name=""></sc:derivative>
       <sc:configuration name=""></sc:configuration>
       <sc:memory name="Internal ROM" type="ROM">
          <sc:area-list>
             <sc:area name="Bootmanager" type="BOOTMANAGER">
                 <sc:segment-list>
                   <sc:segment name="ROM page 1">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                 </sc:segment-list>
             </sc:area>
             <sc:area name="Bootloader SWE" type="BOOTLOADER">
                 <sc:segment-list>
                   <sc:segment name="ROM page 2">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 3">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 1" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 4">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 5">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 6">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 7">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 2" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 8">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 3" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 9">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 4" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 10">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
          </sc:area-list>
       </sc:memory>
       <sc:memory name="Internal RAM" type="RAM">
          <sc:area-list>
             <sc:area name="RAM" type="RAM">
                <sc:segment-list>
                   <sc:segment name="RAM page 1">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 2">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 3">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 4">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 5">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
          </sc:area-list>
       </sc:memory>
       <sc:memory name="Internal EEPROM" type="EEPROM">
          <sc:area-list>
             <sc:area name="EEPROM" type="EEPROM">
                <sc:segment-list>
                   <sc:segment name="EEPROM page 1">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 2">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 3">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 4">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 5">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
          </sc:area-list>
       </sc:memory>
    </sc:memory_segmentation> And from this file I need to make 3 Hashtables out of it one for ROM , RAM and EEPROM containg Segment information i.e. Segment start and end addresses and Area type of the segment....
    If anyone could at least guide me with the basic commands and structure of the parser it would be really really great ...
    Thanks a lot
    Anisha

    Normally if you have no idea about X, the first thing you should do is google "X tutorial". You will find plenty of them out there. And the advantage is, they are better written than whatever we spend two minutes throwing together here. Not to mention that it saves us the two minutes.
    But if you have specific questions with your SAX parser when you get it going, then ask them here. Actually, ask them in the XML forum here, not this one.

  • Parsing an XML file

    I've written a program which is partly responsible for parsing an XML file that can be found on the web. I appear to be accessing the XML file correctly, but when I try to parse it I am running into a problem. I try to create a List object that contains all of the children of the root element. The code looks like this:
    Document doc = parser.build(xmlFile);
    Element root = doc.getRootElement();
    List rootChildren = root.getChildren();But I get an error that say that "the type List is ambiguous". I am importing java.util.*. I am trying to do this exactly like a few examples I found on the web, but I can't seem to get past this issue. What do I need to keep Eclipse from telling me that List is not an ambiguous type.

    Maybe you haveimport java.util.*;
    import java.awt.*;Both packages contains a List class.
    In that case, the compiler doesn't know which one you're talking about.
    If you don't need the java.awt.List class here, try not to import it.
    If you need it, use the fully qualified class name in your code.

  • How to parse an XMl without using prefix in the namespace and elements?

    Hi
    The following is a sample of the xml that I need to parse.
    Without the prefix in the namespace section I am getting an error but when i just put in the prefix it works fine. Any help here would be greatly appreciated.
    I think i need to change something in the parser set up...may be the somewhere in the bolded lines....but i am clueless...
    //Xml begins
    <?xml version="1.0" encoding="utf-8" ?>
    - <Statemessages xsi:schemaLocation="http://www.SomeLocation.com/SomeXSD.xsd" xmlns="http://www.abcd.com/BSN" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    - <FileControl>
    <CreationDate>2008-08-11</CreationDate>
    - <Source>
    <SystemID>SAP4BSN</SystemID>
    <MandantID>100</MandantID>
    </Source>
    - <Destination>
    <SystemID>CWL</SystemID>
    <MandantID>746</MandantID>
    </Destination>
    <SequenceNumber>000000004</SequenceNumber>
    <Counter>000000001</Counter>
    </FileControl>
    - <Message>
    - <PartyRegistrationID>
    <ID>2101576347</ID>
    <Type>RG</Type>
    <ID>2101576347</ID>
    <Type>AG</Type>
    </PartyRegistrationID>
    <CustomerGroupID>02</CustomerGroupID>
    <Name>Lewicki</Name>
    <Subname>Hans Bruno Michel</Subname>
    <DateTime>2008-08-11T23:59:59</DateTime>
    - <DefaultOfPayment>
    <MessageID>00000001</MessageID>
    <GrossAmountBefore>0.0</GrossAmountBefore>
    <GrossAmountCurrent>-17.9</GrossAmountCurrent>
    <Currency>EUR</Currency>
    <SettlementOfBalance>Nein</SettlementOfBalance>
    <IncludingSubsidiaryClaim>Ja</IncludingSubsidiaryClaim>
    </DefaultOfPayment>
    - <ContractsWithDefaultOfPayment>
    <ContractID>0148863732</ContractID>
    </ContractsWithDefaultOfPayment>
    - <Messagedetails>
    - <ReturnDebitNote>
    <MessageID>00000002</MessageID>
    <KindOf>BA</KindOf>
    <Reason>E2</Reason>
    <Date>2008-08-11</Date>
    <GrossAmount>-15.4</GrossAmount>
    <Currency>EUR</Currency>
    </ReturnDebitNote>
    </Messagedetails>
    </Message>
    </Statemessages>
    //XML end
    I am using the following stored procedure to try this;
    create or replace PROCEDURE CompleteSaveXML_1 AS
    XMLMessage2 XMLTYPE;
    v_parser dbms_xmlparser.Parser;
    v_clob CLOB;
    v_sent DATE;
    v_doc xmldom.DOMDocument;
    v_nl xmldom.DOMNodeList;
    v_nFCL xmldom.DOMNodeList;
    v_nFCN xmldom.DOMNode;
    v_nFCSourceL xmldom.DOMNodeList;
    v_nFCSourceN xmldom.DOMNode;
    v_nFCDestinationL xmldom.DOMNodeList;
    v_nFCDestinationN xmldom.DOMNode;
    m_nl xmldom.DOMNodeList;
    m_n xmldom.DOMNode;
    v_n xmldom.DOMNode;
    v_n3 xmldom.DOMNodeList;
    v_n4 xmldom.DOMNode;
    v_b xmldom.DOMNode;
    v_d xmldom.DOMNode;
    v_a xmldom.DOMNodeList;
    v_c xmldom.DOMNodeList;
    m_prg xmldom.DOMNodeList;
    m_pr xmldom.DOMNode;
    condf_nl xmldom.DOMNodeList;
    condf_n xmldom.DOMNode;
    msgdtl_nl xmldom.DOMNodeList;
    msgdtl_n xmldom.DOMNode;
    rtndbt_nl xmldom.DOMNodeList;
    rtndbt_n xmldom.DOMNode;
    dnlt_nl xmldom.DOMNodeList;
    dnlt_n xmldom.DOMNode;
    cancl_nl xmldom.DOMNodeList;
    cancl_n xmldom.DOMNode;
    conid_nl xmldom.DOMNodeList;
    conid_n xmldom.DOMNode;
    canclid_nl xmldom.DOMNodeList;
    canclid_n xmldom.DOMNode;
    par_ref number(10) :=0;
    msgnum number(20):=0;
    var1 number(30):=0;
    rtnnum number(20):=0;
    dnnum number(20):=0;
    tpmsg number(20):=0;
    condfpmt number(20):=0;
    canclnum number(20):=0;
    --Added the next variable
    sequence_no     number(20):=0;
    --These are the new variables
    condfpmt1 number(20):=0;
    rtnnum1 number(20):=0;
    dnnum1 number(20):=0;
    tpmsg1 number(20):=0;
    canclnum1 number(20):=0;
    --changing
    part_refid_value number(20);
    parid_typ_n xmldom.DOMNode;
    parid_typ_nl xmldom.DOMNodeList;
    parid_id_nl xmldom.DOMNodeList;
    parid_id_n     xmldom.DOMNode;
    party_ref_node xmldom.DOMNode;
    var_pr_reg_typ VARCHAR2(2);
    msgrtdbt_nl xmldom.DOMNodeList;
    msgrtdbt_n xmldom.DOMNode;
    kndrtdbt_nl xmldom.DOMNodeList;
    kndrtdbt_n xmldom.DOMNode;
    rsnrtdbt_nl xmldom.DOMNodeList;
    rsnrtdbt_n xmldom.DOMNode;
    datrtdbt_nl xmldom.DOMNodeList;
    datrtdbt_n xmldom.DOMNode;
    grssrtdbt_nl xmldom.DOMNodeList;
    grssrtdbt_n xmldom.DOMNode;
    currtdbt_nl xmldom.DOMNodeList;
    currtdbt_n xmldom.DOMNode;
    rtnnum2 number(20):=0;
    msgdnlt_nl xmldom.DOMNodeList;
    msgdnlt_n xmldom.DOMNode;
    lvdnlt_nl xmldom.DOMNodeList;
    lvdnlt_n xmldom.DOMNode;
    datdnlt_nl xmldom.DOMNodeList;
    datdnlt_n xmldom.DOMNode;
    grsdnlt_nl xmldom.DOMNodeList;
    grsdnlt_n xmldom.DOMNode;
    curdnlt_nl xmldom.DOMNodeList;
    curdnlt_n xmldom.DOMNode;
    limdnlt_nl xmldom.DOMNodeList;
    limdnlt_n xmldom.DOMNode;
    lvimp number(20);
    nullchk varchar2(30) ;
    chk_flseq number(10);
    fl_seq number(30);
    --these are the new variables
    TYPE tab_type IS TABLE OF FileControl%ROWTYPE;
    t_tab_FC tab_type := tab_type();
    TYPE tab_type1 IS TABLE OF MessageTab%ROWTYPE;
    t_tab1 tab_type1 := tab_type1();
    TYPE tab_type2 IS TABLE OF ContractsWithDefaultOfPayment%ROWTYPE;
    t_tab2 tab_type2 := tab_type2();
    TYPE tab_type3 IS TABLE OF CancellationTab%ROWTYPE;
    t_tab3 tab_type3 := tab_type3();
    TYPE tab_type4 IS TABLE OF ReturnDebitNoteTab%ROWTYPE;
    t_tab4 tab_type4 := tab_type4();
    TYPE tab_type5 IS TABLE OF DunningLettersTab%ROWTYPE;
    t_tab5 tab_type5 := tab_type5();
    cursor MessageCursor is
    select * from OM_BSN_STATEMSGS
    where PROCESSED is null AND SENT in(Select min(SENT) from OM_BSN_STATEMSGS
    where PROCESSED is null)
    order by sent asc;
    v_statemsgs OM_BSN_STATEMSGS%ROWTYPE;
    BEGIN
    DBMS_OUTPUT.put_line('creating parser');
    -- v_parser := DBMS_XMLPARSER.NEWPARSER;
    v_parser := DBMS_XMLPARSER.NEWPARSER();
    DBMS_OUTPUT.put_line('done creating');
    DBMS_XMLPARSER.setValidationMode(v_parser, true);
    DBMS_XMLPARSER.showWarnings(v_parser, true);
    open MessageCursor;
    loop
    fetch MessageCursor into v_statemsgs;
    exit when MessageCursor%NOTFOUND;
    DBMS_XMLPARSER.PARSECLOB(P => v_parser, DOC => v_statemsgs.MESSAGE);
    -- xmlparser.parse(v_parser, File_Location);
    v_doc := xmlparser.getDocument(v_parser);
    dbms_xmlparser.freeParser(v_parser); DBMS_OUTPUT.put_line('Step 1');
    v_nFCL := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/Statemessages/FileControl');
    v_nFCN := xmldom.item(v_nFCL,0);
    Source
    v_nFCSourceL := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/Statemessages/FileControl/Source');
    v_nFCSourceN := xmldom.item(v_nFCSourceL,0);
    Destination
    v_nFCDestinationL := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/Statemessages/FileControl/Destination');
    v_nFCDestinationN := xmldom.item(v_nFCDestinationL,0);
    -- Populate tab type for ORFC
    t_tab_FC.extend;
    t_tab_FC(t_tab_FC.last).creation_date := to_date(xslprocessor.valueOf(v_nFCN,'CreationDate'),'YYYY-MM-DD');
    t_tab_FC(t_tab_FC.last).src_sys_id := xslprocessor.valueOf(v_nFCSourceN,'SystemID');
    t_tab_FC(t_tab_FC.last).src_mandant_id := xslprocessor.valueOf(v_nFCSourceN,'MandantID');
    t_tab_FC(t_tab_FC.last).dest_sys_id := xslprocessor.valueOf(v_nFCDestinationN,'SystemID');
    t_tab_FC(t_tab_FC.last).dest_mandant_id := xslprocessor.valueOf(v_nFCDestinationN,'MandantID');
    t_tab_FC(t_tab_FC.last).seq_no := xslprocessor.valueOf(v_nFCN,'SequenceNumber');
    t_tab_FC(t_tab_FC.last).counter := xslprocessor.valueOf(v_nFCN,'Counter');
    --Saving the value of this seq_no so that it can be inserted in the message tab.
    sequence_no:= xslprocessor.valueOf(v_nFCN,'SequenceNumber');
    --Insert into ORFC TAB
    fl_seq := xslprocessor.valueOf(v_nFCN,'SequenceNumber');
    select count(*) into chk_flseq from FileControl where SEQ_NO =fl_seq;
    if (chk_flseq =0) then
    FOR each_FC IN t_tab_FC.first .. t_tab_FC.last LOOP
    INSERT INTO FileControl
    creation_date,
    src_sys_id,
    src_mandant_id,
    dest_sys_id,
    dest_mandant_id,
    seq_no,
    counter)
    VALUES
    t_tab_FC(each_FC).creation_date,
    t_tab_FC(each_FC).src_sys_id ,
    t_tab_FC(each_FC).src_mandant_id,
    t_tab_FC(each_FC).dest_sys_id,
    t_tab_FC(each_FC).dest_mandant_id,
    t_tab_FC(each_FC).seq_no,
    t_tab_FC(each_FC).counter
    END LOOP;
    end if;
    DBMS_OUTPUT.put_line('Step 2');
    if (chk_flseq =0) then /* chk the xml's filecontrol seq exists in filecontrltab */
    -- Use XPATH syntax to assign values to he elements of the collection.
    v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/Statemessages/Message');
    tpmsg := xmldom.getLength(v_nl);
    DBMS_OUTPUT.put_line('Message node length'||tpmsg);
    if (tpmsg>0) then
    FOR cur_emp IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
    v_n := xmldom.item(v_nl, cur_emp);
    select (BISON_OM_MessageID.NEXTVAL) into var1 from dual;
    t_tab1.extend;
    t_tab1(t_tab1.last).message_id := var1;
    t_tab1(t_tab1.last).seq_no     := sequence_no;
    ---party reg
    m_prg := xslprocessor.selectNodes(v_n,'PartyRegistrationID');
    FOR Ref_Id_Loop IN 0 .. xmldom.getLength(m_prg) - 1 LOOP
    party_ref_node := xmldom.item(m_prg,0);
    part_refid_value := xslprocessor.valueOf(party_ref_node,'.');
    end loop;
    m_pr := xmldom.item(m_prg, 0);
    --changing
    --chang id
    parid_id_nl := xslprocessor.selectNodes(m_pr,'ID');
    DBMS_OUTPUT.put_line('Going to read PartyRegistrationID');
    FOR cur_parid_id IN 0 .. xmldom.getLength(parid_id_nl) - 1 LOOP
    parid_id_n := xmldom.item(parid_id_nl,cur_parid_id);
    DBMS_OUTPUT.put_line('Value of id:'|| xslprocessor.valueOf(parid_id_n,'.'));
    t_tab1(t_tab1.last).party_ref_id := xslprocessor.valueOf(parid_id_n,'.');
    exit;
    end loop ;
    ---- change id
    parid_typ_nl := xslprocessor.selectNodes(m_pr,'Type');
    FOR cur_parid_typ IN 0 .. xmldom.getLength(parid_typ_nl) - 1 LOOP
    parid_typ_n := xmldom.item(parid_typ_nl,cur_parid_typ);
    var_pr_reg_typ := xslprocessor.valueOf(parid_typ_n,'.');
    if var_pr_reg_typ='RG' then
    t_tab1(t_tab1.last).PARTY_REG_TYPE_RG := var_pr_reg_typ;
    elsif var_pr_reg_typ='AG' then
    t_tab1(t_tab1.last).PARTY_REG_TYPE_AG := var_pr_reg_typ;
    end if;
    end loop;
    --Chang
    -- t_tab1(t_tab1.last).PARTY_REG_TYPE_AG := xslprocessor.valueOf(m_pr,'Type');
    par_ref :=xslprocessor.valueOf(m_pr,'ID');
    t_tab1(t_tab1.last).customer_grp_id := xslprocessor.valueOf(v_n,'CustomerGroupID');
    t_tab1(t_tab1.last).name := xslprocessor.valueOf(v_n,'Name');
    t_tab1(t_tab1.last).subname := xslprocessor.valueOf(v_n,'Subname');
    t_tab1(t_tab1.last).datetime := xslprocessor.valueOf(v_n,'DateTime');
    DBMS_OUTPUT.put_line('Step 3 ContractsWithDefaultOfPayment');
    m_nl := xslprocessor.selectNodes(v_n,'DefaultOfPayment');
    m_n := xmldom.item(m_nl, 0);
    t_tab1(t_tab1.last).payment_msg_id := xslprocessor.valueOf(m_n,'MessageID');
    t_tab1(t_tab1.last).gross_amt_before := xslprocessor.valueOf(m_n,'GrossAmountBefore');
    t_tab1(t_tab1.last).gross_amt_current := xslprocessor.valueOf(m_n,'GrossAmountCurrent');
    t_tab1(t_tab1.last).currency := xslprocessor.valueOf(m_n,'Currency');
    t_tab1(t_tab1.last).settlemen_of_balance := xslprocessor.valueOf(m_n,'SettlementOfBalance');
    t_tab1(t_tab1.last).including_subsidiary_claim := xslprocessor.valueOf(m_n,'IncludingSubsidiaryClaim');
    condf_nl := xslprocessor.selectNodes(v_n,'ContractsWithDefaultOfPayment');
    condf_n := xmldom.item(condf_nl,0);
    condfpmt := xmldom.getLength(condf_nl);
    if (condfpmt > 0) then
    conid_nl := xslprocessor.selectNodes(condf_n,'ContractID');
    FOR cur_conid IN 0 .. xmldom.getLength(conid_nl) - 1 LOOP
    conid_n := xmldom.item(conid_nl,cur_conid);
    t_tab2.extend;
    t_tab2(t_tab2.last).message_id := var1;
    t_tab2(t_tab2.last).contract_id := xslprocessor.valueOf(conid_n,'.');
    end loop;
    condfpmt1 := 1;
    end if;
    cancl_nl := xslprocessor.selectNodes(v_n,'Cancellation');
    cancl_n := xmldom.item(cancl_nl,0);
    DBMS_OUTPUT.put_line('No of cancellations'||xmldom.getLength(cancl_nl) );
    canclnum := xmldom.getLength(cancl_nl) ;
    if (canclnum > 0) then
    canclid_nl := xslprocessor.selectNodes(cancl_n,'MessageID');
    FOR cur_canclid IN 0 .. xmldom.getLength(canclid_nl) - 1 LOOP
    canclid_n := xmldom.item(canclid_nl,cur_canclid);
    t_tab3.extend;
    t_tab3(t_tab3.last).message_id := var1;
    t_tab3(t_tab3.last).cancellation_msg_id := xslprocessor.valueOf(canclid_n,'.');
    end loop;
    canclnum1 :=1;
    end if; -- canclnum
    msgdtl_nl := xslprocessor.selectNodes(v_n,'Messagedetails');
    msgnum := xmldom.getLength(msgdtl_nl) ;
    dbms_output.put_line('msgggg::::'||msgnum);
    if (msgnum >0) then
    msgdtl_n := xmldom.item(msgdtl_nl,0);
    rtndbt_nl := xslprocessor.selectNodes(msgdtl_n,'ReturnDebitNote');
    rtndbt_n := xmldom.item(rtndbt_nl,0);
    rtnnum := xmldom.getLength(rtndbt_nl) ;
    if (rtnnum >0) then
    --return debit note
    msgrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'MessageID');
    kndrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'KindOf');
    rsnrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'Reason');
    datrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'Date');
    grssrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'GrossAmount');
    currtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'Currency');
    rtnnum2 :=0;
    FOR cur_msgrtndbt IN 0 .. xmldom.getLength(msgrtdbt_nl) - 1 LOOP
    msgrtdbt_n := xmldom.item(msgrtdbt_nl,cur_msgrtndbt);
    kndrtdbt_n := xmldom.item(kndrtdbt_nl,cur_msgrtndbt);
    rsnrtdbt_n := xmldom.item(rsnrtdbt_nl,cur_msgrtndbt);
    datrtdbt_n := xmldom.item(datrtdbt_nl,cur_msgrtndbt);
    grssrtdbt_n := xmldom.item(grssrtdbt_nl,cur_msgrtndbt);
    currtdbt_n := xmldom.item(currtdbt_nl,cur_msgrtndbt);
    t_tab4.extend;
    t_tab4(t_tab4.last).message_id := var1;
    t_tab4(t_tab4.last).ret_debitnote_msg_id := xslprocessor.valueOf(msgrtdbt_n,'.');
    t_tab4(t_tab4.last).kind_of := xslprocessor.valueOf(kndrtdbt_n,'.');
    t_tab4(t_tab4.last).Reason := xslprocessor.valueOf(rsnrtdbt_n,'.');
    t_tab4(t_tab4.last).debit_note_date := to_date(xslprocessor.valueOf(datrtdbt_n,'.'),'YYYY-MM-DD');
    t_tab4(t_tab4.last).gross_amt := xslprocessor.valueOf(grssrtdbt_n,'.');
    t_tab4(t_tab4.last).currency := xslprocessor.valueOf(currtdbt_n,'.');
    rtnnum1 :=rtnnum1 + 1;
    rtnnum2 := rtnnum2 + 1;
    dbms_output.put_line('message_id::::'||var1);
    dbms_output.put_line('rtnnum2::::'||rtnnum2);
    dbms_output.put_line('ret_debitnote_msg_id:::'||t_tab4(t_tab4.last).ret_debitnote_msg_id);
    end loop;
    ----return debit note
    t_tab4(t_tab4.last).message_id := var1 ;
    t_tab4(t_tab4.last).ret_debitnote_msg_id := xslprocessor.valueOf(rtndbt_n,'MessageID');
    t_tab4(t_tab4.last).kind_of := xslprocessor.valueOf(rtndbt_n,'KindOf');
    t_tab4(t_tab4.last).reason := xslprocessor.valueOf(rtndbt_n,'Reason');
    t_tab4(t_tab4.last).debit_note_date := to_date(xslprocessor.valueOf(rtndbt_n,'Date'),'YYYY-MM-DD');
    t_tab4(t_tab4.last).gross_amt := xslprocessor.valueOf(rtndbt_n,'GrossAmount');
    t_tab4(t_tab4.last).currency := xslprocessor.valueOf(rtndbt_n,'Currency');
    rtnnum1 :=1;
    end if;
    dnlt_nl := xslprocessor.selectNodes(msgdtl_n,'DunningLetter');
    dnlt_n := xmldom.item(dnlt_nl, 0);
    dnnum := xmldom.getLength(dnlt_nl) ;
    if (dnnum >0) then
    -- t_tab5.extend;
    --dunning letter
    msgdnlt_nl := xslprocessor.selectNodes(dnlt_n,'MessageID');
    lvdnlt_nl := xslprocessor.selectNodes(dnlt_n,'Level');
    datdnlt_nl := xslprocessor.selectNodes(dnlt_n,'Date');
    grsdnlt_nl := xslprocessor.selectNodes(dnlt_n,'GrossAmount');
    curdnlt_nl := xslprocessor.selectNodes(dnlt_n,'Currency');
    limdnlt_nl := xslprocessor.selectNodes(dnlt_n,'LevelImprovement');
    FOR cur_msgdnlt IN 0 .. xmldom.getLength(msgdnlt_nl) - 1 LOOP
    msgdnlt_n := xmldom.item(msgdnlt_nl,cur_msgdnlt);
    lvdnlt_n := xmldom.item(lvdnlt_nl,cur_msgdnlt);
    datdnlt_n := xmldom.item(datdnlt_nl,cur_msgdnlt);
    grsdnlt_n := xmldom.item(grsdnlt_nl,cur_msgdnlt);
    curdnlt_n := xmldom.item(curdnlt_nl,cur_msgdnlt);
    limdnlt_n := xmldom.item(limdnlt_nl,cur_msgdnlt);
    t_tab5.extend;
    t_tab5(t_tab5.last).message_id := var1;
    t_tab5(t_tab5.last).dunning_msg_id := xslprocessor.valueOf(msgdnlt_n,'.');
    t_tab5(t_tab5.last).d_level := xslprocessor.valueOf(lvdnlt_n,'.');
    t_tab5(t_tab5.last).dunning_date := to_date(xslprocessor.valueOf(datdnlt_n,'.'),'YYYY-MM-DD');
    t_tab5(t_tab5.last).gross_amt := xslprocessor.valueOf(grsdnlt_n,'.');
    t_tab5(t_tab5.last).currency := xslprocessor.valueOf(curdnlt_n,'.');
    lvimp := xmldom.getLength(limdnlt_nl);
    begin
    t_tab5(t_tab5.last).level_improvement := xslprocessor.valueOf(limdnlt_n,'.');
    EXCEPTION
    WHEN OTHERS THEN
    t_tab5(t_tab5.last).level_improvement := null;
    end;
    dnnum1 :=dnnum1 + 1;
    -- dnnum2 := dnnum2 + 1;
    dbms_output.put_line('message_id::::'||var1);
    end loop;
    ----dunning letter
    t_tab5(t_tab5.last).message_id := var1;
    t_tab5(t_tab5.last).dunning_msg_id := xslprocessor.valueOf(dnlt_n,'MessageID');
    t_tab5(t_tab5.last).d_level := xslprocessor.valueOf(dnlt_n,'Level');
    t_tab5(t_tab5.last).dunning_date := to_date(xslprocessor.valueOf(dnlt_n,'Date'),'YYYY-MM-DD');
    t_tab5(t_tab5.last).gross_amt := xslprocessor.valueOf(dnlt_n,'GrossAmount');
    t_tab5(t_tab5.last).currency := xslprocessor.valueOf(dnlt_n,'Currency');
    t_tab5(t_tab5.last).level_improvement := xslprocessor.valueOf(dnlt_n,'LevelImprovement');
    dnnum1 :=1; */
    end if;
    end if;
    END LOOP;
    -- Insert data into the real EMP table from the table collection.
    -- Form better performance multiple collections should be used to allow
    -- bulk binding using the FORALL construct but this would make the code
    -- too long-winded for this example.
    DBMS_OUTPUT.put_line('Step 5');
    FOR cur_emp IN t_tab1.first .. t_tab1.last LOOP
    INSERT INTO MessageTab
    message_id,
    PARTY_REF_ID,
    PARTY_REG_TYPE_AG,
    party_reg_type_rg,
    customer_grp_id,
    name,
    subname,
    datetime,
    payment_msg_id,
    gross_amt_before,
    gross_amt_current,
    currency,
    settlemen_of_balance,
    including_subsidiary_claim,
    seq_no)
    VALUES
    t_tab1(cur_emp).message_id,
    t_tab1(cur_emp).PARTY_REF_ID,
    t_tab1(cur_emp).PARTY_REG_TYPE_AG,
    t_tab1(cur_emp).PARTY_REG_TYPE_RG,
    t_tab1(cur_emp).customer_grp_id,
    t_tab1(cur_emp).name,
    t_tab1(cur_emp).subname,
    t_tab1(cur_emp).datetime,
    t_tab1(cur_emp).payment_msg_id,
    t_tab1(cur_emp).gross_amt_before,
    t_tab1(cur_emp).gross_amt_current,
    t_tab1(cur_emp).currency,
    t_tab1(cur_emp).settlemen_of_balance,
    t_tab1(cur_emp).including_subsidiary_claim,
    t_tab1(cur_emp).seq_no
    END LOOP;
    DBMS_OUTPUT.put_line('Step 6');
    if (condfpmt1 > 0) then
    FOR cur_cnf IN t_tab2.first .. t_tab2.last LOOP
    INSERT INTO ContractsWithDefaultOfPayment
    (message_id,contract_id)
    values
    (t_tab2(cur_cnf).message_id,t_tab2(cur_cnf).contract_id );
    end loop;
    end if; -- condfpmt
    if (canclnum1 > 0) then
    FOR cur_cancl IN t_tab3.first .. t_tab3.last LOOP
    INSERT INTO CancellationTab
    (message_id,cancellation_msg_id)
    VALUES
    (t_tab3(cur_cancl).message_id,t_tab3(cur_cancl).cancellation_msg_id);
    END LOOP;
    end if;
    DBMS_OUTPUT.put_line('Step 7');
    if (rtnnum1 >0) then
    FOR cur_rtndb IN t_tab4.first .. t_tab4.last LOOP
    INSERT INTO ReturnDebitNoteTab
    (message_id,
    ret_debitnote_msg_id,
    kind_of,
    reason,
    debit_note_date,
    gross_amt,
    currency
    VALUES
    (t_tab4(cur_rtndb).message_id,
    t_tab4(cur_rtndb).ret_debitnote_msg_id,
    t_tab4(cur_rtndb).kind_of,
    t_tab4(cur_rtndb).reason,
    t_tab4(cur_rtndb).debit_note_date,
    t_tab4(cur_rtndb).gross_amt,
    t_tab4(cur_rtndb).currency);
    END LOOP;
    end if;
    if (dnnum1 >0) then
    FOR cur_dnl IN t_tab5.first .. t_tab5.last LOOP
    INSERT INTO DunningLettersTab
    (message_id,
    dunning_msg_id,
    d_level,
    dunning_date,
    gross_amt,
    currency,
    level_improvement)
    VALUES
    (t_tab5(cur_dnl).message_id,
    t_tab5(cur_dnl).dunning_msg_id,
    t_tab5(cur_dnl).d_level,
    t_tab5(cur_dnl).dunning_date,
    t_tab5(cur_dnl).gross_amt,
    t_tab5(cur_dnl).currency,
    t_tab5(cur_dnl).level_improvement
    END LOOP;
    DBMS_OUTPUT.put_line('Step 8');
    end if; -- dnn
    end if; -- top msg
    end if; --- fl_seq chk
    COMMIT;
    -- Free any resources associated with the document now it
    -- is no longer needed.
    xmldom.freeDocument(v_doc);
    /* refresh array */
    t_tab_FC.delete;
    t_tab1.delete;
    t_tab2.delete;
    t_tab3.delete;
    t_tab4.delete;
    t_tab5.delete;
    /* refsh */
    end loop;
    close MessageCursor;
    END ;
    //

    Errors thrown by Oracle always show a line number (even if it points to the FOR loop that the error occurred within). When you run it, what is the error stack that is being returned. Copy and paste that, don't summarize it.
    If you are still uncertain, add a final
    EXCEPTION
      WHEN OTHERS THEN
         dbms_output.put_line(DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);to have it written out where your normal dbms_output goes. This is your friend in 10g for tracking down errors.
    "But as soon as i add a prefix in the header everything works fine."
    Is that header in the sample XML you provided? Regardless what are you adding? Your data is a clob so you can always tweak it before converting it to a DOMDocument just by doing simple string manipulation.
    Since you are in 10g, you should be using dbms_xmldom instead of xmldom. I think xmldom is just a synonym for dbms_xmldom though. Review the dbms_xmldom documentation. You can go straight from a clob to a DOMDocument via DBMS_XMLDOM.NEWDOMDOCUMENT. You can also parse the document completely using dbms_xmldom calls instead of xslprocessor calls.
    Other random things to evaluate:
    Consider turning
             FOR each_FC IN t_tab_FC.first .. t_tab_FC.last LOOP
                INSERT INTO FileControl
    into a
             FORALL i IN t_tab_FC.first .. t_tab_FC.last LOOP
                INSERT INTO FileControl
                 ...Better performance because one two context switches (PL/SQL -> SQL -> PL/SQL) instead of 2*n switches.
    I like this construct better
       TYPE tab_type IS TABLE OF FileControl%ROWTYPE INDEX BY BINARY_INTEGER;
       t_tab_FC tab_type := tab_type;because then you don't have to       t_tab_FC.extend;you can just do something like     index := 1;
         LOOP
            t_tab_FC(index).creation_date := <whatever>;
            index := index + 1;
         END LOOPYou also have the option of parsing your XML as a XMLType, including purely in SQL, but you can research that avenue at a later date.
    Forgot to mention, wrap any code examples in [ pre ] [ pre ] (without the spaces) to retain your formatting.

  • How to parse multiple xml documents from single buffer

    Hello,
    I am trying to use jaxb 2.0 to parse a buffer which contains multiple xml documents. However, it seems that it is meant to only parse a single document at a time and throws an exception when it gets to the 2nd document.
    Is there a way I can tell jaxb to only parse the first complete document and not fetch the next one out of the buffer? Or what is the most efficient way to separate the buffer into two documents without parsing it manually. If I have to search the buffer for the next document root and then split the buffer, it seems like that defeats the purpose of using jaxb as the parser.
    I am using the Unmarshaller.unmarshall method and the exception I am getting is:
    org.xml.sax.SAXParseException: Illegal character at end of document, &#x3c;.]
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:315)
         at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:476)
         at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:198)
         at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:167)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
    Thank you for your help

    It's just like any other XML parser, it's only designed to parse one XML document. If you have something that concatenates two XML documents together (that's what your "buffer" sounds like), then stop doing that.

  • Can't parse a XML file

    Hello,
    I'm using OracleJSP + XML Parser v2 Java.
    I've got the following XML:
    <ongletmenu>
    <onglet>
    <name>Proprietes</name>
    <link>proprietes.jsp</link>
    </onglet>
    <onglet>
    <name>Personnes</name>
    <link>personnes.jsp</link>
    </onglet>
    <onglet>
    <name>Formations prorposees</name>
    <link>formations.jsp</link>
    </onglet>
    </ongletmenu>
    And I want to parse this file with a JSP file:
    <%@ page import="java.io.*" %>
    <%@ page import="java.net.*" %>
    <%@ page import="org.w3c.dom.*" %>
    <%@ page import="org.xml.sax.*" %>
    <%@ page import="arfopa.XSLT" %>
    <%
    String retour="";
    DOMParser parser = new DOMParser();;
    XMLDocument theXMLDoc;
    parser.setPreserveWhitespace(true);
    parser.setValidationMode(true);
    parser.showWarnings(true);
    try { parser.parse("onglets_organismes.xml"); }
    catch (SAXParseException s) { out.println(s.getMessage()); }
    theXMLDoc = parser.getDocument();
    NodeList nl = XSLT.select(theXMLDoc, "//onglet");
    // Print Out the Names of the Matching Items
    int matches = nl.getLength();
    for (int i = 0; i < matches; i++ ) {
    retour += XSLT.valueOf( nl.item(i), "name");
    %>
    <%=retour%>
    The JSP file doesn't want to parse the file
    (parser.parse). Any idea?
    Nicolas
    null

    Problem is that the string you pass the parse() method must be a valid string representation of a URL.
    The string "onglets_organismes.xml" isn't.

  • Parsing an xml string into id-value pair format

    Hi,
    I am new in oracle BPEL.
    My requirement is that I need to parse an xml string containing tag name and coressponding value into an 'id -value' pair.
    For example-
    The input xml format is -
    <employee>
    <empid>12345</empid>
    <name>xyz</name>
    <city>London</city>
    </employee>
    The required xml format is-
    <employee>
    <item id="empid" value="12345"/>
    <item id="name" value="xyz"/>
    <item id="city" value="London"/>
    </employee>
    Please let me know if there is a work-around for this.
    Thanks

    Something like this (have not tested):
    <xsl:for-each select="//employee">
    <employee>
    <xsl:for-each select="./*">
    <item>
    <xsl:attribute name="id">
    <xsl:value-of select="name()"/>
    </xsl:attribute>
    <xsl:attribute name="value">
    <xsl:value-of select="text()"/>
    </xsl:attribute>
    </item>
    </xsl:for-each>
    </employee>
    </xsl:for-each>

  • Parsing an XML string

    How would I get the Oracle XML Parser to parse an XML string?
    The example ("DOMSample") only demonstrates how to parse an XML
    file -- I would like to do something of the form...
    parser.parse("<test>testing</test>");
    On a related note, whilst the PL/SQL utilities are helpful, I
    would like to see more in the way of documentation and examples
    for the Parser itself, showing more examples of DOM API calls and
    perhaps a complete worked example (including a DTD).
    Keep up the good work!
    Many thanks,
    Ian Brettell,
    Indus International.
    null

    Ian Brettell (guest) wrote:
    : How would I get the Oracle XML Parser to parse an XML string?
    : The example ("DOMSample") only demonstrates how to parse an XML
    : file -- I would like to do something of the form...
    : parser.parse("<test>testing</test>");
    With the latest version, 1.0.0.1, now available, you can use the
    InputStream and InputSource methods. Please see the doc for
    details.
    : On a related note, whilst the PL/SQL utilities are helpful, I
    : would like to see more in the way of documentation and examples
    : for the Parser itself, showing more examples of DOM API calls
    and
    : perhaps a complete worked example (including a DTD).
    : Keep up the good work!
    : Many thanks,
    : Ian Brettell,
    : Indus International.
    Thanks for the input. I will pass it onto the documentation team.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

Maybe you are looking for