Reading an XML file from package .....

I m trying to read an xml file from a package. The XML file is located on desktop (not on unix system). if i mention the path of the file in a package, is it sufficient ???. OR do i need to CREATE DIRECTORY in oracle and mention the file path in this directory ???
If not any suggestion or advice is great ???

Depends upon the version of Oracle being used. Going from memory, I think it started with 10g that you had to CREATE DIRECTORY and then use that object in references to disk. It could have been 9i as I skipped that version. If you look at the documentation for whatever provided procedure you are calling it will tell you what it expects.
As the code runs on the server the DB resides on, the data file will need to be network accessible from there in order for your code to read the file.

Similar Messages

  • Reading an XML file from a package .....

    I m trying to read an xml file from a package. The XML file is located on desktop (not on unix system). if i mention the path of the file in a package, is it sufficient ???. OR do i need to CREATE DIRECTORY in oracle and mention the file path in this directory ???
    I have granted CREATE directory permissions...
    If not any suggestion or advice is great ???
    Thank you!!

    BANNER
    1     Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    2     PL/SQL Release 11.1.0.6.0 - Production
    3     CORE     11.1.0.6.0     Production
    4     TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    5     NLSRTL Version 11.1.0.6.0 - Production
    Thank you !!!

  • Issue with reading a xml file from xsl

    Hi,
    When I am trying to read a xml file from xsl, I am getting unwanted output.
    Following is the XSL:
    <?xml version="1.0" encoding="UTF-8" ?>
    <?oracle-xsl-mapper
      <!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. -->
      <mapSources>
        <source type="XSD">
          <schema location="../xsd/B2BMarketProperties.xsd"/>
          <rootElement name="ReceipentIDType" namespace="http://www.example.org"/>
        </source>
      </mapSources>
      <mapTargets>
        <target type="XSD">
          <schema location="../xsd/B2BMarketProperties.xsd"/>
          <rootElement name="ReceipentIDType" namespace="http://www.example.org"/>
        </target>
      </mapTargets>
      <!-- GENERATED BY ORACLE XSL MAPPER 11.1.1.4.0(build 110106.1932.5682) AT [TUE DEC 03 16:06:03 EST 2013]. -->
    ?>
    <xsl:stylesheet version="1.0"
                    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
                    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
                    xmlns:mhdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.mediator.service.common.functions.MediatorExtnFunction"
                    xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
                    xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xmlns:ns0="http://www.example.org"
                    xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue"
                    xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:med="http://schemas.oracle.com/mediator/xpath"
                    xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
                    xmlns:bpm="http://xmlns.oracle.com/bpmn20/extensions"
                    xmlns:xdk="http://schemas.oracle.com/bpel/extension/xpath/function/xdk"
                    xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                    xmlns:ora="http://schemas.oracle.com/xpath/extension"
                    xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
                    xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
                    exclude-result-prefixes="xsi xsl ns0 xsd bpws xp20 mhdr bpel oraext dvm hwf med ids bpm xdk xref ora socket ldap">
      <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
      <xsl:variable name="ReceipentID" select="document('../xsd/B2BMarketProperties.xml')"/>
      <xsl:template match="/">
        <ns0:ReceipentIDType>
        <xsl:for-each select="$ReceipentID">
          <ns0:ReceipentID>
            <xsl:value-of select="$ReceipentID"/>
          </ns0:ReceipentID>
          </xsl:for-each>
        </ns0:ReceipentIDType>
      </xsl:template>
    </xsl:stylesheet>
    Following is the XML ( B2BMarketProperties.xml)
    <?xml version="1.0" encoding="UTF-8" ?>
    <ReceipentIDType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://www.example.org B2BMarketProperties.xsd"
                     xmlns="http://www.example.org">
      <ReceipentID>123</ReceipentID>
      <ReceipentID>345</ReceipentID>
    </ReceipentIDType>
    The output i am getting with this code is
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:ReceipentIDType xmlns:ns0="http://www.example.org">
        <ns0:ReceipentID>123345</ns0:ReceipentID>
    </ns0:ReceipentIDType>
    But, I need output in the following format
    <ns0:ReceipentIDType xmlns:ns0="http://www.example.org">
        <ns0:ReceipentID>123</ns0:ReceipentID>
         <ns0:ReceipentID>345</ns0:ReceipentID>
    </ns0:ReceipentIDType>
    Could you guys let me know what i am doing wrong. Any help would be appreciated.
    Thanks,

    This worked for me :
      <xsl:template match="/">
        <ns0:ReceipentIDType>
          <xsl:for-each select="document('B2BMarketProperties.xml')/*:ReceipentIDType/*:ReceipentID">
            <xsl:variable name="count" select="position()"/>
            <ns0:ReceipentID>
              <xsl:value-of select="document('B2BMarketProperties.xml')/*:ReceipentIDType/*:ReceipentID[$count]"/>
            </ns0:ReceipentID>
          </xsl:for-each>
        </ns0:ReceipentIDType>
      </xsl:template>

  • Reading an xml file from a jar file

    Short question:
    Is it possible to read an xml file from a jar file when the dtd is
    placed inside the jar file? I am using jdom (SAXBuilder) and the default
    sax parser which comes with it.
    Long Question:
    I am trying to create an enterprise archive file on Weblogic 6.1. We
    have a framework that is similar to the struts framework which uses it's
    own configuration files
    I could place the dtd files outside the jar ear file and specify the
    absolute path in an environment variable in web.xml which is
    configurable through the admin console.
    But I want to avoid this step and specify a relative path within the jar
    file.
    I have tried to use a class which implements the entityresolver as well
    as try to extend the saxparser and set the entity resolver within this
    class explicitly, but I always seem to sun into problems like:
    The setEntityresolver method does not get called or there is a
    classloader problem. i.e. JDOM complains that it cannot load My custom
    parser which is part of the application
    Vijay

    Please contact the main BEA Support team [email protected]
    They will need to check with product support to determine
    the interoperatablity of Weblogic Server with these other
    products.

  • Reading external xml files from a jar

    Hi,
    I am trying to read an xml file from a jar (which is not present inside the jar ) .
    I am passing the file name as a string (like C:/folder/filename) to the SAXBuilder but it throwing
    unknown protocol: c error.
    i tried using an url , tried using a relative path but to no use.
    Need help in this regard urgently.
    TIA,
    Regards,
    Harsha

    Hi,
    Actually, my application needs to read two xml files , parse it, perform some operation and write
    the result to an output file.
    The names of the two xml files i mentioned, are specified in a properties file as absolute paths. (I even tried converting them to URIs)
    The xml files are in the same directory as the jar ( i dont know if it should matter as i am giving the absolute path).
    The main class reads the names of the files and passes the names as strings to the SAXBuilder.
    This is where i am getting an exception.
    Going by what you said, is it not possible for a java class to read a fie outside of the jar ? Is there no way to do this ? And right now i am not sure of how to go about this or if there's any work around . Any help would be appreciated.
    Kindly reply at the earliest
    TIA,
    Harsha

  • Reading XML file from package!!

    HI,
    I have an xml file with two HIERARCHY levels with Global and local
    <global1> company</global1>
    <global2> address </global2>
    <global3>name </global3>
    <global4>position</global4>
    and
    -- *<loca1l/>*
    <local2> CEO</local2>
    -- *<local3/>*
    <local4> supervisior</local4>
    Now i have a package which reads this file and loads into the table.
    My Question :- In the unknown Local depth 1 and local Depth 3 i want to display company(global depth 1). So when package reads the XML file, if there is any unknown tags then it should load company or read company of the gloabl depth 1 into the table. Any idea or logic would be great helpful.
    I appricate it thank you so much!!

    If i get any unknown field in XML file of Local depth 1 and local Depth 3 i want to replace with global depth 1 and depth 3 fieldWhats wrong if you do it like this:
    SQL>  with t as (
    select xmltype('<data>
                        <global1>company</global1>
                        <global2> address </global2>
                        <global3>name </global3>
                        <global4>position</global4>
                        <local1/>
                        <local2> CEO</local2>
                        <local3/>
                        <local4> supervisior</local4>
                     </data>') xml from dual
    select x.column_value.getstringval()
    from t,
          xmltable('for $i in data/*
                     return
                        if (contains($i/name(), "local") and empty($i/text()))
                        then
                          element {$i/name()} {$i/../*[name()=concat("global",ora:replace($i/name(),"local",""))]/text()}                     
                        else $i' passing xml) x
    X.COLUMN_VALUE.GETSTRINGVAL()                                                  
    <global1>company</global1>                                                     
    <global2> address </global2>                                                   
    <global3>name </global3>                                                       
    <global4>position</global4>                                                    
    <local1>company</local1>                                                       
    <local2> CEO</local2>                                                          
    <local3>name </local3>                                                         
    <local4> supervisior</local4>                                                  
    8 rows selected.?

  • How to read a XML file from BLOB column and insert in a table - PL/SQL Only

    Hi,
    To make data load more simple to end user instead placing file on the server and use SQL-LOADER, I came up with new idea that using oracle ebusiness suite attachment functionality. that loads a XML file from local PC to a database column(table is fnd_attachments, default data type is BLOB over here).
    I tried with DBMS_LOB and didnt get around.
    Please can anyone tell me how to read the BLOB column using PL/SQL and store the data in a oracle table. Here's the sample XML file and table structure FYI.
    <?xml version="1.0" encoding="UTF-8"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Corporate_alloc.xsd" generated="2009-07-07T14:17:49">
    <Corporate_alloc>
    <PKG_CODE>BKCORP</PKG_CODE>
    <PKG_NAME>Corporate Edition - Books</PKG_NAME>
    <DET_CODE>B9780080543758</DET_CODE>
    <DET_NAME>Waves, Tides and Shallow-Water Processes</DET_NAME>
    <ALLOCATION_RATIO>0.000041</ALLOCATION_RATIO>
    </Corporate_alloc>
    <Corporate_alloc>
    <PKG_CODE>BKCORP</PKG_CODE>
    <PKG_NAME>Corporate Edition - Books</PKG_NAME>
    <DET_CODE>B9780080534343</DET_CODE>
    <DET_NAME>Hydrostatically Loaded Structures</DET_NAME>
    <ALLOCATION_RATIO>0.000127</ALLOCATION_RATIO>
    </Corporate_alloc>
    </dataroot>
    CREATE TABLE TEST_XML
    ( PKG_CODE VARCHAR2(50),
    PKG_NAME VARCHAR2(100),
    DET_CODE VARCHAR2(20),
    DET_NAME VARCHAR2(500),
    ALLOCATION_RATIO NUMBER )
    Thanks
    EBV

    In regards to #3, use the COLUMNS functionality of XMLTable instead of using Extract. Two simple examples are
    Re: XML Data - Caliculate fields
    Re: Extractvalue function not recognised

  • Reading an xml file from jar

    I have an xml file in a jar file other than the class that needs to read it. Most of teh posts I've seen reccomend using class.getResource to get access to the jar, but since the file is in a different jar this wont work.
    I load classes using URLClassLoader and explicitely access the class I need from a specific jar by creating a url thusly....
    jar:file:/" + workingDirectory + "/folder/jarfile.jar!/specificfolder/specificfile.class"
    Is there a similar thing for reading an xml file for a jar?

    Have you tried:
    "jar:file:/" + workingDirectory + "/folder/jarfile.jar!/specificfolder/specificfile.xml"
    ;o)
    V.V.

  • File Adapter and reading all XML files from direcotry

    Problem occurs on PI 7.1
    I defined sender file adapter. File name mask is: "*.xml" to read all XML messages from directory.
    Quality of service is: Exactly One.
    Poll Interval: 30
    Retry interval: 30
    Processing mode: Archive with option "Add Timestamp".
    Processing sequence: by name.
    I though that with above configuration my File Adapter will be reading folder for all coming XML files. But  somehow it is reading XMLs only when I'm activating it in Integration Builder.
    Any idea what can cause such strange problem?

    Hi Tomasz,
    As per my understanding, you need to activate the file adapter for reading the XML files on your directory. Right?
    If that is the case, then the issue might be with the Cache.
    1. Clear the cache from the Integration Builder.
    2. Check in SXI_CACHE whether there are any issues. Click on Delta Cache refresh to find out if there are any cache related issues.
    Thanks,

  • Reading a XML File from server in BI Publisher

    Hi All,
    Can any one help me how i can get the XML file from server to BI Publisher using data source.
    The file should transfer directly to BI Publisher with out storing it in any local directory in local system.
    Thank you
    Shalini.

    Shalini
    Do you mean that you have another system that is going to serve up the XML data and you want BIP to be able to pick it up as a data source ?
    Couple of options:
    1, If the XML filename can remain static you can use the 'XML File' datasource. You need to set up a directory on the server and then maybe create a dummy XML file to start with upon which you can build a report. Then have your external data generator put the file into that directory and then schedule the report so that BIP will pick and report.
    2. IS the data generator accessible via HTTP or web service - BIP supports those too.
    3. More complex but with a little effort you can create a servlet that will pick up the file from a directory and serve it up to BIP on demand - Im going to write about this on the blog this week
    Regards
    Tim

  • How to read an xml file from headers

    Hi ,
    I am not getting how to read an xml file sent by client device in header to server.
    Thankx.

    There is a getHeader() in HttpServletRequest interface
    String locationURL=request.getHeader("Location");If URL of your file was set in Location attribute of header.
    Edited by: ngpgeeta on Dec 19, 2008 8:03 AM

  • How to read an XML file from embedded PAR file?

    I have an XML file that has been included in the PAR file as a means of storage (instead of hosting it to a web server).  Is there a way to read this file from within a java iView?  I have tried various methods without much luck.  (I can't seem to locate the file in the portal repository like I could with htmlb's Image class.
    Any thoughts?
    Thanks

    Hi,
    try this one:
    File myxmlFile = new File(portalRequest.getPrivateResourcePath(),"Path/to/my/file/after/PORTAL-INF/myfile.xml");

  • Trying to read an XML file from the resources

    Hi,
    I am having a problem reading a file from the resources: In my project I have data.xml in my project resources folder. I tried the following and it does not work:
    File xsltFile = new File("resources/data.xml");
    or
    File xsltFile = new File("/resources/data.xml");
    Anybody could help please.
    Rgrds.

    Hi,
    I have tried the following and it does not work:
    URL url = this.getExternalContext().getResource("/resources/displayPassengers.xsl");
    File xsltFile = new File( url.getFile());
    However, the url object has the following properties:
    url.getPath() = "/server/benchmark/resources/displayPassengers.xsl";
    url.getFile() = "/server/benchmark/resources/displayPassengers.xsl";
    but I still can not read the xsltFile. The code are on the prerender() method of the page.
    Please let me know.
    Rgrds.

  • Read a xml file from local directory, transform it and put in new local dir

    Hi,
    I have a simple requirement. I have one XML file in d://source folder. I want to read it, transform it and want to put the transformed xml file in new location d://target.
    I am new to OSB. Please help me out to complete the above requirement.
    Thanks in advance.
    Cheers.

    Use a polling file transport proxy service to read the file(d://source folder)
    Do the necessary transformation XML or MFL(if the file is fixed length strings) in the proxy service stages.
    Use a file transport business service to write the file to a directory(d://target).To be called from the proxy service route node.
    http://docs.oracle.com/cd/E17904_01/doc.1111/e15866/transports.htm

  • Read XML file from different server on JSP

    Dear All,
    I am a newbie to JSP with XML, now i want to read the "test.xml" from JSP.
    I read successfully this "test.xml" file from my system and I got output, but I need to read the xml file from
    different server like "http://www.domain.com/test.xml". I couldn't read such a type of file from different server.
    Is it possible to read a xml file from different server?
    If anybody have idea please let me know.
    Thanks in Advance,
    Prasath.
    <%@ page import="java.sql.*,java.io.*,java.util.*,javax.xml.parsers.*,org.w3c.dom.*,org.xml.sax.*" %>
    <%
    try {
        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
        Document doc = docBuilder.parse (new File("http://www.domain.com/test.xml"));
        // normalize text representation
        doc.getDocumentElement ().normalize ();
        out.println ("Root element of the doc is " +
             doc.getDocumentElement().getNodeName()+"<br>");
        NodeList listOfPersons = doc.getElementsByTagName("person");
        int totalPersons = listOfPersons.getLength();
        out.println("Total no of people : " + totalPersons+"<br>");
        for(int s=0; s<listOfPersons.getLength() ; s++){
            Node firstPersonNode = listOfPersons.item(s);
            if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){
                Element firstPersonElement = (Element)firstPersonNode;
                NodeList firstNameList = firstPersonElement.getElementsByTagName("first");
                Element firstNameElement = (Element)firstNameList.item(0);
                NodeList textFNList = firstNameElement.getChildNodes();
                out.println("First Name : " +
                       ((Node)textFNList.item(0)).getNodeValue().trim()+"<br>");
                NodeList lastNameList = firstPersonElement.getElementsByTagName("last");
                Element lastNameElement = (Element)lastNameList.item(0);
                NodeList textLNList = lastNameElement.getChildNodes();
                out.println("Last Name : " +
                       ((Node)textLNList.item(0)).getNodeValue().trim()+"<br>");
                NodeList ageList = firstPersonElement.getElementsByTagName("age");
                Element ageElement = (Element)ageList.item(0);
                NodeList textAgeList = ageElement.getChildNodes();
                out.println("Age : " +
                       ((Node)textAgeList.item(0)).getNodeValue().trim()+"<br>");
            }//end of if clause
        }//end of for loop with s var
    }catch (SAXParseException err) {
    out.println ("** Parsing error" + ", line "
         + err.getLineNumber () + ", uri " + err.getSystemId ());
    out.println(" " + err.getMessage ());
    }catch (SAXException e) {
    Exception x = e.getException ();
    ((x == null) ? e : x).printStackTrace ();
    }catch (Throwable t) {
    t.printStackTrace ();
    %>

    You might try:
    Document doc = docBuilder.parse ("http://www.domain.com/test.xml");Alternatively use the java.net package to obtain an Input Stream to the xml document
    InputStream in = methodThatYouWriteYourselfCalledgetInputStreamForURI("http://www.domain.com/test.xml");
    Document doc = docBuilder.parse (in);cheers,
    evnafets

Maybe you are looking for