Repository event handler doesn't work when inserting an xml-doc via ftp

Hi,
I want to add a 'schemaLocation'-attribute to an XML-document when I load it in the repository. Therefore, I use the precreate-repository event and created a Repository Event Handler (see code extract below).
Everything works fine if I type the following code in SQL Plus:
Declare
v_return BOOLEAN;
Begin
v_return:=DBMS_XDB.createresource('/public/xml/test.xml', XMLType(bfilename('XMLDIR', 'test.xml'),nls_charset_id('AL32UTF8')));
end;Unfortunately, when I try to insert an XML-document via ftp into the /public/xml folder it doesn´t work as expected and no 'schemaLocation'-attribute is added to the new resource.
What's the reason for this strange behavior and how can I solve it?
For your information: I use the Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Thank you very much for your help!!!
Repository Event Handler code extract:_
create or replace
PACKAGE BODY schemalocation AS
PROCEDURE handlePreCreate (eventObject DBMS_XEVENT.XDBRepositoryEvent) AS
XDBResourceObj DBMS_XDBRESOURCE.XDBResource;
var XMLType;
l_return BOOLEAN;
l_xmldoc dbms_xmldom.DOMDocument;
l_docelem dbms_xmldom.DOMElement;
l_attr dbms_xmldom.DOMAttr;
c1 clob;
node     dbms_xmldom.DOMNode;
txid varchar2(100);
dDoc DBMS_XMLDOM.DOMDocument;
nlNodeList DBMS_XMLDOM.DOMNodeList;
BEGIN
XDBResourceObj := DBMS_XEVENT.getResource(eventObject);
dbms_lob.createTemporary(c1,TRUE);
var:=DBMS_XDBRESOURCE.getcontentxml(XDBResourceObj);
l_xmldoc := dbms_xmldom.newDOMDocument(var);
l_docelem := DBMS_XMLDOM.getDocumentElement(l_xmldoc);
------ add schemaLocation attribute
l_attr := DBMS_XMLDOM.createAttribute(l_xmldoc, 'xsi:schemaLocation');
DBMS_XMLDOM.setValue(l_attr, 'urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd');
l_attr := DBMS_XMLDOM.setAttributeNode(l_docelem, l_attr);
DBMS_XMLDOM.WRITETOCLOB(l_xmldoc, c1);
------- get the value of the TxId-tag
dDoc := DBMS_XMLDOM.NEWDOMDOCUMENT(c1);
nlNodeList := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(dDoc, 'TxId');
node := DBMS_XMLDOM.ITEM(nlNodeList, 0);
txid:= dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(node));
l_return:=DBMS_XDB.createresource('/public/ok/'||txid||'.xml', XMLType(c1));
END;

Marco,
Here's an example of the problem :
create or replace package handle_events
as
  procedure handlePreCreate(p_event dbms_xevent.XDBRepositoryEvent);
end;
create or replace package body handle_events
is
procedure handlePreCreate (p_event dbms_xevent.XDBRepositoryEvent)
is
  XDBResourceObj dbms_xdbresource.XDBResource;
  doc XMLType;
  res boolean;
