How to write XML Parser??

Hi all,
i have an XML file and its structure is like this and i have to write a parser to get the details from this XML and put it in the nodes.
Please help me out in the procedure and code
<?xml version="1.0" encoding="UTF-8" ?>
- <GAEB xmlns="http://xxxxxxx_XML/200407">
- <GAEBInfo>
  <Version>3.1</Version>
  <VersDate>2007-06</VersDate>
  <Date>2009-02-15</Date>
  <Time>15:11:12</Time>
  <ProgSystem />
  <ProgName>CONSTRUCTION_SUITE V12.4.342</ProgName>
  </GAEBInfo>
- <PrjInfo>
  <NamePrj>SAP2</NamePrj>
  <LblPrj>The Pad on Plot No.BB.B01.061 at Business Bay</LblPrj>
  <Cur>ser</Cur>
  <CurLbl>trt</CurLbl>
  <AlterBidPerm>Yes</AlterBidPerm>
  </PrjInfo>
- <Award>
  <DP>81</DP>
- <AwardInfo>
  <Cur>ser</Cur>
  <CurLbl>trt</CurLbl>
  </AwardInfo>
- <OWN>
  <Address />
  </OWN>
- <BoQ ID="DAODAAAA">
- <BoQInfo>
  <Name>02</Name>
  <LblBoQ>Bill NO.2 - Site Work</LblBoQ>
  <Date>2008-07-02</Date>
  <OutlCompl>AllTxt</OutlCompl>
- <BoQBkdn>
  <Type>BoQLevel</Type>
  <LblBoQBkdn>Division</LblBoQBkdn>
  <Length>2</Length>
  <Num>Yes</Num>
  </BoQBkdn>
- <BoQBkdn>
  <Type>Item</Type>
  <Length>1</Length>
  <Num>No</Num>
  <Alignment>left</Alignment>
  </BoQBkdn>
- <BoQBkdn>
  <Type>Index</Type>
  <Length>1</Length>
  <Num>No</Num>
  <Alignment>left</Alignment>
  </BoQBkdn>
  </BoQInfo>
- <BoQBody>
- <BoQCtgy ID="DBAHAAAA" RNoPart="1">
- <LblTx>
- <p>
  <span>Page No.2/1</span>
  </p>
  </LblTx>
- <BoQBody>
- <Itemlist>
- <Remark ID="DBAHADGA">
- <Description>
- <CompleteText>
- <DetailTxt>
- <Text>
- <p style="text-align:left;">
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">SITE WORKS</span>
  <br />
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">EARTH WORKS</span>
  <br />
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">Excavate in any material from reduced level (-7.6</span>
  <br />
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">DMD) including levelling and compacting the bottom</span>
  <br />
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">of excavation as specified in stages as necessary</span>
  </p>
  </Text>
  </DetailTxt>
- <OutlineText>
- <OutlTxt>
- <TextOutlTxt>
- <p>
  <span>SITE WORKS</span>
  <br />
  <span>EARTH WORKS</span>
  <br />
  <span>Excavate in any material from reduced level (-7.6</span>
  <br />
  <span>DMD) including levelling and compacting the bottom</span>
  <br />
  <span>of excavation as specified in stages as necessary</span>
  </p>
  </TextOutlTxt>
  </OutlTxt>
  </OutlineText>
  </CompleteText>
  </Description>
  </Remark>
- <Item ID="DBAHAEOA" RNoPart="A">
  <Qty>8738.000</Qty>
  <PredQty>8738.000</PredQty>
  <QU>m3</QU>
- <Description>
- <CompleteText>
- <DetailTxt>
- <Text>
- <p style="text-align:left;">
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">Excavation to raft foundation</span>
  </p>
  </Text>
  </DetailTxt>
- <OutlineText>
- <OutlTxt>
- <TextOutlTxt>
- <p>
  <span>Excavation to raft foundation</span>
  </p>
  </TextOutlTxt>
  </OutlTxt>
  </OutlineText>
  </CompleteText>
  </Description>
  </Item>
- <Remark ID="DBAHAHJI">
- <Description>
- <CompleteText>
- <DetailTxt>
- <Text>
- <p style="text-align:left;">
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">Disposal</span>
  </p>
  </Text>
  </DetailTxt>
