Doc function in Xquery

Hi there,
Is there any way to provide "relative path" in doc function in Xquery instead of "absolute path" of a file.
I am using this in OSB and have placed the xml files (to be read) in the same folder where .xq file is already present.
Have tried all combinationss like:
let $mydata:=doc("/ER.xq")
let $mydata:=doc("./ER.xq")
but its not working. Please advice if this is possible.
Meanwhile i am going to try exposing the xml's over http and use the URL in doc function
Thanks in Advance
Arpit

Thanks for the reply odie....can u give some example here.
My situation:
Project Path: D:\oracle\OSB\Project1
Xquery Path: D:\oracle\OSB\Project1\A.xq
XML to read: D:\oracle\OSB\Project1\sample.xml

Similar Messages

  • External document using XQuery doc() function - SEGV

    The following code involving an XQuery using the doc() function to access an external document via the filesystem produces a segmentation fault on Windows XP 32 using Java 1.6.11 and BDB XML 2.4.16 + P1.
    The input doc is just "<Urmel>Huhuhu</Urmel>".
    Maybe some basic error of mine. How am I supposed to access external documents via XQuery's doc() function?
    Michael Ludwig
    # Problematic frame:
    # C  [libdbxml24d.dll+0x86401]
    # The crash happened outside the Java Virtual Machine in native code.
    package milu;
    import java.io.File;
    import com.sleepycat.db.Environment;
    import com.sleepycat.db.EnvironmentConfig;
    import com.sleepycat.dbxml.XmlException;
    import com.sleepycat.dbxml.XmlManager;
    import com.sleepycat.dbxml.XmlManagerConfig;
    import com.sleepycat.dbxml.XmlQueryContext;
    import com.sleepycat.dbxml.XmlResults;
    import com.sleepycat.dbxml.XmlTransaction;
    import com.sleepycat.dbxml.XmlValue;
    public class TestExternalAccess2 {
         static final String envDirStr = "C:/MILU/data/dbenv46";
         static final File envDir = new File(envDirStr);
         static EnvironmentConfig envConf;
         static {
              envConf = new EnvironmentConfig();
              envConf.setAllowCreate(true);
              envConf.setRunRecovery(true);
              envConf.setInitializeCache(true);
              envConf.setInitializeLocking(true);
              envConf.setInitializeLogging(true);
              envConf.setTransactional(true);
         public static void main(String[] args) throws Exception {
              Environment env = new Environment(envDir, envConf);
              XmlManagerConfig mgrConf = new XmlManagerConfig();
              mgrConf.setAllowExternalAccess(true);
              XmlManager mgr = new XmlManager(env, mgrConf);
              String qry = "doc('file:C:/milu/dev/u.xml')";
              XmlQueryContext qc = mgr.createQueryContext();
              XmlTransaction txn = mgr.createTransaction();
              XmlResults res = mgr.query(txn, qry, qc);
              while (res.hasNext()) {
                   XmlValue val = res.next();
                   StringBuffer sb = new StringBuffer();
                   sb.append(val.getClass());
                   sb.append(" - ");
                   sb.append(val.asString());
                   System.out.println(sb.toString());
              res.delete();
              txn.commit();
    }

    I did a diff of my dbxml-2.4.16 and a clean version of dbxml-2.4.16 and found this difference, which looks like a fix for your bug. Please tell me if this works.
    Lauren Foutz
    --- dbxml-2.4.16-orig/dbxml/src/java/dbxml_java_wrap.cpp     2008-10-21 18:28:16.000000000 -0400
    +++ dbxml-2.4.16/dbxml/src/java/dbxml_java_wrap.cpp     2009-02-27 15:24:32.000000000 -0500
    @@ -1309,8 +1309,12 @@
                       break;
                  default:
    -                   if(docid != 0)
    -                        (*cdoc).setAsNotMaterialized();
    +                   if(docid != 0 && cid != 0)
    +                         (*cdoc).setAsNotMaterialized();
    +                    else if(!(*cdoc).getDbMinder().isNull() && cid == 0) {  //set query constructed documents as DOM
    +                         (*cdoc).getDocDb();
    +                         (*cdoc).setContentAsNsDom(docid, (*cdoc).getCacheDatabase());
    +                    }
                  createCPPMetaData(jenv, jdoc, cdoc);Edited by: LaurenFoutz on Apr 16, 2009 6:48 AM

  • Problem with user-defined functions in XQuery String

    hello
    i've a problem with user-defined functions in XQuery String
    details are here (the code is not Human-readable via forum's embedded editor ?? strange)
    http://docs.google.com/Doc?id=ddqwddsr_21c96d9x
    thanks !!

    See
    michaels>  select xmlquery('declare function local:test_function($namecmp as xs:string?, $inputtype as xs:string?) as xs:string?      
                        return {$inputtype}
                     local:test_function("1","2")' returning content) o from dual
    Error at line 5
    ORA-19114: error during parsing the XQuery expression:
    LPX-00801: XQuery syntax error at '{'
    3                       return {$inputtype}
    -                              ^
    michaels>  select xmlquery('declare function local:test_function($namecmp as xs:string?, $inputtype as xs:string?) as xs:string?      
                        $inputtype
                     local:test_function("1","2")' returning content) o from dual
    O   
    2   
    1 row selected.

  • Generate DB DOC functionality should be able to specify a schema like TOAD.

    I have created a request for this previously. I was hoping it wold be in the next release.
    Its awesome to be able to specify a schema if you have the rights to generate documentation for it.
    Generate DB DOC functionality should be able to specify a schema like TOAD.
    Description I like the Generate DB DOC functionality.
    It only seems to work for the account you are connect to.
    I would like to see it work more like TOAD in that you could specify a schema and see the layout of that schema without having to find the account for it if you have rights to the objects via SELECT_CATALOG_ROLE or SELECT DICTIONARY_ANY or whatever objects you have rights to..
    This is good for admins who have dictionary rights but now the password of the schema or a person who has been granted rights to a particular set of objects..
    Looks like I got to sign onto TOAD to do this one for now since I don't know the schema password..

    Hi,
    You can submit any feature requests at Oracle SQL Developer Exchange - https://apex.oracle.com/pls/apex/f?p=43135:1:2266866887402592:::::

  • How to hardcode username/pwd in the open doc function.

    How to hardcode username/pwd in the open doc function.
    can you please provide the complete opendoc function

    hi,
    Using SDK, logon token can be passed along with OpenDoc URL.
    Sample code is as follows:
    String openDocumentToken() throws SDKException, Unsup
    portedEncodingException
    IEnterpriseSession sess = CrystalEnterprise.getSessionMgr().logon ("username", "password", "<cms>:</port>",
    "secEnterprise");
    String token = sess.getLogonTokenMgr().createLogonToken("",120,100);
    String tokenEncode = URLEncoder.encode(token, "UTF-8");
    return ("http://<server>:<port>/OpenDocument/opendoc/openDocument.jsp?iDocID=Aa6GrrM79cRAmaOSMGoadKI&sID
    Type=CUID&token=" + tokenEncode);
    Regards,
    Vamsee

  • I downloaded adobe reader XI Free trial for 30 days and want to try Convert to DOC function but fail, please help!

    When I click the button Subscribe now, it return: "Sorry, this Adobe product is currently not available for sale in your country."
    That means I cannot Convert to DOC function??

    Adobe Reader is free; there is no trial.
    Regarding the ExportPDF service; see https://forums.adobe.com/docs/DOC-2596
    If ExportPDF is not available in your country, you will need to use Acrobat to convert; there is a 30-day trial available for Acrobat.
    If you do have the Acrobat trial install, make sure you open the PDF to convert in Acrobat, not Adobe Reader.

  • Calling a java function from xquery

    Hello,
    I'm pretty new to ODSI and xquery, so forgive me if what I'm asking is too trivial, but I need to find a way to call a java function from inside xquery. I know xquery can do this through external functions, but can't find any example on how the query prolog declaration should be, nor how the function should look like. Could someone enlighten me?
    Thanks,
    Pedro Ivo

    You can do this 2 ways that I know of (Mike probably has more ideas too)
    1. Register an inversion function:
    [How to use an inversion function|http://download.oracle.com/docs/cd/E13167_01/aldsp/docs32/dsp32wiki/Using%20Inverse%20Functions%20to%20Improve%20Query%20Performance.html]
    2. Create a physical data service based on a java function. I have used this approach for both custom JDBC database operations and straight Java processing, with pretty good results.
    Good luck,
    Jeff
    Edited by: jhoffmanme on Apr 14, 2010 9:57 AM

  • How to use Change doc Function Module?

    Fn mod:ZSUBTESTCHG_WRITE_DOCUMENT
    Import parameters               Value
    OBJECTID                        ZSUBTESTCHG
    TCODE                            SE37
    UTIME                             00:00:00
    UDATE                             09.03.2009
    USERNAME                        'TESTUSER'
    PLANNED_CHANGE_NUMBER
    OBJECT_CHANGE_INDICATOR            I
    PLANNED_OR_REAL_CHANGES         R
    NO_CHANGE_POINTERS
    UPD_ICDTXT_ZSUBTESTCHG               I
    N_ZSUBTEST                         2         TEST
    O_ZSUBTEST                         2         TEST
    UPD_ZSUBTEST                    I
    Tables                          Value
    ICDTXT_ZSUBTESTCHG                 0 Entries
    I have a ztable 'ZSUBTEST' with 2 fields DEPTID and DEPNAME and ticked "change document" for data element.
    I have created the above change doc write fn module. I am trying to insert a new reocrd into table.
    How to use ZSUBTESTCHG_WRITE_DOCUMENT so that even if i try to change an existing record in ztable the old and new values for a particulat ztable will be filled in CDPOS Table.
    Would appreciate if you can suggest me how to use in1) Update and 2) Insert scenarios.
    Thanks,
    Subba

    hi check this,
    Types Declaration***
    types: BEGIN OF X_audit,
    Field of ZAUDIT TABLE OR a custom created table------
           END OF X_audit.
    Data Declaration***
    Data: w_newvalues type X_audit,
          w_oldvalues type X_audit.
    DATA: BEGIN OF t_cdtxt OCCURS 0.
            INCLUDE STRUCTURE cdtxt.
    DATA: END OF t_cdtxt.
    DATA:  l_tcode type cdhdr-tcode ,
           l_time type cdhdr-utime,
           l_usnam type cdhdr-username,
           l_date type cdhdr-udate.
    **Constants****
    CONSTANTS : l_objectid TYPE cdhdr-objectid VALUE 'ZAUDIT_CD'.
    Initialization.
    Clear: l_tcode,l_time, l_usnam, l_date.
    Clear: w_newvalues, w_oldvalues.
    **Start-Of-Selection**
    Start-of-selection.
    *Populating w_oldvalues workarea with old values from the table
    Select single * from zaudit_t
                    Into w_oldvalues
                    Where belnr eq belnr_1
                    And  gjahr eq gjahr_1
                    And  bukrs eq bukrs_1. u201C where, belnr_1, gjahr_1, bukrs_1  are the fields on selection screen.
    here we are populating w_newvalues workarea with new values
    W_newvalues-f1 = w_oldvalues-f1
    f2 = u2018XXXXXXXu2019     -
    f3 = u2018YYYYYYYu2019
    f4 = u2018ZZZZZZZu2019
    l_tcode = sy-tcode.
    l_time = sy-uzeit.
    l_usnam = sy-uname.
    l_date = sy-datum.
    modify the table with new values***
    MODIFY zaudit_t FROM w_submit.
    IF sy-subrc EQ 0.
        MESSAGE 'Document Updated' TYPE 'S'.
    call function 'ZAUDIT_CD1_WRITE_DOCUMENT'
        exporting
          objectid                   = l_objectid
          tcode                      = l_tcode
          utime                      = l_time
          udate                      = l_date
          username                   = l_usnam
        PLANNED_CHANGE_NUMBER      = ' '
          object_change_indicator    = 'U'           u201CU-update, I-insert, D-delete
        PLANNED_OR_REAL_CHANGES    = ' '
        NO_CHANGE_POINTERS         = ' '
          upd_icdtxt_zaudit_cd       = 'U'
          n_zaudit_t                 = w_newvalues  u201Cpass the work area containing new values     
          o_zaudit_t                 = w_oldvalues  u201Cpass the work area containing old values
          upd_zaudit_t               = 'U'         u201C this parameter gives the values in the columns(new value, old value and changed field name) of table CDPOS.
        tables
          icdtxt_zaudit_cd           = t_cdtxt
    ELSE.
       MESSAGE 'Document Not Updated' TYPE 'S'.
    ENDIF. u201CIF sy-subrc EQ 0.

  • Open Doc Function to pass parameters from Xcelsius to WEBI

    Hi All,
    I need to have a drill through functionality from xcelsius report to WebI report I am using the following open doc URL
    http://BO ServerName/OpenDocument/opendoc/openDocument.jsp?
    sType=wid&sRefresh=Y&sIDType=CUID&iDocID="Doc ID"&mode=full&lsSRegion=""&lsSDay=""&lsSPlant=""&lsSProduct%20Name=""
    When I run the flash in Internet Explorer then the drill through webi report opens without any error for the 1st time
    but when I try to reopen the report again with new set of parameters , the browser gets hanged
    Also when I run the flash in Firefox , I get error while opening the Webi Report for the 1st time but when I try to open the report again it works fine.
    Please let me know if anyone has faced similar issue before.
    I am Using Xcelsius 2008 SP3 and BO XI 3.1
    Thanks,
    Shweta

    Hi Shweta
    If you place the URL un the browser directly does the report open and refresh ok?  Can you try altering the parameters of the URL, also directly in the browser?
    Something else to check would be if the prompts in the WebI report can be optional, store the last value etc, and I wouldn't recommend having a prompt which has a space in the name such as you have (Product%20Name). Keep the prompts as simple as possible, and make sure that the 'equal to' and 'in list' operators are properly reflected in the URL. 
    Regards
    Charles

  • How to get Database functions into xquery/XSLT in OSB 12c

    Hello All,
    How to make use of  functions orcl:sequence-next-val and orcl:query-database in xslt/xquery in OSB 12c.
    I need to do the below logic in xslt/xquery and used it in replace activity . But in OSB 12c I don't see these function. Request to provide me the solution to do it in OSB.
    XSLT in SOA
    <xsl:when test="/ns0:CreateEvent/ns0:Header/header:SourceName != &quot;&quot;">
                <ns1:googleEventSourceId>
                  <xsl:value-of select="orcl:query-database(concat(&quot;select google_event_source_id from enterprise.google_event_source where google_event_source=&quot;,&quot;'&quot;,/ns0:CreateEvent/ns0:Header/header:SourceName,&quot;'&quot;),false(),false(),&quot;jdbc/PRDatasource&quot;)"/>
                </ns1:googleEventSourceId>
              </xsl:when>
    <ns1:googleMapEventId>
              <xsl:value-of select="orcl:sequence-next-val(&quot;enterprise.google_map_event_seq&quot;,&quot;jdbc/PRDatasource&quot;)"/>
            </ns1:googleMapEventId>
    please see below code is just part of my transformation.
    Regards,
    TJ.

    bump

  • Including customized xquery functions in XQuery/XSLT expression Editor-OSB

    Hi,
    I have written a customized xquery function. I want this to be included in the List of Xquery Functions which is displayed by Oracle Service Bus in the XQuery/XSLT
    Expression Editor. OSB displays the built in xquery functions in the XSLT/Xquey Expression Editor. Is there any way to add the customised xquery to this list, so that it can be dragged and dropped later?
    Thanks,
    Balaji.

    I doubt if that is exposed out side of Oracle Engineering (Not public/documented). Please raise a support ticket for enhancement. If PM should concur you might get the steps that need to be performed for this feature.
    Thanks
    Manoj
    Edited by: Manoj Neelapu on Jun 8, 2010 8:37 AM

  • Lexical Parsing exception using JXQI for function in XQuery

    How to parse Xquery containing new declared namespace, functions and then use the same function to operate upon Xquery along with it.....
    When i try to execute that XQuery using JXQI library, i get lexical parsing exception.......
    i m quite new to XQuery and that too its implementation in java, so i would b grateful for the help in advance !!

    Hi,
    Could you post the XQuery, and a sample XML document (if necessary)?
    Thanks.

  • SYS_GUID()  SQL functions within XQuery

    Is there any simple way to invoke regular SQL functions from within XQuery?
    I would like to create an identifier attribute, and set the value to SYS_GUID(), but when I try to directly embed the function, it comes back saying:
    ORA-19237: XP0017 - unable to resolve call to function - fn:SYS_GUID
    select XMLQUERY('
    <AgeCmf dtm="{current-dateTime()}" id="{SYS_GUID()}"/>
    ' RETURNING CONTENT) from dual;
    I could dump the value into a temp table, or make it an input parameter via another function, but I am looking for something simple within a SQL call.
    Thanks,
    HW

    Maybe this?:
    michaels>  select xmlquery('<AgeCmf dtm="{current-dateTime()}" id="{s}"/>' passing xmltype('<s>' || sys_guid() || '</s>') returning content) x from dual
    X                                                                                                 
    <AgeCmf dtm=" 2007-06-20T07:05:19.515000+02:00" id="6304A70F5C104ACB98C69EEB3D47891C"></AgeCmf>   

  • Problem with user defined function in XQUERY

    Hi,
    I have a file in which I store XQUERY. My java program reads this file and executes the xquery
    and output the result. I have a working XQUERY in a file, which is something like :
    <feed>
    let $entries := for $x in collection('/path/to/atomStore.bdbxml')/entry[matches(id,'
    .entry')]
    order by $x/updated descending
    return <entry xmlns="http://www.w3.org/2005/Atom">{$x/id,$x/title,$x/published,$x/updated,$x/link}
    </entry>
    let $latest := fn:subsequence($entries, 1, 10)
    for $f in $latest return $f
    </feed>
    After adding the following simple function(I'm not calling it anywhere for the time being),
    I'm getting an error
    com.sleepycat.dbxml.XmlException: Error: Error in XQuery expression:
    Unrecognized character 'a' (0x61) [err:XPST0003], line 33, column 2, errcode = XPATH_PARSER_ERROR
    declare function xml:convertdate($date as xs:integer) as xs:string
    let $months := ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec")
    let $month := $months[$date]
    return $month
    I couldn't find any error with the function syntax. Anyone has any idea?
    Regards,
    Anoop

    Hi Anoop,
    The query and function work fine for me. What does the line and column information in the error point to?
    John

  • Support for DbXml specific functionality in XQuery vs. Shell or API

    Is / will there be any support for doing common commands in pure XQuery rather than just programmatically or through the shell? For example, in the shell I can create / list / delete indexes on a container, output query plans, etc. Are the same functions that are called through the shell available as XQuery functions? possibly in a dbxml function namespace?
    In a related question, but possibly deserving of a new thread if it doesn't already have one - I know XQuilla has the ability to call registered external functions from parsed XQuery, is there a way to tell DbXml to register a function with XQuilla's static context before using it? that would make it possible for me to add the functionality described above myself without disturbing your distributed code.

    Not so handy with C++ (my everday languages are PHP and Java), but if you say it can be done then I'll take a hack at it. If you happen to have examples of how other people have done it and you could point me at them it would be marvelous.
    To answer your second question: "bingo." It mostly means less interface work and brings it closer to what SQL can do in relational databases.
    The project allows the end user to define their own document structures (schema definitions more or less) and then create instances of these documents in a XML editing interface. For each document type, the end user is also able to define a set of named queries (abstracted function declarations) which lets us captures business rules without customizing our PHP code. Because the structure and queries that will be used against the documents are user defined its fairly impossible for me to automatically setup adequate indexes for the container of each set of documents. So I need an interface to allow the user to create / review / delete the indexes themselves.
    We've already created an interface that allows the user to execute arbitrary queries against a selected document. In the future we'd also like this same interface to do result set based content updates (through the XmlModify class) and whole document addition / replacement. So inclusion of index control makes sense as well. We can find ways to use the APIs, it just seems like this could benefit more than just our project.
    Placing the functionality from the shell into xquery extension functions seems analogous to having the UPDATE, DELETE and CREATE syntaxes of SQL.

Maybe you are looking for