begin
  XDBResourceObj := dbms_xevent.getResource(p_event);
  doc := dbms_xdbresource.getContentXML(XDBResourceObj);
  select insertchildxml(
    doc
  , '/root'
  , '@xsi:schemaLocation'
  , 'urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd'
  , 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
  into doc
  from dual;
  res := dbms_xdb.CreateResource('/public/xml/result.xml', doc);
end;
end;
declare
res boolean;
begin
res := dbms_xdb.CreateFolder('/public');
res := dbms_xdb.CreateFolder('/public/tmp');
res := dbms_xdb.CreateFolder('/public/xml');
end;
declare
res            boolean;
resconfig      xmltype;
my_schema      varchar2(30) := 'DEV';
resconfig_path varchar2(300) := '/public/ResConfig.xml';
resource_path  varchar2(300) := '/public/tmp';
begin
  resconfig  := xmltype(
'<ResConfig xmlns="http://xmlns.oracle.com/xdb/XDBResConfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/XDBResConfig.xsd http://xmlns.oracle.com/xdb/XDBResConfig.xsd">
  <event-listeners set-invoker="true">
    <listener>
      <description>My event handler</description>
      <schema>'||my_schema||'</schema>
      <source>HANDLE_EVENTS</source>
      <language>PL/SQL</language>
      <events>
        <Pre-Create/>
      </events>
      <pre-condition>
        <existsNode>
          <XPath>/r:Resource[r:ContentType="text/xml"]</XPath>
          <namespace>xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd"</namespace>
        </existsNode>
      </pre-condition>
    </listener>
  </event-listeners>
  <defaultChildConfig>
    <configuration>
      <path>'||resconfig_path||'</path>
    </configuration>
  </defaultChildConfig>
</ResConfig>'
  res := dbms_xdb.CreateResource(resconfig_path, resconfig);
  dbms_resconfig.addResConfig(resource_path, resconfig_path, null);
end;
/Giving the following input XML file :
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>This works :
SQL> declare
  2    res boolean;
  3  begin
  4    res := dbms_xdb.CreateResource('/public/tmp/test.xml',
  5               xmltype(bfilename('TEST_DIR','test.xml'), nls_charset_id('AL32UTF8')));
  6  end;
  7  /
PL/SQL procedure successfully completed.
SQL> select XMLSerialize(document xdburitype('/public/xml/result.xml').getXML()
as clob indent size = 2)  result
  2  from dual
  3  ;
RESULT
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd
"/>With the same document loaded via FTP, we get :
SQL> select XMLSerialize(document xdburitype('/public/xml/result.xml').getXML()
as clob indent size = 2)  result
  2  from dual
  3  ;
ERROR:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00283: document encoding is UTF-16-based but default input encoding is not
Error at line 1
no rows selectedand the content looks like :
< ? x m l   v e r s i o n = " 1 . 0 "   e n c o d i n g = " u t f - 8 " ? >
< r o o t   x m l n s : x s i = " h t t p : / / w w w . w 3 . o r g / 2 0 0 1 / X M L S c h e m a - i n s t a n c e " / >As a workaround, I've found that serializing and re-parsing the document solves the problem :
  select insertchildxml(
    xmltype(doc.getclobval())
  , '/root'
  , '@xsi:schemaLocation'
  , 'urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd'
  , 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
  into doc
  from dual;
...We then get the expected result after FTP transfer :
SQL> select XMLSerialize(document xdburitype('/public/xml/result.xml').getXML()
as clob indent size = 2)  result
  2  from dual
  3  ;
RESULT
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
urn:iso:std:iso:20022:tech:xsd:sese.023.001.01 http://www.test.com/Testswift.xsd
"/>The workaround also works for the DOM version presented above.
Any ideas?

Similar Messages

  • The onDeactivate event handler doesn't work in InDesign CC. Why?

    Hi guys.
    I’m working on a script in Javascript for InDesign CC.
    The big problem is that the onDeactivate event handler doesn’t work.
    Here’s an example that works in InDesign CSx but not in InDesign CC:
    #target indesign
    var w = new Window ("dialog", "Test onDeactivate");
    var et_1 = w.add("edittext", [undefined, undefined, 300, 30], "Lorem ipsum");
    var et_2 = w.add("edittext", [undefined, undefined, 300, 30], "Dolor sit amet");
    var st = w.add("statictext", [undefined, undefined, 300, 30], "CONSOLE:\r\r", {multiline: true});
    et_1.onDeactivate = et_2.onDeactivate = function(){
         st.text = "CONSOLE: I left the field with this text:\r\t«" + this.text +"»"; }
    var b_ok = w.add("button", undefined, "OK");
    w.show();
    The script shows a dialog window with 2 edit text fields: when a field loses the focus (clicking on the other one), the «CONSOLE» shows the text of the old field.
    Adobe, please, fix this issue as soon as possible.
    Thanks.
    Giorgio

    It's a bug, and it has been reported. Please report it yourself, the more reports the better. It's no good asking Adobe in this forum to fix something.
    Peter

  • Event handler doesn't work for a Canvas inside a canvas (Possible bug in Flex 4)

    Hi Guys,
    I have a canvas sitting inside another canvas. When i try to catch the mouseClick event in the child canvas, im not able to do it. When i change the child canvas component to a 'Panel', the event handler works perfectly fine. Any suggestions/solutions?

    ok a few things you should know... it is recomended to use the spark components when working with flash builder 4 thought the mx components are available spark is much litghter in weight. also if you want to use the equivalent of a canvas in spark then you want to use a "group" but ill warn you they dont support inline styles, a border container looked more appropiate for what you were trying to do below.  However. i did fix your code for flex 4.0
    look below.
    component:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx"
        creationComplete ="canvas2_creationCompleteHandler(event)">
    <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
      <![CDATA[
    import mx.controls.Alert;
    import mx.events.FlexEvent;
    public function canvas1_clickHandler(event:MouseEvent):void
    Alert.show("Clicked");
    public function canvas2_creationCompleteHandler(event:Event):void
    {// TODO Auto-generated method stub//
    kenaCan.addEventListener(MouseEvent.CLICK, canvas1_clickHandler);
      ]]>
    </fx:Script> 
    <mx:Canvas id="kenaCan"
          width="400"
          height="300"
          borderStyle="solid"
          borderColor="black"
          backgroundColor="white"
          />
    </mx:Canvas>
    application:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
          xmlns:local1="local.*">
    <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <local1:canvas/>
    </s:Application>
    if this post answers your question please mark it as such thanks

  • My swf doesn't work when inserted into my website

    Hi I am trying to create a gallery on my website. The way I am doing it is I am making several swfs that consist of an image that you click on, it goes into full screen, click it again and it goes back, then importing them into dreamweaver. the as3 code I am using in Flash is
    import flash.display.StageDisplayState;
    function toggleFullScreen():void
    if (stage.displayState == StageDisplayState.NORMAL) {
      stage.displayState=StageDisplayState.FULL_SCREEN;
    } else {
      stage.displayState=StageDisplayState.NORMAL;
    btn_fullsc.buttonMode = true;
    btn_fullsc.addEventListener(MouseEvent.CLICK, buttonOnClick)
    function buttonOnClick(event:MouseEvent):void
    toggleFullScreen();
    When I export and open just the swf, it works, but when imported into dreamweaver, then published it doesn't, it still shows the original image but when you click it nothing happens. What am I doing wrong? any help would be great.
    PS
    I am an idiot when it comes to computers. If you send me a different code that I'm supposed to use just give me the exact code that I can just copy and paste into flash

    First, change this:
    import flash.display.StageDisplayState;
    function toggleFullScreen(e:Event):void
    if (stage.displayState == StageDisplayState.NORMAL) {
      stage.displayState=StageDisplayState.FULL_SCREEN;
    } else {
      stage.displayState=StageDisplayState.NORMAL;
    btn_fullsc.buttonMode = true;
    btn_fullsc.addEventListener(MouseEvent.CLICK, toggleFullScreen)
    Make sure you have the following publishing option in your html-wrapper activated:
    (File>Publishing Options>HTML-Wrapper>Template:Flash only - allow Fullscreen)

  • BitmapData draw method doesn't work when the project is published as the .swf file of the web applic

    Hi,
            I am totally confused by this strange error. When I tried using the draw method of BitmapData to draw a movieclip symbol of my project, it seems to work fine locally. However, as I uploaded the published .swf file to my web server and launched it as the plugin of my web application, it failed. The source codes as follows,
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    message3 didn't show at all. Instead, the browser console shows "Uncaught Error: Error calling method on NPObject.". My understanding of this error message is that the .swf is calling something crashing, and I believe that bd.draw(stage)is the crashng method call.
    Also, here is my html embed tag:
        <embed src="/tests/videoplayer.swf" id="flash" quality="high" height="510" width="990" scale="exactfit" name="squambido" align="middle" allowscriptaccess="always" allowfullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" style="margin: 0px auto;clear:both;position:relative;"/>
    Can someone help me?

    Thank you for your reply.
    I tried stageWidth and stageHeight, but it still doesn't work.
    The draw() methid is triggered when I clicked a screenshot button in my application as follows,
    ExternalInterface.addCallback("printscreenClicked", printscreenClicked);
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    Would you please give me an example of "waiting for Event.RESIZE is good, or just at least Event.ENTER_FRAME"?
    My real purpose in this application is to capture a snapshot of a streaming video. The video is contained in a movieclip object. I tried stage first since BirmapData.draw() doesn't work when drawing the movieclip on the web site. Do you have any suggestion for this situation? Also, is there any good method to find out what happened if the browser have "Uncaught Error: Error calling method on NPObject."?

  • How do I delete items in my calendar when it doesn't work when I hover them over the trash can?

    How do I delete items in my calendar when it doesn't work when I hover them over the trash can?

    There are several ways
         - Selecting the event and hitting the "delete" key on your keyboard (as Wayne Contello said)
         - Selecting the event and opening the "edit" dropdown menubar item, and then selecting "delete"
         - Selecting the event and right clicking, then selecting "cut" (this option puts the event on your clipboard)

  • My speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    my speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    Thanks for your solution, it wasn't quite what solved the problem but i remembered that i had a bit of salt water on my phone recently and spraying the charging port with an anti-oxide spray solved my problem, do you mind if i ask, how is the charging port related with the volume or/and speakers?

  • I have different account ID's with my iphone and computer. I would like to standardise both to just the one. One of the ID's doesn't work, when I tried to list the second email with the preferred one a message telling me that this email is already in

    I have different account ID's with my iphone and computer.
    I would like to standardize both to just the one.
    One of the ID's doesn't work, when I tried to list this second email with the preferred one a message telling me that this email is already in use pops up.. yes it is, with me??
    Is there an easy to fix this please, Fabfitz

    If the email address you want to use is being used as the primary email address on a different ID you have to manage that ID and change it to a different primary email address.  This explains how: Change your Apple ID - Apple Support.
    If it is being used as an alternate or rescue address on a different ID, you manage the ID and either remove it or change it to a different email address.  This explains how: Manage your Apple ID primary, rescue, alternate, and notification email addresses - Apple Support.

  • I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing

    I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing my document using Microft Word 2010. I have tried using the tab add-in, but it doesn't respond either. The only way to convert my document is to save it as a .pdf from the save as drop down box. I need to be able to have the full functionability of creating a PDF document with the tabs and links working.
    Please help!

    From OFFICE 2010 you either have to have AA X or just print to the Adobe PDF printer. You give no information on your operating system or specifically what you mean by PDFing -- there are multiple ways to create a PDF from a WORD document and you have given no information. However, in this case your only choice is to print to the Adobe PDF printer. Otherwise, you need to upgrade Acrobat.

  • [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

    When selecting a menu item I used to click the left mouse button and hold it down, move the pointer to the desired menu item and release the mouse button. Everything works fine in the mine menu, but there's a problem when adding new adjustment layer from the layer panel: when I release the button nothing happens, I have to press the button again. In previous PS version it worked fine. How can I fix this?

    I don't think that is user fixable, meaning you'll have to wait till adobe fixes it with an update.
    Photoshop cc 2014
    windows does not work
    mac does work
    Did you already post over here:
    [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

  • TS1398 The internet on my Iphone 4 doesn't work when I use the Wifi

    The internet on my Iphone 4 doesn't work when I use the Wifi at home. My Mac works fine. On the Iphone it shows it's connected but it doesn't open any app. Anyone knows what to do? Thanks

    Ÿ. If you tap and hold the "Y" does it appear? If so, just slide your finger up to select.

  • It doesn't work when I press "transfer purchased items from ipod" and I don't know specidicly whitch item I need to transfer

    It doesn't work when I press "transfer purchased items from ipod" and I don't know specidicly whitch item I need to transfer.
    Whenever i press "transfer purchased items from ipod", itunes sync's for about 3 seconds, but I still can't install updates on the ipod without itues warning me about purchased items on the ipod, that aren't in the itunes library. I've tried folowing the steps in itunes help, but I can only find a step guide for when you know the specific item that needs transferring, and I donøt know that specific item.

    This Apple Tech Note explains the process:
    http://support.apple.com/kb/ht1848
    It will transfer all purchased items that the computer you are transferring to is authorised to play: you don't have to select the items.

  • I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

  • Imessage doesn't work when i connect to my wifi only works on mobile date how do i fix this?

    Imessage doesn't work when i connect to my wifi only works on mobile date how do i fix this?

    1. Did you use Bootcamp Assistant?
    2. Did you build a USB with Windows 7 ISO and Bootcamp drivers?
    3. You should use a USB2.0 disk, not a USB3.0 disk (flash drive).
    4. What year is the Retina MBP?

  • My iPad takes hours to charge even when I turn it off I have bought like 6 chargers and my iPads been sent back twice and it still doesn't work when I'm charging it

    My iPad takes hours to charge even when I turn it off I have bought like 6 chargers and my iPads been sent back twice and it still doesn't work when I'm charging it what do I do ??

    I am also having the same problem.. Its too much annoying and its unfortunate nobody at apple support has anyclue of what is happening?
    ... This is happening almost most of the time keeping my phone down most of the times.

Maybe you are looking for

  • How to execute commit statement in a procedure optionally?

    We have a procedure which has DML operations and at the end there is a commit statement. I want to execute commit statement optionally. Like, when procedure runs directly it must execute commit statement, but when this procedure is called from a trig

  • Upgrading to 10.5.5 breaks wifi?

    Hi guys, First off, sorry to create another post about wifi issues. I just switched to a Mac earlier this month and absolutely love it. My only gripe is that the wireless capability of my macbook pro appears to be having some issues when I update fro

  • Need help choosing processor and display for X240 please

    I'm about to purchase an X240 today or tomorrow and, after doing multiple forum searches and reading a 67-page X240 thread elsewhere, I would really appreciate some help choosing a processor and a display. If it makes a difference, I've decided on: *

  • Pantone Color 5615 Coated Won't Print On 1 of 2 Identical HP DesignJet 5500s

    Hi, We've run into an odd problem where we have 2 locations with identical setups: Creative Suite Design Premium 4, Mac Pros, and HP DesignJet 5500s.  The same InDesign file prints fine in one location with a DesignJet 5500, but when we print the sam

  • Upgrading to UCCX 8

    I'd like to get any comments from anyone who is using, has upgraded or is in the process of upgrading to UCCX 8.0 (from 7.0(1)).  What has been your experiences, problems, issues, dos & don'ts, etc.  Should I or would you have waited for the release