- <OutlineText>
- <OutlTxt>
- <TextOutlTxt>
- <p>
  <span>Disposal</span>
  </p>
  </TextOutlTxt>
  </OutlTxt>
  </OutlineText>
  </CompleteText>
  </Description>
  </Remark>
- <Item ID="DBAHAJBI" RNoPart="B">
  <Qty>8738.000</Qty>
  <PredQty>8738.000</PredQty>
  <QU>m3</QU>
- <Description>
- <CompleteText>
- <DetailTxt>
- <Text>
- <p style="text-align:left;">
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">Disposal of excavated materials, away from site to</span>
  <br />
  <span style="font-family:Arial;font-size:medium;color:rgb(0,0,0);">approved tips as directed by the Engineer</span>
  </p>
  </Text>
  </DetailTxt>
- <OutlineText>
- <OutlTxt>
- <TextOutlTxt>
- <p>
  <span>Disposal of excavated materials, away from site to</span>
  <br />
  <span>approved tips as directed by the Engineer</span>
  </p>
  </TextOutlTxt>
  </OutlTxt>
  </OutlineText>
  </CompleteText>
  </Description>
  </Item>
    </Itemlist>
  </BoQBody>
  </BoQCtgy>
  </BoQBody>
  </BoQ>
  </Award>
  </GAEB>
Thanks,
Suresh

Hi,
Following are some of them DOM,SAX ...
http://www.devx.com/xml/Article/16921
Regards
Ayyapparaj

