Downloading and parsing XML during preload

Apologies if this topic has already been covered but the
search function on the forums doesn't appear to be working for me.
My problem is this. I have a flex app that needs to download
a couple of xml files during initialization that are approximately
2-3 MB each. I'd like for the progress bar to continue showing
until the files are downloaded and parsed and only after the files
are downloaded and parsed, would the components start to be
rendered since some of them will require the files to determine
their look and feel.
Any ideas or places I should look to in order to figure this
out?
Thanks
Sang

Greg_B,
You could try and access the XML file via a file:// URI rather than an http:// one - this would not need the server to be started in order to get the xml/dtd loaded. You know the relative path to the dtd and xml files, and you can create a File object from there, so you can parse the xml file that way if you like.
Here's some code to help:
String filename = getServletContext().getRealPath("myXML.xml");
You can then pass the filename string as a parameter to the XML (I'm assuming you're using DOM but if you aren't I think you'll still get my point) parse method.
You can do all of this in the servlet's init() method, so it'll do that before it all loads up.
Hope it helps
Daniel

Similar Messages

  • Error in retrieving and parsing XML File

    Hi Folks
    I am Working on People centric user interface, While i am custimizing a application in Business application Builder i am getting this error
    " Error in retrieving and parsing XML File "
    can any body look on this and give me the solution
    it will be rewarded
    Regards
    M.S.Kumar

    Hello,
    As mentionned by SAP_TECH, avoid to use the BAB.
    Go to CRMC_BLUEPRINT_C and use the different option in the menu to customize the field group, toolbar group, events, ...
    Use the PCUI cookbook to find your way.
    Regards,
    Fred

  • Loading and parsing XML

    what is the best method for loading external XML (with
    inherent HTML) content into Flash and into the TextArea component?
    here is the requirement:
    i have an image loader and a TextArea together on the screen.
    a "story" is loaded which will present a series of images (in the
    image loading) associated with a corresponding text (in the
    TextArea). a "story" has multiple image/text sections that are
    navigatied through with FRWD/BACK buttons. any given section can
    also have multiple sub-sections or "frames".
    here is a diagram of the flow (in this case there would be 5
    click throughs: 5 text/image sequences, but all contained only
    within 4 sections):
    http://jalaka.com/lab/ia/story_nav.jpg
    below is my proposed sample XML structure. i want Flash to
    recognize how many sections and frames within sections there are in
    each story XML document - in order to generate a corresponding
    navigation structure (a tab for each section). HTML content will be
    immediate availble to loadinto TextArea as user move forward in
    sequence with nav. and images references can also be preloaded into
    available MC containers to be swapped into place as user navigates
    forward in sequence. also need to read and store attributes for
    each node in the XML to come up in MCs in sequence. and must also
    be able to parse XML in a way to place simple HTML formatted
    content (within XML) into the TextArea.
    would Arrays be used?
    <story title = "Story Title">
    <section num = "1" title = "Section One Title" >
    <frame image = "1.jpg" caption = "caption text
    here"><b>Content</b><br><br>content
    content content</frame>
    </section>
    <section num = "2" title = "Section Two Title" >
    <frame image = "1.jpg" caption = "caption text
    here"><b>Content</b><br><br>content
    content content</frame>
    <frame image = "2.jpg" caption = "caption text
    here"><b>Content</b><br><br>content
    content content</frame>
    </section>
    </story>

    Placing the XML into an array is a great plan. What you want
    is each array element to be an object containing the section data.
    Another plan is to use a List or Combox component. Again each
    data property element would be an object containing the section
    data.

  • Loading and parsing XML files

    I am currently working on an application in which I have a XML file that is 1.5 mb and has 1100 records that I need to load and parse. Loading takes less than a minute, but when I try to parse it with the DOM parser it's taking too much time. I am trying to put it into an array and then display it as if I'm tied to a database. I need a different approach. Does anyone have any experience and insight with the DOM parser? Would the SAX parser be a better way to go, why and how?

    You can use SAX... but SAX is good only if you want to read the data once.
    If you want to use the same data again and again then you might have to parse the file again... which prooves expensive.
    DOM will take too much of memory and CPU time.
    Have you tried using JDOM ? it is a new kind of a XML parsing utility that is quite lightweight and has good api to recurse the JDOM tree also.
    check it out at
    http://www.jdom.org.
    hope this helps.
    regards,
    Abhishek.

  • Read and parse XML

    Hi all,
    is there some procedure or function or whatever I can use to read and parse an XML file into Oracle?
    The XML contains 30+ Megs of data, which would represent data in 10+ tables if you would convert it into flat files.
    I know I can read the XML and save it line by line in a table, but I do not want to parse it myself. It would be cool if there was a tool or so that would read the dtd definition of the XML, then read the XML data, parse it and create temporary tables with the flat content of the xml (can you code object oriented with PL/SQL? this would even be cooler!).
    Does someone have an idea how to do that?
    Thanks,
    Steff

    Wow, I've never tried to parse an XML file quite that large
    before. Does it contain a bunch of encoded binary data, or does it
    have houndreds of thousands of xml-nodes?
    In any event, I do have one thought:
    Do you need absolutely everything in the file? If you only
    need access to a small portion of it, it would be worth your while
    to pull out only the "stuff" that you need before you parse it. You
    could use regular expressions to strip out things you don't need,
    or to pull out only the stuff you do need.
    The more you can minimize the "parse" effort the better off
    you'll be.
    Alternatively, if it's a file describing many "records" of
    the same type, it would be best if you could "chunk" the file and
    parse each record individually.

  • I uninstalled PS CS6 (non-cloud upgrade) WinXP SP3 then downloaded and reinstall failed during SetUp.exe

    Review: I purchased non-CC upgrade from PS CS5>CS6 today at Adobe.com, downloaded and installed, seemed to work, but had problems after attempting ACR update that led to PS errors, so I uninstalled PS CS6 via control panel>remove>Adobe uninstaller. When I tried to reuse SetUp.exe or re-extract PS CS6 install files; all failed. Contacted support chat they said-download again that will work. That failed, too. Please advise on how to re-install PS CS6 upgrade on same machine where I removed it just hours before. OS: Win XP SP3
    Thanks, Paul

    Kglad,
    Thanks for your helpful reply. I ran the cleaner, checked the log (ok), then ran installer. The installer ran (1 am) and after a brief celebration I looked and PS CS6 was not visible. It did not completely install and no PS CS6 icons were visible--I should have know something was wrong when it did not ask for serial number. I did System Restore, and just ran the CC Cleaner again (targeting PS CS6, since I believe that I need to leave the PS CS5 on the computer for the upgrade to work. Is there anything else that I may need to do to reinstall successfully? I think that the ACR I tried to install caused a problem -- can I target ACR for cleaning / removal further? I have valid serial numbers: loaded PS CS5 from box upgrade yesterday and then bought PS CS6 upgrade also yesterday. Thank you for your good ideas! Paul

  • How to get and parse xml input parameter?

    Hi,
    If one transaction input parameter is xml string, like as below.
    <a>
    <b>
        <c>1</c>
        <d>2</d>
    </b>
    <b>
        <c>3</c>
        <d>4</d>
    </b>   
    </a>
    If I would like to get each element (maybe by repeater action), how to do that?
    Thanks!

    Hi,
    You must convert the string into xml with necessary action block. (XML Functions --> String to XML Parser)
    Then you must put a repeater after converter action and you must set Xpath expression for repeater (configuration) like below:
    String_To_XML_Parser_0.Output{/ARef/BRef}
    after repeater you can use values like below:
    Repeater.Output{/BRef/c}
    Repeater.Output{/BRef/d}
    Regards.

  • Best way to read and parse XML to multiple tables

    This is first time using XML input file for JDev ADF 10.1.3.3 application. We are trying to develop an XML API that the application will read and process. A simple XML record would have field tags for table AA which has 1 to many tags for table BB. Table BB contains 0 to many tags for tables: CC, DD, and EE. Naturnally, the database is relational and there exist Foreign Keys for the Master-Detail relationships that are represents as View Objects in the JDev application.
    What is the best way for us to design and code this API?

    Hi,
    I don't really see any better options for SharePoint. SharePoint use other production called 'Office Web App' to allow users to view/edit Microsoft Office documents (word, excel etc.). But the web version of excel doesn't support that much records as well
    as there's size limitations (probably the default max size is 10MB).
    Regarding second problem, I think you need some custom solutions (like a SharePoint timer job/webpart ) to read and present data.
    However, if you can reduce the excel file records to something near 16k (which is supported rows in web version of excel) then you can use SharePoint Excel service to refresh data automatically in the excel file in SharePoint from some external sources.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • Calling a REST webservice with pl/sql and parse XML

    Hi
    I hope someone is able to help me with this task. I'm newbie with Oracle APEX, have not developed advanced applications yet. A few days ago I installed one of the package application with customer and order. I want to integrate with online shopping with Rest service using PL / SQL. NETS is a provider of online payment systems.
    http://www.betalingsterminal.no/Netthandel-forside/Teknisk-veiledning/Communication/REST/
    There are four steps you must go through to execute the payment. where it is retunert xml files containing infomation to be used further.
    Step 1 - Register payment
    Webshop Performs Register:
    https://epayment-test.bbs.no/Netaxept/Register.aspx?MerchantId=9999997&token=secret&orderNumber=10011&amount=200&CurrencyCode=NOK
    &redirectUrl=http://webshop/RegisterReply.asp
    Reply from payment provider:
    <? Xml version = "1.0"?>
    <RegisterResponse Xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <TransactionId> B127f98b77f741fca6bb49981ee6e846 </ TransactionId>
    </ Register Response>
    Step 2 - Present Web form to customer
    Webshop's customer submit web form:
    https://epayment-test.bbs.no/Terminal/default.aspx?merchantId=9999997&transactionId=b127f98b77f741fca6bb49981ee6e846
    Step 3 - "Redirect" customer back to merchant
    Payment provider send URL to redirect webshop's customer:
    http://webshop/RegisterReply.asp?transactionId=b127f98b77f741fca6bb49981ee6e846&responseCode=OK
    Step 4 - Process payment
    Webshop Performs Process (AUTH):
    https://epayment-test.bbs.no/Netaxept/Process.aspx?merchantId=9999997&token=&transactionId=b127f98b77f741fca6bb49981ee6e846&operation=AUTH
    Reply from payment provider:
    <? Xml version = "1.0"?>
    <Process Response xmlns: XSi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: xsd = "http://www.w3.org/2001/XMLSchema">
    <Operation> AUTH </ Operation>
    <ResponseCode> OK </ Response Code>
    <AuthorizationId> 064392 </ AuthorizationId>
    <TransactionId> B127f98b77f741fca6bb49981ee6e846 </ TransactionId>
    <ExecutionTime> 2009-12-16T11: 17:54.633125 +01:00 </ ExecutionTime>
    <MerchantId> 9999997 </ MerchantId>
    </ Process Response>
    Webshop Performs Process (CAPTURE)
    https://epayment-test.bbs.no/Netaxept/Process.aspx?merchantId=9999997&token=&transactionId=b127f98b77f741fca6bb49981ee6e846
    &transactionAmount=200&operation=CAPTURE
    Reply from payment provider:
    <? Xml version = "1.0"?>
    <ProcessResponse Xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Operation> CAPTURE </ Operation>
    <ResponseCode> OK </ Response Code>
    <TransactionId> B127f98b77f741fca6bb49981ee6e846 </ TransactionId>
    <ExecutionTime> 2009-12-16T11: 40:57.601875 +01:00 </ ExecutionTime>
    <MerchantId> 9999997 </ MerchantId>
    </ Process Response>
    I really appreciate if anyone can help me with This

    Hi,
    Is there any particular reason you want to call a form through provider API?
    Because when you call a from through
    wwa_api_provider.show_portlet the issue #1 is true (you cannot pass parameteres to a form) and the issue #2 could be resoled by supplying a porltet_record.p_page_url to the current page URL.
    However, there is a form-specific PLSQL APIs to call a form and pass parameters to that from which is describe in our FAQ list:
    http://otn.oracle.com/products/iportal/htdocs/portal_faq.htm#BuildingApplications
    Please see following topics:
    "How do I call a form in insert mode and pass it default values?"
    and
    "How do I call a form and pass it a query condition to be automatically executed?"
    Thanks,
    Dmitry

  • Downloading and displaying xml file

    Hai,
    Can anybody help me??
    My problem is :
    I want to create and display an XML file once i run my program in background.My display would be in internet explorer.
    Note that i could not use GUI_DOWNLOAD, because my execution is in background.I am looking for the one to replace GUI_DOWNLOAD.
    I used OPEN DATASET statement, but the file, which is opening is not in XML format. it is displaying only in SAP. I want the display in explorer.
    My requirement is urgent...
    Hope u will respond.
    Regs
    Gransen

    Hi Buddy...try with class <b>CL_GUI_FRONTEND_SERVICES</b>. Goto SE24 and type the class mentioned above. In this class you can find a method called <b>GUI_DOWNLOAD</b>.
    If it is not working try
    <b>CALL TRANSFORMATION</b>
    call transformation (`ID`) source (your internal table) result XML xml_string.
    Kindly reward points if you find it useful.
    Regards,
    Satyesh T

  • Can't parse xml file in jar file when  can't connect to web server

    My JNLP application throw ConnectException when trying to parse xml during web server offline.
    Steps,
    1. JNLP application has been launched once and all related jar and xml files are already downloaded to local cache.
    2. Then I close web server to test offline launch.I launch the JNLP application using shortcut with -offline parameter.
    3. However the JRE internal xml parser tries to connect to web server and report connection error as web server is down now.
    My concern is the file is already in the cache, why java still try to connect URL. This error happens in JRE 1.5, but it doesn't happen in JRE 1.6. It only happens when web server is down in JRE 1.5.
    I think it may be a bug of JRE, do any one can give me some hint about how to resolve?
    Thanks in advance!!
    I also moved the code piece to a simple web start example, following it the error and code pieces.
    Error Trace in Java console,
    ava.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at sun.net.NetworkClient.doConnect(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.<init>(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)
         at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
         at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
         at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.jar.JarURLConnection.getInputStream(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
         at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
         at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
         at EntXmlUtil.buildDocument(EntXmlUtil.java:57)
         at Notepad.testParseXML(Notepad.java:870)
         at Notepad.main(Notepad.java:153)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.javaws.Launcher.executeApplication(Unknown Source)
         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
         at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
         at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
         at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Notepad.java
    public void testParseXML() {
         URL xmlURL=Notepad.class.getClassLoader().getResource("xml/Login.xml");
         try {
                   org.w3c.dom.Document doc = EntXmlUtil.buildDocument(xmlURL);
                   System.out.println("Test"+doc);
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    EntXMLUtil.java
    private static DocumentBuilderFactory dbf = null;
         static {
              dbf = DocumentBuilderFactory.newInstance();
              dbf.setNamespaceAware(true);
              dbf.setValidating(true);
              dbf.setIgnoringComments(true);
              dbf.setIgnoringElementContentWhitespace(true);
    public static DocumentBuilderFactory getDocBuilderFactory() {
              return EntXmlUtil.dbf;
    public static Document buildDocument(URL url, String systemId) throws Exception {
              DocumentBuilder db;
              Document doc;
              InputStream is;
              String sysId = null;
              if(systemId == null)
                   sysId = url.toExternalForm();
              else
                   sysId = systemId;
              db = EntXmlUtil.getDocBuilderFactory().newDocumentBuilder();
              is = url.openStream();
              doc = db.parse(is, sysId);
              is.close();
              return doc;
         }

    I finally got a temperary work around for this issue, using JRE5 version lower than update 16(not include update 16).
    i found Sun modify the URL which returned by XXX.class.getClassLoader().getResource("xml/Test.xml,") after update 15, previous it is related with the cache path, like C:\Users\epenwei\AppData\LocalLow\Sun\Java\Deployment\cache\javaws\http\Dlocalhost\P80\DMEntriView\DMapp\AMNotepad.jar!/xml/Test.xml, but after it changes to network path, like http://localhost/Notepad/app/notepad.jar!/xml/Test.xml. However, the latter address doesn't work in Sun's own class com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity if offline.It tried to create new URL then connect to web server. So exception is thrown since web server is down.
    if (reader == null) {
    stream = xmlInputSource.getByteStream();
    if(stream != null && encoding != null)
    declaredEncoding = true;
    if (stream == null) {
    URL location = new URL(expandedSystemId);
    URLConnection connect = location.openConnection();
    if (connect instanceof HttpURLConnection) {
         setHttpProperties(connect,xmlInputSource);
    I am not sure whether it is a Java new bug since I only read the codes and didn't debug Sun code. But I am very curious that I have already specify <j2se version="1.5.0_12" href="http://java.sun.com/products/autodl/j2se" /> to specify update 12 for my jws application. And I also see the Java console display like following
    Java Web Start 1.5.0_18
    Using JRE version 1.5.0_12 Java HotSpot(TM) Client VM
    Why java still uses my latest jre lib to run my application?
    Edited by: wei000 on May 22, 2009 5:32 AM

  • Parsing xml in clob field remove non utf-8 characters

    hi all,
    i have an issue where a stored procedure runs during a nightly process and parses xml contained in a clob field. There are some records that contain non-utf8(they paste characters from word)characters and therefore the parse fails when using performing an xquery select against the clob field as xmltype. I was wondering if anyone knew of a handy way to handle such a situation? I have looked around a bit and not found anything that seemed tailored to my situation, and I would like something a bit more generic than doing a replace on individual characters that i have found causing issues...thx in advance! -- jp

    Hi,
    Like BluShadow I'm curious to see a test case...
    Depending on the way it's been created, the encoding declared in the XML prolog doesn't necessarily reflects the actual encoding of the content.
    What's your database character set, and version?
    Please also post the error message you get (LPX-00200 probably?).

  • OSB download 250 MG file results in error Error parsing XML: {err}FORG0005

    Hi,
    Using OSB 11.1.1.5. I have service to download files from Oracle ECM. Running into an issue where the file size is over 250 MB service is failing. Giving me an error
    OSB Replace action failed updating variable "body": Error parsing XML: {err}FORG0005: expected exactly one item, got 0 items
    I have service callout to get the binary content of the file and it's taking over 5 minutes and then this error. I also set Read Timeout and Connection Timeout to 20 seconds at the business service level
    but looks like it's not taking that timeout values and still waiting over 5 minutes before it dies. My JTA Timeout is set to 12 minutes. After service callout I have a log to write the output but it's not even getting there and throwing that error above
    How can I trap that kind of errors. How can I set timeout at service level i.e. if after 1 minute if the file is still downloading close the connection etc.
    I don't want to have some many open threads in the back ground as this service is being called in a loop to download files. Smaller files like 30 MG downloads fine but the larger ones are not.
    I have a error hndler at the root level but the error is not trapped there either. Looks like system errors are not getting trapped.
    So Just wondering if OSB is suitable to download that huge files.
    Thanks

    The reason for the error is the xquery is not able to find the values in the input... Check the input and namespaces...
    Try...
    <ns1:value1>{ data($addition1/ns0:value1) }</ns1:value1>
    <ns1:value2>{ data($addition1/ns0:value2) }</ns1:value2>Cheers,
    Vlad

  • Using CDATA tags in XML program and parsing to J2ME

    Hi,
    Can anybody tell me how to use CDATA tag in a xml file and parse it to my J2ME code. is there any sample code available for this? I want to use this CDATA tag for sending Binary data. plzzzzzzz Help....!

    I think what you want is to parse a CDATA text from a xml file and let this text to execute.
    Very innovative idea!
    If I am right, I think you might mix some concept.
    Java code need to be changed to ByteCode before pased to the JVM. Furthermore, Java ME code must be verified before downloading to your machine.
    I figure that your attempt is impossible.

  • Script for parsing xml data and inserting in DB

    Thank you for reading.
    I have the following example XML in an XML file. I need to write a script that can insert this data into an Oracle table. The table does not have primary keys. The data just needs to be inserted.
    I do not have xsd file in this scenario. Please suggest how to modify Method 1 https://community.oracle.com/thread/1115266?tstart=0 mentioned so that I can call the XML mentioned below and insert into a table
    Method 1
    Create or replace procedure parse_xml is 
      l_bfile   BFILE; 
      l_clob    CLOB; 
      l_parser  dbms_xmlparser.Parser; 
      l_doc     dbms_xmldom.DOMDocument; 
      l_nl      dbms_xmldom.DOMNodeList; 
      l_n       dbms_xmldom.DOMNode; 
      l_file      dbms_xmldom.DOMNodeList; 
      l_filen       dbms_xmldom.DOMNode; 
      lv_value VARCHAR2(1000); 
       l_ch      dbms_xmldom.DOMNode; 
    l_partname varchar2(100); 
    l_filename varchar2(1000); 
      l_temp    VARCHAR2(1000); 
      TYPE tab_type IS TABLE OF tab_software_parts%ROWTYPE; 
      t_tab  tab_type := tab_type(); 
    BEGIN 
      l_bfile := BFileName('DIR1', 'SoftwareParts.xml'); 
      dbms_lob.createtemporary(l_clob, cache=>FALSE); 
      dbms_lob.open(l_bfile, dbms_lob.lob_readonly); 
      dbms_lob.loadFromFile(dest_lob => l_clob,    src_lob  => l_bfile,    amount   => dbms_lob.getLength(l_bfile)); 
      dbms_lob.close(l_bfile);  
      dbms_session.set_nls('NLS_DATE_FORMAT','''DD-MON-YYYY'''); 
      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); 
      l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/PartDetails/Part'); 
        FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP 
        l_n := dbms_xmldom.item(l_nl, cur_emp); 
        t_tab.extend; 
        dbms_xslprocessor.valueOf(l_n,'Name/text()',l_partname); 
        t_tab(t_tab.last).partname := l_partname; 
        l_file := dbms_xslprocessor.selectNodes(l_n,'Files/FileName'); 
        FOR cur_ch IN 0 .. dbms_xmldom.getLength(l_file) - 1 LOOP 
          l_ch := dbms_xmldom.item(l_file, cur_ch); 
          lv_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_ch)); 
          if t_tab(t_tab.last).partname is null then t_tab(t_tab.last).partname := l_partname; end if; 
          t_tab(t_tab.last).filename := lv_value; 
        t_tab.extend; 
       END LOOP; 
       END LOOP; 
        t_tab.delete(t_tab.last); 
      FOR cur_emp IN t_tab.first .. t_tab.last LOOP 
      if t_tab(cur_emp).partname is not null and  t_tab(cur_emp).filename is not null then 
        INSERT INTO tab_software_parts 
        VALUES 
        (t_tab(cur_emp).partname, t_tab(cur_emp).filename); 
        end if; 
      END LOOP; 
      COMMIT; 
      dbms_xmldom.freeDocument(l_doc); 
    EXCEPTION 
      WHEN OTHERS THEN 
        dbms_lob.freetemporary(l_clob); 
        dbms_xmlparser.freeParser(l_parser); 
        dbms_xmldom.freeDocument(l_doc); 
    END; 
    <TWObject className="TWObject">
      <array size="240">
        <item>
          <variable type="QuestionDetail">
            <questionId type="String"><![CDATA[30]]></questionId>
            <questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
            <country type="String"><![CDATA[GB]]></country>
            <questionText type="String"><![CDATA[Please indicate]]></questionText>
            <optionType type="String"><![CDATA[RadioButton]]></optionType>
            <answerOptions type="String[]">
              <item><![CDATA[Yes]]></item>
              <item><![CDATA[No]]></item>
            </answerOptions>
            <ruleId type="String"><![CDATA[CRP_GB001]]></ruleId>
            <parentQuestionId type="String"></parentQuestionId>
            <parentQuestionResp type="String"></parentQuestionResp>
          </variable>
        </item>
        <item>
          <variable type="QuestionDetail">
            <questionId type="String"><![CDATA[40]]></questionId>
            <questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
            <country type="String"><![CDATA[DE]]></country>
            <questionText type="String"><![CDATA[Please indicate]]></questionText>
            <optionType type="String"><![CDATA[RadioButton]]></optionType>
            <answerOptions type="String[]">
              <item><![CDATA[Yes]]></item>
              <item><![CDATA[No]]></item>
            </answerOptions>
            <ruleId type="String"><![CDATA[CRP_Q0001]]></ruleId>
            <parentQuestionId type="String"></parentQuestionId>
            <parentQuestionResp type="String"></parentQuestionResp>
          </variable>
        </item>
      </array>
    </TWObject>

    Reposted as
    Script to parse XML data into Oracle DB

Maybe you are looking for

  • Failed Leopard Install , PLEASE HELP!!!!!

    I have a MacBook Intel Core Duo , I have the ram to 2 gigs from and HD to 160 gigs from 80 gigs. I started the install.... I picked full erase & install. I ran the disk consistency check, which returned ok. The install starts 3 to 4 min into the inst

  • Roaming profiles on network

    Hi all! Ok, so first the problem (it is on our school network, and im currently helping the admins with something: There are 1500+ users on the school network, and 800 of them are required to create an "E-portfolio" in dreamweaver, for our IT course.

  • Find out the orgunit id of each document

    hello  guys... i execute  fm 'crm_order_read' for all the guid to recover the orgunit id of the doc. after that i want to  find out the orgunit id of each document.and  how  they  are link ...

  • Automatic creation of billing document

    Hi all, i want to automate creation of billing document for all the deliveries for which PGI done. i think we have to define a job which will call VF04. my question is when we do VF04 manually, we have to give selection criteria like sales org etc an

  • Apple TV Photo stream shows photos OLDEST FIRST.. help!

    I love the apple tv, but the photostream is driving me nuts.  It's pretty useless.  I select photostream (now icloud in the latest update) and my photo stream appears with the oldest photos first!  I want to see my newest photos, not scroll through h