Similar Messages

  • How to write XML with attributes to a table in Oracle?

    I tried to find solutions over the internet. Some of the stuff I looked at:https://forums.oracle.com/thread/2182669 http://www.club-oracle.com/forums/how-to-insert-data-from-xml-to-table-t2845/
    In all these cases, the solution considers XML structure with only nodes and child nodes but not attributes. In fact, one of the solutions suggests transforming the XML into a canonical form with only nodes w/o attributes.
    This is a sample of xml structure I am working with:
    Sample XML
    <rep type="P" title="P List"> <as> <a id="3" /> <a id="4" /> </as> </rep>
    I am working with oracle client 11.2 and SQL developer
    My question is: how to write XML data into a table with attributes also as column values, beside the nodes?

    My question is: how to write XML data into a table with attributes also as column values, beside the nodes
    The question you should be asking is : "how do I access attributes in the XPath language?"
    and the answer to that is easily found in any XPath tutorial you may find over the Internet, it is not related to Oracle in particular.
    Short answer : you use an "attribute::" axis before the attribute name, or more commonly a "@", e.g. @type, @id etc.
    Using the method described in the first link, something like this will extract the root attributes :
    SELECT x.*
    FROM XMLTable(
           '/rep'
           passing <xmltype variable/column goes here>
           columns type  varchar2(1)  path '@type'
                 , title varchar2(30) path '@title'
    ) x ;
    For deeper levels, use additional XMLTable calls as described in the mentioned post.

  • Please help; how to write XML document with JSP?

    I try to write XML document with JSP...
    But I got wrong results everytime.
    The result is not XML file displayed in the browser,
    but HTML file.
    I even tried to use HTML special code for <, >, "
    but still display as HTML file not XML file.
    How to do this?
    Thanks in advance. I put my codes below.
    Sincerely,
    Ted.
    ================
    Here is code for the JSP (called stk.jsp):
    <%@ page contentType="text/xml" %>
    <%@ page import="bean.Stock" %>
    <jsp:useBean id="portfolio" class="bean.Portfolio" />
    <% java.util.Iterator pfolio = portfolio.getPortfolio();
    Stock stock = null; %>
    <?xml version="1.0" encoding="UTF-8"?>
    <portfolio>
    <% while (pfolio.hasNext())
    stock = (Stock) pfolio.next(); %>
    <stock>
    <symbol>
    <%=stock.getSymbol() %>
    </symbol>
    <name><%=stock.getName() %> </name>
    <price><%=stock.getPrice() %> </price>
    </stock>
    <% } %>
    </portfolio>
    =================
    Here is the code for bean.Stock:
    package bean;
    public class Stock implements java.io.Serializable
    String symbol, name;
    float price;
    public Stock(String symbol, String name, float price)
    this.symbol = symbol;
    this.name = name;
    this.price = price;
    public String getSymbol()
    return symbol;
    public String getName()
    return name;
    public float getPrice()
    return price;
    ===============
    And here is bean.Portfolio:
    package bean;
    import java.util.Iterator;
    import java.util.Vector;
    public class Portfolio implements java.io.Serializable
    private Vector portfolio = new Vector();
    public Portfolio()
    portfolio.addElement(new Stock("SUNW", "Sun Microsystem", 34.5f));
    portfolio.addElement(new Stock("HWP", "Hewlett Packard", 15.15f));
    portfolio.addElement(new Stock("AMCC", "Applied Micro Circuit Corp.", 101.35f));
    public Iterator getPortfolio()
    return portfolio.iterator();
    }

    Hi
    I'm not sure whta your query is but I tested your code as it is has been pasted and it seems to work fine. There is an XML output that I'm getting.
    Keep me posted.
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems
    http://www.sun.com/developers/support

  • How to write xml

    I'm a bit of a newbie to xml so apologies if I am going over old ground. I am trying to find the most productive way to write xml, every time I try and create an xsd from my file it keeps throwing up lots of validation errors, can anyone recommend the best way, by this i mean fastest and most time saving way to write xml using software to check my work as I type, does such a thing exist? thanks in advance for your replies.

    to answer your question, yes you can use software to make the job easier, most professional programmers would typically use something called an 'xml editor' for this kind of work, the one I use is [Liquid XML Editor|http://www.liquid-technologies.com/xml-editor.aspx] because it's cheap, you can get more expensive ones but it's all down to what you want it to do. However if you are having issues writing valid xml I would probably suggest you have a look at the [W3 website|http://www.w3.org] which covers all the standards for xml and [W3 schools |http://www.w3schools.com] which is basically an online resoure of learning materials for xml. There's a fairly good review site of xml editors here [http://www.xml-editors.info|http://www.xml-editors.info]

  • How to edit XML parsed data and save on iPhone app

    Hi,
    How to edit and XML retrieved data that is displayed on an iPhone app and save again in the same XML file using iPhone SDK.
    In other words I want to change the XML file data or edit and save.
    Thnx in advance.
    Regards
    Amit

    Hello amit,
    No, not at all. Surely you will parse your XML file using the NSXMLParser class. OK! i think i get it now, do you wants to change/modify the value of any tag in the XML file? For that you will be required to parse your XML file using NSXMLParser class, and fill out some data structure (according to the the XML format) do some changes into your data structure, and then write your XML to the file (according to the edited data structure) using the method i told u earlier. This is what my preferred method is, and i am pretty much sure that it is not a bad way to do this at all.
    Hope this clarifies some of your queries.
    Best regards,
    Obaid

  • How to write xml to updated regulary PO to SO

    Hi all expert,
    I had write the xml B1 Scenario which PO to SO. The problem is the system only integrated when new PO add in at database A, then SO at database B created. Meanwhile user go to add in additional item in the PO. The SO cannot be updated. Any idea for the script?
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
         <xsl:output method="xml" encoding="UTF-8" indent="yes" />
         <!From SystemID>
         <xsl:param name="CustomerNumber" select="/b1im:B1IMessage/b1im:Header/b1im:System/sim:PropertyList/sim:Property[@Key='Subsidiaries Customer Number']/@Value" />
      <xsl:template match="/">
              <xsl:apply-templates select="b1im:B1IMessage/b1im:Body/b1im:Payload[starts-with(@ObjectTypeId,'B1.200') and contains(@ObjectTypeId,'_PO')]/BOM"/>
         </xsl:template>     
         <xsl:template match="b1im:B1IMessage/b1im:Body/b1im:Payload[starts-with(@ObjectTypeId,'B1.200') and contains(@ObjectTypeId,'_PO')]/BOM">
              <BOM>
                   <BO>
                        <AdmInfo>
                             <Object>17</Object>
                             <Version>2</Version>
                        </AdmInfo>
                        <Documents>
                             <row>
                                  <DocType>dDocument_Items</DocType>
                                  <CardCode>
                                       <xsl:value-of select="$CustomerNumber" />
                                  </CardCode>
                                  <DocDate>
                                       <xsl:value-of select="BO/Documents/row/DocDate" />
                                  </DocDate>
                                  <DocDueDate>
                                       <xsl:value-of select="BO/Documents/row/DocDueDate" />
                                  </DocDueDate>
                                                    <Comments>
                                       <xsl:value-of select="BO/Documents/row/Comments" />
                                  </Comments>
                             </row>
                        </Documents>
                        <Document_Lines>
                             <xsl:for-each select="BO/Document_Lines/row">
                                  <row>
                                       <LineNum>
                                            <xsl:value-of select="LineNum" />
                                       </LineNum>
                                       <ItemCode>
                                            <xsl:value-of select="ItemCode" />
                                       </ItemCode>
                                       <Weight1>
                                            <xsl:value-of select="Weight1" />
                                       </Weight1>
                                       <Quantity>
                                            <xsl:value-of select="Quantity" />
                                       </Quantity>
                                          <Price>
                                            <xsl:value-of select="Price" />
                                       </Price>
                                                     <!--   <LineTotal>
                                            <xsl:value-of select="LineTotal" />
                                       </LineTotal> -->
                                       <U_GRField>
                                            <xsl:value-of select="U_BRField" />
                                       </U_GRField>
                                                            <U_B1_Price>
                                                                    <xsl:value-of select="Price" />
                                       </U_B1_Price>
                                  </row>
                             </xsl:for-each>
                        </Document_Lines>
                   </BO>
              </BOM>
         </xsl:template>
         <xsl:template name="deleteLeadingZero">
              <xsl:param name="strFragment" />
              <xsl:variable name="len" select="string-length($strFragment)" />
              <xsl:choose>
                   <xsl:when test="$strFragment= '0'" />
                   <xsl:when test="len &lt;= 1 or substring($strFragment,1,1) != '0'">
                        <xsl:value-of select="$strFragment" />
                   </xsl:when>
                   <xsl:otherwise>
                        <xsl:call-template name="deleteLeadingZero">
                             <xsl:with-param name="strFragment" select="substring($strFragment, 2, $len - 1)" />
                        </xsl:call-template>
                   </xsl:otherwise>
              </xsl:choose>
         </xsl:template>
    </xsl:stylesheet>
    Regards,
    Eric Tan

    Hi Eric,
    Sorry for the late response. You should be used to this document [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/0bf4978f-0e01-0010-2d89-c140ac1177da]. This is the example for that document. [https://www.sdn.sap.com/irj/sdn/softwaredownload?download=/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/business%20one/b1_to_b1_business_integration_unit.zip]. Both should give you a good idea about what's going on, and how to configure the business units.
    Regards,
    Ian

  • How to write XML into file using JSP

    Hello,
    I am parsing a XML file, then updating some of it content and trying to write back the updated file into the same location as an xml document but its not happening correctly....it gets written like this.
    &_lt;db_name&_gt;dataext&_lt;/db_name&_gt;
    Here is my code......somebody please advise
    <%@ page contentType="text/html"%>
    <%@ page import="java.io.*,
                        java.util.*,
                        org.jdom.*,
                        org.jdom.input.SAXBuilder,
                        org.jdom.output.*" %>
    <%
    String xml_file = "webapps/root/web-inf/admin.xml";
    SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
    Document l_doc = builder.build(new File(xml_file));
    Element root = l_doc.getRootElement();
    List admin = root.getChildren("db");
    Iterator loop = admin.iterator();
    while ( loop.hasNext()) {
         Element ele = (Element)loop.next();
         String state = ele.getChild("state").getText();
         String name = ele.getChild("db_name").getText();
         String ip = ele.getChild("db_ip").getText();
         if(state.equals("Florida")) {
              ele.getChild("db_ip").setText("209.11.111.1");
    XMLOutputter l_format = new XMLOutputter();
    String ls_result = l_format.outputString(l_doc);
    root.setText(ls_result);
    ls_result = l_format.outputString(l_doc);
    %>
    <html><head><title></title></head>
    <body>
    <%
         try {
              FileOutputStream ostream = new FileOutputStream("c:\\admin.xml");
              ObjectOutputStream p = new ObjectOutputStream(ostream);
              p.writeObject(ls_result);
              p.flush();
              ostream.close();
         catch(Exception e) {
              out.println(e.toString());
    %>
    </body>
    </html>     

    thanks amgandhi.....
    I found a solution for it, courtesy of this site:
    http://www.topxml.com/tutorials/main.asp?id=jdom&page=15
    <-********************************************************->
    import org.jdom.output.XMLOutputter;
    import org.jdom.*;
    import java.io.*;
    import java.util.*;
    // Write a program that creates document with a
    // single root element. Add a comment to the
    // root element, and assign the document's XML to
    // a local string. Finally, write the String to
    // System.out, and write the document to a text file.
    // For bonus points, allow the user to specify the
    // file name on the command line.
    public class ws3
    public static void main(String[] args)
    String filename = "default.xml";
    if(args.length > 0) filename = args[0];
    Element root = new Element("simple");
    Document doc = new Document(root);
    Comment cmt = new Comment("A bare document!");
    root.addContent(cmt);
    XMLOutputter outputter = new XMLOutputter(" ",
    true);
    String xml = outputter.outputString(doc);
    System.out.println(xml);
    writeToFile(filename, doc);
    private static void writeToFile(String fname,
    Document doc)
    try {
    FileOutputStream out =
    new FileOutputStream(fname);
    XMLOutputter serializer =
    new XMLOutputter(" ", true);
    serializer.output(doc, out);
    out.flush();
    out.close();
    catch (IOException e) {
    System.err.println(e);
    }

  • How to write xml data to a file

    Hi all,
    We have a requirement of writing the xml data into a file in given directory in the server. Generating the xml data using the sql query below.
    SELECT XMLELEMENT ("ROW",
    XMLELEMENT ("CELL", xmlattributes ('EBIZCZMDL_01' AS "colname"), inventory_item_id),
    XMLELEMENT ("CELL", xmlattributes ('EBIZFFMT_01' AS "COLNAME"), attribute29),
    XMLELEMENT ("CELL", xmlattributes ('COMMON' AS "COLNAME"),inventory_item_id || '' || attribute29 || 'ITM')
    AS "RESULT") "XMLDATA"
    FROM apps.mtl_system_items_b
    When we try to write the the data from this query to a file using UTL_FILE.put_line, the script gives the error
    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    If somebody can help us pls.......
    Thanks in advance

    Hi Odie,
    We are looking at the xml data to be like the below:
    - <xref xmlns="http://xmlns.oracle.com/xref">
    - <table name="NAPP_ITEM_ITEMID">
    - <columns>
    <column name="EBIZFFMT_01" />
    <column name="COMMON" />
    <column name="EBIZQOT_01" />
    <column name="EBIZCZMDL_01" />
    <column name="EBIZCZGOLD_01" />
    </columns>
    - <rows>
    - <row>
    <cell colName="EBIZFFMT_01">154</cell>
    <cell colName="COMMON">154811809990111362727</cell>
    <cell colName="EBIZQOT_01">81</cell>
    <cell colName="EBIZCZMDL_01">91</cell>
    <cell colName="EBIZCZGOLD_01">991</cell>
    </row>
    - <row>
    <cell colName="EBIZFFMT_01">180</cell>
    <cell colName="COMMON">180811809990111362727</cell>
    <cell colName="EBIZQOT_01">871</cell>
    <cell colName="EBIZCZMDL_01">731</cell>
    <cell colName="EBIZCZGOLD_01">341</cell>
    </row>
    </rows>
    </table>
    </xref>
    We have managed half way trying to get the structure. As we are new to this XML Programming.
    The call to dbms_xslprocessor.clob2file is within the cursor loop for the given SQL.
    DECLARE
    l_file_name VARCHAR2 (30);
    l_file_path VARCHAR2 (200);
    CURSOR xml_cur
    IS
    SELECT XMLELEMENT
    ("ROW",
    XMLELEMENT ("CELL",
    xmlattributes ('EBIZCZMDL_01' AS "colname"),
    inventory_item_id
    XMLELEMENT ("CELL",
    xmlattributes ('EBIZFFMT_01' AS "COLNAME"),
    attribute29
    XMLELEMENT ("CELL",
    xmlattributes ('COMMON' AS "COLNAME"),
    inventory_item_id || '' || attribute29 || 'ITM'
    ) AS "RESULT"
    ) "XMLDATA"
    FROM apps.mtl_system_items_b
    WHERE attribute29 IS NOT NULL;
    BEGIN
    l_file_path := '/usr/tmp';
    l_file_name := 'TEST_XREF4.xml';
    FOR xml_rec IN xml_cur
    LOOP
    dbms_xslprocessor.clob2file(xml_rec.XMLDATA, l_file_path, l_file_name, nls_charset_id('UTF8') );
    END LOOP;
    END;
    Please see the above code snippet and help us if we are doing something wrong.
    Thank you

  • How to write xml doc to file in PL/SQL

    I have a function defined that uses xmlgen.getxml to generate an xml confirmation document. I am calling this function from a trigger and would like to have the returned xml document (a clob) written to an OS file. Can anyone help me with this issue?
    Thanks,
    John

    declare
    TYPE weak_cursor_type is REF CURSOR;
    curOUT weak_cursor_type;
    vOUT clob;
    begin
    open curOUT FOR SELECT xmlgen.getXML('select * from all_users',1) XML_TXT FROM DUAL;
    fetch curOUT into vOUT;
    sp_gen_util.output_clob(vOUT,80,'file');
    sp_gen_util.output_str(vOUT, 250, 'screen');
    end;
    ----part of package sp_gen_util----
    ------------- package variables --------------
    SUBTYPE max_str_type is varchar2(32767);
    wk_CR char:=chr(10);
    MAX_STR_LEN constant number:= 32767;
    --- driver routine. calls "open_file_function"
    --- and "LOBPrint"
    --- assumptions: that UTL_DIR has been set in INIT.ORA
    --- to support any directories passed
    --- inputs: CLOB for output
    --- line_length (only affects screen output just now)
    --- destination (currently allows "screen" and "file")
    --- file_status ("a" append, "w" open for write)
    --- dirname (directory path for file)
    --- filename (file name for write or append)
    PROCEDURE output_clob (
    p_str clob,
    p_line_length number DEFAULT 80,
    p_destination varchar2 DEFAULT 'screen',
    p_status varchar2 DEFAULT 'a',
    p_dirname varchar2 DEFAULT '/tmp',
    p_filename varchar2 DEFAULT 'write_host_file.log' ) IS
    v_outfile utl_file.file_type;
    begin
    wk_substr_len:=p_line_length;
    if p_destination='file' then
    v_outfile := open_file_fun(p_status, p_dirname, p_filename);
    end if;
    LOBPrint(p_str,p_destination,v_outfile);
    if p_destination='file' then
    utl_file.fclose(v_outfile);
    end if;
    end output_clob;
    --- loops through blocks of text by delimiter (carriage return)
    --- and writes to either the screen or file
    --- (output to screen needs work for clob...currently using
    --- "output_str" instead for <32k strings instead)
    --- inputs: CLOB for output
    --- destination (currently allows "screen" and "file")
    --- filehandle (open filehandle from openfile routine)
    PROCEDURE LOBPrint(
    p_str clob,
    p_destination varchar2,
    v_outfile utl_file.file_type default null ) is
    ---------------local working variables
    wk_str max_str_type; --MAX=32767
    wk_offset INTEGER := 1;
    wk_clob clob;
    wk_clob_len number;
    wk_clob_len2 number;
    wk_max_loops number:=70000;
    begin
    wk_clob_len:= dbms_lob.getlength(p_str);
    if wk_clob_len <= MAX_STR_LEN
    and p_destination='file' then
    --- NOTE: dbms_lob.substr parameters are OPPOSITE of sql substr
    utl_file.put_line(v_outfile, dbms_lob.substr( p_str, wk_clob_len, 1));
    elsif wk_clob_len > MAX_STR_LEN then
    dbms_lob.createtemporary(wk_clob, TRUE, dbms_lob.call);
    --- wk_clob: LOB locator of the copy target.
    --- p_str: LOB locator of source for the copy.
    --- wk_clob_len: Number of bytes (for BLOBs) or characters (for CLOBs)
    --- to copy.
    --- 1: Offset in bytes or characters in the destination LOB
    --- (origin: 1) for the start of the copy.
    --- 1: Offset in bytes or characters in the source LOB
    --- (origin: 1) for the start of the copy.
    dbms_lob.copy(wk_clob, p_str, wk_clob_len, 1, 1);
    LOOP
    wk_str:=word_parse_trim_lob_FUN(wk_clob,wk_CR);
    if p_destination='file' then
    utl_file.put_line(v_outfile, wk_str);
    elsif p_destination='screen' then
    dbms_output.put_line(wk_str);
    end if;
    wk_clob_len2:= dbms_lob.getlength(wk_clob);
    EXIT WHEN wk_clob is null ;
    END LOOP;
    end if;
    END LOBPrint;
    --- "function with side-effect"
    --- input is CLOB, with is "returned" without leading field
    --- additional parameter is field (or token) delimiter
    --- value returned is leading field from input string
    FUNCTION word_parse_trim_lob_FUN(o_str IN OUT NOCOPY clob,
    p_delimiter IN varchar2) RETURN varchar2
    IS
    o_token max_str_type;
    clob_len number;
    next_pos number;
    wk_clob clob;
    BEGIN
    clob_len:= dbms_lob.getlength(o_str);
    next_pos:= dbms_lob.instr(o_str, p_delimiter, 1, 1);
    if next_pos != 0 then
    -- NOTE: dbms_lob.substr parameters are OPPOSITE of sql substr
    dbms_lob.createtemporary(wk_clob, TRUE, dbms_lob.call);
    o_token:= dbms_lob.substr( o_str, next_pos-1, 1);
    -- o_str:= dbms_lob.substr(o_str,clob_len-next_pos,next_pos+1);
    if next_pos = clob_len then
    wk_clob := null;
    else
    --- wk_clob: LOB locator of the copy target.
    --- o_str: LOB locator of source for the copy.
    --- clob_len: Number of bytes (for BLOBs) or characters (for CLOBs)
    --- to copy.
    --- 1: Offset in bytes or characters in the destination LOB
    --- (origin: 1) for the start of the copy.
    --- next_pos+1: Offset in bytes or characters in the source LOB
    --- (origin: 1) for the start of the copy.
    dbms_lob.copy(wk_clob, o_str, clob_len, 1, next_pos+1);
    end if;
    else
    o_token:= dbms_lob.substr( o_str, MAX_STR_LEN, 1);
    end if;
    o_str := wk_clob;
    RETURN(o_token);
    EXCEPTION
    when others then
    null;
    -- dbms_output.put_line('Error:'||SQLCODE||',text:'||SQLERRM);
    END word_parse_trim_lob_FUN;

  • How to write xml from odi model directly to XMLType field in database?

    I've created xml model and populated it with data.
    How can I save it directly to the XMLType field in Oracle 10g database?

    You only have the option of all or nothing, you don't have the option of writing one file for each of the root elements.
    SYNCHRONIZE to FILE
    See the Driver doc at: http://download.oracle.com/docs/cd/E14571_01/integrate.1111/e12644/appendix_xml_driver.htm#CHDICHDB
    and specifically: http://download.oracle.com/docs/cd/E14571_01/integrate.1111/e12644/appendix_xml_driver.htm#CHDGDDDF

  • How to write xml files

    I have a simple jsp page having name and id field, when user submits the page, it will create a xml file having datas of the user entered.and later if another user add his data, then it will update the xml file

    Extract the name, id whatever fields from the jsp page into a bean after submit. Then you can use DOM or SAX parser implementation to create a new xml file for the values you are now in your bean from jsp page.
    You can create the XML using DOM or SAX parsers. The implementation of those are almost easy. For better work you can also use JAXB if the application is complex or the XML format is complex and huge.
    -Sachin
    I have a simple jsp page having name and id field,
    when user submits the page, it will create a xml
    file having datas of the user entered.and later if
    another user add his data, then it will update the
    xml file

  • Installing xml parser jar files in oracle 8i

    hi list
    please i need help on how to install xml parser jar files manually into the database
    we have 8i running on windowsNT box
    i have checked my database these classes are not there .
    thanks

    You'll need to use the LOADJAVA program. Check out the Oracle XML Portal website. It has information on how to do this.
    www.webspedite.com/oracle

  • Can I install XML parser for Java in Windows 98?

    Could someone tell me how to install XML parser for Java in my PC Windows98 (I already installed JDK1.3)? Or it can not be installed in Windows98?
    Thanks in advance!

    There's no reason why it shouldn't work on any platform for which JDK1.3 is available. If you're using the batch files shipped with XDK to run the parser, you might need to change the syntax slightly; in any event the key command is just
    java -cp c:\xdk\lib\xmlparserv2.jar oracle.xml.parser.v2.oraxml %xdkparm%Brian

  • Using kxml2 to write xmls

    hi everybody i wanna read and write xmls in movile application, somebody here told me to use kxml, i downloaded kxml2 but there is no documentation about how to write xml just how to read, any link you could provide me? pleaseeeeeee or another package to use..

    I'm not sure that I understand the nature of your question. You are inserting data into a spreadsheet, which is composed entirely of cells, so you have to tell Excel into which cells you want to insert your data. If you don't care which cells they go into, why not just specify (0,0)? Is there any particular reason why you don't want to specify a range?
    Kind Regards,
    E. Sulzer
    Applications Engineer
    National Instruments

  • SAP XML Parser

    Hi,
    Can anyone tell me how the SAP XML Parser works in Abap?
    And how to use it?
    Thanks & Regards,
    Jeba.

    hi jeba,
    Prior to SAP ERP 6.0 Enhancement Package 2 (EhP2), loading data for Central Contractor Registration (CCR) was a two-step process: data was first read from a flat file and preloaded into SAP tables, then a separate program was executed to create or update vendor master records by means of CREMAS05 iDoc. When EhP2 is installed, new CCR programs (FMFGCCR_CREATE and FMFGCCR_UPDATE) can be customized by means of an enhancement implementation to access CCR data in real time – for example, using Point-to-Point or XI interface with the CCR server (see the documentation and sample implementation classes for enhancement spot FMFG_CCR_PROCESS).
    New CCR create/update programs available in EhP2 receive and process CCR data which includes creating and updating SAP vendor master records based on the provided mapping of CCR fields into SAP vendor master fields as well as creating/updating records in the SAP CCR tables. Design of the main program RFFMCCRVENDORCREATE01 is independent of the data source and of the method of processing the data. Default method of creating CCR records in SAP is defined by the default implementation of Enhancement Spot FMFG_CCR_VENDOR_MAINTAIN - FMFG_CCR_VENDOR_MAINTAIN_IMPL and is based on the method call to method MAINTAIN of vendor master class interface VMD_EI_API.
    The data source as well as mapping from the data source to SAP CCR table fields and SAP vendor master fields is completely customizable and has to be defined in a custom implementation of Enhancement Spot FMFG_CCR_PROCESS.
    We deliver two sample implementations for a CCR interface: one is based on SAP Exchange Infrastructure (XI) and one is a Point-to-Point (P2P) interface. You can define other data sources, such as a flat file or an RFC call to another system, yourself.
    The XI sample solution includes XI interface with XML based mapping for Request and Response messages to and from the CCR server. The SAP CCR create/update program calls a proxy method, which is automatically generated based on the CCR XML schema used in XI, to request and receive CCR data through the XI middleware. Use of XI allows interfacing with additional systems as part of the CCR interface as well as provides extensive XML parsing, mapping, validation, and error handling features. Setting up XI based interface requires some minimal XI configuration and implementation of the XI based sample BAdI implementation CL_FMFG_CCR_PROCESS_SAMPLE for enhancement spot FMFG_CCR_PROCESS.
    The P2P sample solution defines a P2P interface directly between the ERP layer and the CCR server by means of an HTTP communication protocol. This method might be more appealing to the customers who cannot use XI in their SAP landscapes. Here all XML mapping and parsing are defined in the custom implementation of the method GET_DATA.
    New CCR Tables
    The following new CCR tables were introduced in EhP2
    &#9679;      FMCCRVENDOR_HDR (CCR Vendor Header)
    &#9679;      FMCCRVENDOR_CORP (CCR Vendor Corporate Information)
    &#9679;      FMCCRVENDOR_GS (CCR Vendor Goods and Services)
    Table FMCCRTVENDOR is not populated by the new CCR programs.
    Please reward if helpful.

Maybe you are looking for