DataGrid  dataProvider XML with Namespaces,

I have a DataGrid wich dataProvider is a XMLList. The problem
is that, the xml has a default namespace, and in my DataGridColumns
I use the dataField property to define wich XML field should be
displayed. The problem is that the dataField property is used in a
way that do not take into consideration the xml namespace.
I'm already using the use namespace directive with the right
namespace, but that doesn't work.
Has anyone tried to do something similar?

This is similar to a problem I stumbled into described in
another post. What I ended up doing was creating a labelFunction
for each column and using the value (without the namespace) as the
element name. In ActionScript you can use the QName to get a child
element:
private function getItemValue(data:Object,
column:DataGridColumn):String {
return data.child(new QName(mb, column.dataField));
Note that "mb" was a namespace variable I declared at a
module level. I couldn't find a more elegant way of overcoming this
namespace deficiency of the built in controls. I suppose you could
also extend the DataGrid control, add a namespace attribute and
override the appropriate function that provides the default
rendering. However, that is something for another day.... Hope this
helps.
Dan

Similar Messages

  • Namespace not found error when creating data server for xml with namespace

    Hi
    I tried creating XML data server in ODI with namespace in xml file. I followed the below steps but could not success in creating the dataserver. however when I remove the namespace in xml file I am able to reverse engineer the xml file.
    1) Create xml data server
    2) select xml driver - com.sunopsis.jdbc.driver.xml.SnpsXmlDriver
    3) Provide the jdbc url - jdbc:snps:xml?f=D:/xmlnew/sample_namespace.xml&s=xmlns&d=D:/xmlnew/sample_namespace.dtd
    xml content
    <f:root xmlns:f="http://www.w3.org/TR/html4/">
    <table>
    <name>African Coffee Table</name>
    <width>80</width>
    <length>120</length>
    </table>
    </f:root>
    DTD content
    <!ELEMENT f:root ( table ) >
    <!ELEMENT length ( #PCDATA ) >
    <!ELEMENT name ( #PCDATA ) >
    <!ELEMENT table ( name, width, length ) >
    <!ELEMENT width ( #PCDATA ) >
    when I test connection it shows the following error.
    java.sql.SQLException: The model generated by the model mapper was not accepted by a validator: Model not accepted: Namespace not found:
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.doGetConnection(LoginTimeoutDatasourceAdapter.java:133)
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.getConnection(LoginTimeoutDatasourceAdapter.java:62)
         at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java:1100)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.getLocalConnect(SnpsDialogTestConnet.java:371)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.localConnect(SnpsDialogTestConnet.java:794)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.jButtonTest_ActionPerformed(SnpsDialogTestConnet.java:754)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.connEtoC1(SnpsDialogTestConnet.java:137)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet.access$1(SnpsDialogTestConnet.java:133)
         at com.sunopsis.graphical.dialog.SnpsDialogTestConnet$IvjEventHandler.actionPerformed(SnpsDialogTestConnet.java:87)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
         at java.awt.Component.processMouseEvent(Component.java:6289)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
         at java.awt.Component.processEvent(Component.java:6054)
         at java.awt.Container.processEvent(Container.java:2041)
         at java.awt.Component.dispatchEventImpl(Component.java:4652)
         at java.awt.Container.dispatchEventImpl(Container.java:2099)
         at java.awt.Component.dispatchEvent(Component.java:4482)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
         at java.awt.Container.dispatchEventImpl(Container.java:2085)
         at java.awt.Window.dispatchEventImpl(Window.java:2478)
         at java.awt.Component.dispatchEvent(Component.java:4482)
         at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
         at java.awt.EventQueue.access$000(EventQueue.java:85)
         at java.awt.EventQueue$1.run(EventQueue.java:603)
         at java.awt.EventQueue$1.run(EventQueue.java:601)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
         at java.awt.EventQueue$2.run(EventQueue.java:617)
         at java.awt.EventQueue$2.run(EventQueue.java:615)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: java.sql.SQLException: The model generated by the model mapper was not accepted by a validator: Model not accepted: Namespace not found:
         at com.sunopsis.jdbc.driver.xml.SnpsXmlDTD.initialize(SnpsXmlDTD.java:389)
         at com.sunopsis.jdbc.driver.xml.SnpsXmlDTD.initialize(SnpsXmlDTD.java:421)
         at com.sunopsis.jdbc.driver.xml.SnpsXmlDTD.<init>(SnpsXmlDTD.java:150)
         at com.sunopsis.jdbc.driver.xml.SnpsXmlSchema.<init>(SnpsXmlSchema.java:478)
         at com.sunopsis.jdbc.driver.xml.SnpsXmlSchemaManager.createNewSchema(SnpsXmlSchemaManager.java:292)
         at com.sunopsis.jdbc.driver.xml.SnpsXmlSchemaManager.getSchemaFromProperties(SnpsXmlSchemaManager.java:270)
         at com.sunopsis.jdbc.driver.xml.SnpsXmlDriver.connect(SnpsXmlDriver.java:114)
         at oracle.odi.jdbc.datasource.DriverManagerUtils$DriverProxy.connect(DriverManagerUtils.java:23)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:368)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:352)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:316)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:275)
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.doGetConnection(LoginTimeoutDatasourceAdapter.java:99)
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter.getConnection(LoginTimeoutDatasourceAdapter.java:62)
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter$ConnectionProcessor.run(LoginTimeoutDatasourceAdapter.java:217)
         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
         at java.lang.Thread.run(Thread.java:662)

    Hi,
    Thans for your reply.
    This is the DTD for my xmldoc.
    <!ELEMENT Data (Department+)>
    <!ELEMENT EmployeeID (#PCDATA)>
    <!ATTLIST EmployeeID col (EMPID) #IMPLIED>
    <!ELEMENT Education (EmployeeID, Sequence, Dgree)>
    <!ATTLIST Education table NMTOKEN #IMPLIED>
    <!ELEMENT Employee (EmployeeName, EmployeeID, DepartmentID, Education*)>
    <!ATTLIST Employee table NMTOKEN #IMPLIED>
    <!ELEMENT EmployeeName (#PCDATA)>
    <!ATTLIST EmployeeName col NMTOKEN #IMPLIED>
    <!ELEMENT DepartName (#PCDATA)>
    <!ATTLIST DepartName col NMTOKEN #IMPLIED>
    <!ELEMENT Table (Column+)>
    <!ATTLIST Table importType NMTOKEN #IMPLIED>
    <!ATTLIST Table parentTable NMTOKEN #IMPLIED>
    <!ATTLIST Table tag NMTOKEN #IMPLIED>
    <!ATTLIST Table columns NMTOKEN #IMPLIED>
    <!ATTLIST Table name NMTOKEN #IMPLIED>
    <!ELEMENT DepartID (#PCDATA)>
    <!ATTLIST DepartID col NMTOKEN #IMPLIED>
    <!ELEMENT MetaData (Table+)>
    <!ELEMENT Sequence (#PCDATA)>
    <!ATTLIST Sequence col NMTOKEN #IMPLIED>
    <!ELEMENT Dgree (#PCDATA)>
    <!ATTLIST Dgree col NMTOKEN #IMPLIED>
    <!ELEMENT Export (MetaData, Data)>
    <!ELEMENT DepartmentID (#PCDATA)>
    <!ATTLIST DepartmentID col NMTOKEN #IMPLIED>
    <!ELEMENT Column (#PCDATA)>
    <!ATTLIST Column deleteKey NMTOKEN #IMPLIED>
    <!ATTLIST Column isKey NMTOKEN #IMPLIED>
    <!ELEMENT Department (DepartName, DepartID, Employee+)>
    <!ATTLIST Department table NMTOKEN #IMPLIED>
    Thanks again!
    Yan

  • DataGrid and XML with only 1 entry

    Hi All,
    I have a datagrid set up that is displaying an xml file.
    Seems to work fine until there is only 1 entry in my xml file, then
    I get no content displayed in the datagrid.
    Here is my code that I am using for my app,
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" initialize="xmlDat.send()">
    <mx:Script>
    <![CDATA[
    import mx.controls.dataGridClasses.DataGridColumn;
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    private var myData:ArrayCollection;
    private function resultHandler(event:ResultEvent):void{
    myData = event.result.projects.project;
    ]]>
    </mx:Script>
    <mx:HTTPService id="xmlDat" url="data/whiteboard.xml"
    result="resultHandler(event)"/>
    <mx:Panel layout="absolute" title="Project Whiteboard"
    height="600" width="1000" verticalCenter="-1"
    horizontalCenter="-1">
    <mx:DataGrid dataProvider="{myData}" width="980"
    height="560" y="0" x="0" verticalScrollPolicy="on"
    variableRowHeight="true" editable="false">
    <mx:columns>
    <mx:DataGridColumn headerText="Due Date"
    dataField="dueDate" width="85"/>
    <mx:DataGridColumn headerText="DVD ID" dataField="dvdId"
    width="65"/>
    <mx:DataGridColumn headerText="School Name"
    dataField="schoolName" width="275"/>
    <mx:DataGridColumn headerText="City" dataField="city"
    width="100"/>
    <mx:DataGridColumn headerText="St" dataField="state"
    width="35"/>
    <mx:DataGridColumn headerText="Qty" dataField="quantity"
    width="45"/>
    <mx:DataGridColumn headerText="Image Prep"
    dataField="imagePrep" itemRenderer="render.imgRender"/>
    <mx:DataGridColumn headerText="Video Prep"
    dataField="videpPrep" itemRenderer="render.vidRender"/>
    <mx:DataGridColumn headerText="Sequencing"
    dataField="sequencing" itemRenderer="render.seqRender"/>
    <mx:DataGridColumn headerText="FTP" dataField="ftp"
    itemRenderer="render.ftpRender"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Panel>
    </mx:Application>

    quote:
    Originally posted by:
    peterent
    When there is only 1 entry in the result you don't have an
    Array any more, you have a scalar. That's because the Player
    doesn't know you intend or want to always have an Array.
    Look up ArrayUtils and the toArray function. That should
    help.
    This sounds like just what I need. The only problem I am
    having now is how to implement it into my code. When I add it to
    the code it works for when I have one entry but if it is more than
    that then no data shows.
    Anyone have some ideas on this? Here is my updated code that
    works for one entry in the xml but not more than that.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="initApp()">
    <mx:Script>
    <![CDATA[
    import mx.controls.dataGridClasses.DataGridColumn;
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    import mx.utils.ArrayUtil;
    [Bindable]private var myData:ArrayCollection;
    private var uintPollInterval:uint = 10000;
    private var timer:Timer = new Timer(uintPollInterval);
    private function initApp():void
    xmlDat.send();
    timer.addEventListener(TimerEvent.TIMER, onTimer);
    timer.start();
    private function onTimer(event:TimerEvent):void
    xmlDat.send();
    timer.start();
    ]]>
    </mx:Script>
    <mx:HTTPService id="xmlDat" url="data/whiteboard.xml"
    result="resultHandler(event)"/>
    <mx:Panel layout="vertical" title="Project Whiteboard"
    height="100%" width="1000" verticalCenter="-1"
    horizontalCenter="-1">
    <mx:DataGrid
    dataProvider="{ArrayUtil.toArray(xmlDat.lastResult.projects.project)}"
    width="980" height="100%" y="0" x="0" verticalScrollPolicy="on"
    variableRowHeight="true" editable="false">
    <mx:columns>
    <mx:DataGridColumn headerText="Due Date"
    dataField="dueDate" width="85"/>
    <mx:DataGridColumn headerText="DVD ID" dataField="dvdId"
    width="65"/>
    <mx:DataGridColumn headerText="School Name"
    dataField="schoolName" width="275"/>
    <mx:DataGridColumn headerText="City" dataField="city"
    width="100"/>
    <mx:DataGridColumn headerText="St" dataField="state"
    width="35"/>
    <mx:DataGridColumn headerText="Qty" dataField="quantity"
    width="45"/>
    <mx:DataGridColumn headerText="Image Prep"
    dataField="imagePrep" itemRenderer="render.imgRender"/>
    <mx:DataGridColumn headerText="Video Prep"
    dataField="videpPrep" itemRenderer="render.vidRender"/>
    <mx:DataGridColumn headerText="Sequencing"
    dataField="sequencing" itemRenderer="render.seqRender"/>
    <mx:DataGridColumn headerText="FTP" dataField="ftp"
    itemRenderer="render.ftpRender"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:ControlBar horizontalAlign="right">
    <mx:Button label="Update" click="xmlDat.send()"/>
    </mx:ControlBar>
    </mx:Panel>
    </mx:Application>

  • How to extract  XML with namespace?

    Hi all,
    Below is the XML i have :
    <?xml version="1.0" encoding="UTF-8" ?>
    - <Transaction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012" xsi:schemaLocation="http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd">
    - <Request>
    <Memid>10</Memid>
    <Actid>32</Actid>
    <Pax>3</Pax>
    <Flt>2012-DEC-10</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    <Request>
    <Memid>1</Memid>
    <Actid>3</Actid>
    <Pax>2</Pax>
    <Flt>2012-DEC-12</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    </Transaction>
    I want to extract the element values :
    The below code will help me when i have no namespace , what must be done in order to work with namespace and etract element value
    v_string_xml :=
    ' //Request[' || TO_CHAR (counter_xml) || ']/Memid/text()';
    v_ssp_table (v_ssp_table.COUNT).memid :=
    p_xml_in.EXTRACT (v_string_xml).getnumberval ();
    v_string_xml :=
    '//Request[' || TO_CHAR (counter_xml) || ']/Actid/text()';
    v_ssp_table (v_ssp_table.COUNT).actid :=
    p_xml_in.EXTRACT (v_string_xml).getnumberval ();
    v_string_xml :=
    '//Request['
    || TO_CHAR (counter_xml)
    || ']/Pax/text()';
    v_ssp_table (v_ssp_table.COUNT).pax :=
    p_xml_in.EXTRACT (v_string_xml).getnumberval ();
    v_string_xml :=
    '//Request[' || TO_CHAR (counter_xml) || ']/Flt/text()';
    v_ssp_table (v_ssp_table.COUNT).flt :=
    p_xml_in.EXTRACT (v_string_xml).getstringval ();
    v_string_xml :=
    '//Request['
    || TO_CHAR (counter_xml)
    || ']/Username/text()';
    v_ssp_table (v_ssp_table.COUNT).username :=
    p_xml_in.EXTRACT (v_string_xml).getstringval ();

    declare
      v_xml xmltype := xmltype( '<?xml version="1.0" encoding="UTF-8" ?>
    <Transaction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.test.com/Support/Services/test1/2012" xsi:schemaLocation="http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd">
    <Request>
    <Memid>10</Memid>
    <Actid>32</Actid>
    <Pax>3</Pax>
    <Flt>2012-DEC-10</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    <Request>
    <Memid>1</Memid>
    <Actid>3</Actid>
    <Pax>2</Pax>
    <Flt>2012-DEC-12</Flt>
    <Username>WebUserNameTest</Username>
    </Request>
    </Transaction>' );
    begin
      for r_xml in ( select *
                     from xmltable( xmlnamespaces( default 'http://schemas.test.com/Support/Services/test1/2012' )
                                   , '/Transaction/Request'
                                   passing v_xml
                                     columns memid number path 'Memid'
                                           , actid number path 'Actid'
                                           , pax number path 'Pax'
                                           , flt varchar2(100) path 'Flt'
                                           , username varchar2(100) path 'Username'
      loop
        dbms_output.put_line( r_xml.memid );
        dbms_output.put_line( r_xml.actid );
        dbms_output.put_line( r_xml.pax );
        dbms_output.put_line( r_xml.flt );
        dbms_output.put_line( r_xml.username );
      end loop;
    end;

  • Help required in extract functionality for xml with namespaces

    Hi,
    We recently upgraded our database from 9i to 10G. After the upgrade few queries are not working as expected. Below query does not fetch any results in 10G but works perfectly fine in 9i. Could you please help me with a work around.
    select XMLType.extract(xmltype('<?xml version="1.0" encoding="UTF-8"?>
    <hierarchy docVersion="1" documentID="4738800" enddate="4999-12-31T00:00:00.000" isCurrentVersion="true" isEditable="true" startdate="2007-05-21T13:06:58.737" uniqueID="4738800" xmlns="http://schema/hierarchy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema/hierarchy http://schema/hierarchy.xsd">
    <name>tshiiiiiiiiiiii</name>
    <description>tshiiiiiiiiiiii</description>
    <find_duplicates_on_save>false</find_duplicates_on_save>
    <root href="http://node?/node/@documentID=123" label="root" type="locator"/>
    <connection to="root" type="simple"/>
    </hierarchy>
    '),'//*/@xmlns').getClobVal() as "XMLNS" from dual;
    result : http://schema/hierarchy
    We dont want to use '//*/namespace::*' in the xpath as it will give us xsi value along with xmlns. Oracle metalink says its a bug in oracle 10g version (bug 5100590) but couldnot find workaround. Please help us.
    Thanks and Regards
    Shifali

    Re: Adding report (query & workbook, templates) in roles
    Go through this thread.
    And in our Project we have created one role for accessing workbooks. in that end user can access the work book but saved one and user cannot resave or delete the work book.
    we have added Auth objects S_TCODE and S_GUI.
    in S_TCODE we have added RRMX and in S_GUI we have given 60(IMPORT) access to the users.
    So that they can just share the workbook. nothing else can be done.
    Try like this. Hope this would help you.

  • Parsing xml with namespaces

    Hi
    I have to parse a xml file with 2 namespaces.
    The file looks like as follows
    <AA xmlns="http://XX.com/provider/C/D/E/F/2010/">
    <BB xmlns="">
    <Id>262</Id>
    <Time>2011-03-10T13:55:00.000-06:00</Time>
    <Indicator>true</Indicator>
    </BB>
    </AA>
    i tried following 3 methods to parse this xml file but failed
    PROCEDURE LOAD_XML
    IS
    l_clob := ' <<Above XML Content Here >>';
    lv_root CONSTANT VARCHAR2(1000) := '/AA/BB'; /* Tried lv_root CONSTANT VARCHAR2(1000) := 'AA/BB' with all the three methods */
    /* Method 1 */ lv_namespace constant varchar2(1000) := 'xmlns="http://XX.com/provider/C/D/E/F/2010/"';
    /* Method 2 */ lv_namespace constant varchar2(1000) := 'xmlns="http://XX.com/provider/C/D/E/F/2010/" xmlns=""';
    /*Method 3 */ lv_namespace constant varchar2(1000) := 'xmlns="http://XX.com/provider/C/D/E/F/2010/"/xmlns=""';
    BEGIN
    l_parser := dbms_xmlparser.newParser;
    BEGIN
    dbms_xmlparser.parseClob(l_parser, l_clob);
    END;
    l_doc := dbms_xmlparser.getDocument(l_parser);
    -- Free resources associated with the CLOB and Parser now they are no longer needed.
    dbms_xmlparser.freeParser(l_parser);
    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),lv_root,lv_namespaces );
    FOR cur_rec IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
    l_n := dbms_xmldom.item(l_nl, cur_rec);
    lv_rows_inserted_cnt := lv_rows_inserted_cnt + 1;
    dbms_output.put_line('I am Here');
    lv_rows_processed_cnt := lv_rows_inserted_cnt;
    dbms_xmldom.freeDocument(l_doc);
    l_clob := null;
    dbms_output.put_line(lv_rows_processed_cnt||' Rows Parsed ');
    END LOAD_XML ;
    Every time zero rows are being parsed and it's not going into the for loop at all.
    How to parse these kind of multiple namespaces (Especially default and unassigned namespaces ) ?
    Thanks
    Pramod

    As Anton showed, you don't need namespace if you directly access target node with the descendant axis.
    However, I guess it's a simplified example so if you need it in a more complex case, this will do it :
    DECLARE
    l_clob clob := '<AA xmlns="http://XX.com/provider/C/D/E/F/2010/">
    <BB xmlns="">
    <Id>262</Id>
    <Time>2011-03-10T13:55:00.000-06:00</Time>
    <Indicator>true</Indicator>
    </BB>
    </AA>';
    lv_root       CONSTANT VARCHAR2(1000) := '/ns1:AA/BB/*';
    lv_namespaces CONSTANT VARCHAR2(1000) := 'xmlns:ns1="http://XX.com/provider/C/D/E/F/2010/"';
    l_parser dbms_xmlparser.Parser := dbms_xmlparser.newParser;
    l_doc    dbms_xmldom.DOMDocument;
    l_nl     dbms_xmldom.DOMNodeList;
    l_n      dbms_xmldom.DOMNode;
    lv_rows_inserted_cnt  NUMBER := 0;
    lv_rows_processed_cnt NUMBER;
    BEGIN
    dbms_xmlparser.parseClob(l_parser, l_clob);
    l_doc := dbms_xmlparser.getDocument(l_parser);
    dbms_xmlparser.freeParser(l_parser);
    l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc), lv_root, lv_namespaces);
    FOR cur_rec IN 0 .. dbms_xmldom.getLength(l_nl) - 1
    LOOP
       l_n := dbms_xmldom.item(l_nl, cur_rec);
       lv_rows_inserted_cnt := lv_rows_inserted_cnt + 1;
       dbms_output.put_line(dbms_xmldom.getNodeValue(dbms_xmldom.getFirstChild(l_n)));
    END LOOP;
    lv_rows_processed_cnt := lv_rows_inserted_cnt;
    dbms_xmldom.freeDocument(l_doc);
    dbms_output.put_line(lv_rows_processed_cnt||' Rows Parsed ');
    END;
    /If you're on version 10.2 (or +), maybe you'll find easier to use XMLTable instead :
    SQL> select *
      2  from xmltable(
      3    xmlnamespaces('http://XX.com/provider/C/D/E/F/2010/' as "ns1"),
      4    '/ns1:AA/BB'
      5    passing xmltype('<AA xmlns="http://XX.com/provider/C/D/E/F/2010/">
      6  <BB xmlns="">
      7  <Id>262</Id>
      8  <Time>2011-03-10T13:55:00.000-06:00</Time>
      9  <Indicator>true</Indicator>
    10  </BB>
    11  </AA>')
    12    columns id        number                   path 'Id',
    13            time      timestamp with time zone path 'Time',
    14            indicator varchar2(10)             path 'Indicator'
    15  )
    16  ;
            ID TIME                                              INDICATOR
           262 10/03/11 13:55:00,000000 -06:00                   true

  • Parsing XML with namespaces SOLVED

    I'm working on a SOAP-based self-service UCCX/IPIVR script where the caller inputs an account number and I call a SOAP service and get an XML result. That part works great. I used this excellent article https://supportforums.cisco.com/document/97736/uccx-8x-really-simple-soap-client-no-custom-jar to accomplish that. With slight modification to work with the particular server/service, it works flawlessly.
    My return XML file has namespaces in it with multiple sections. See attached text file with the return results.I get the same result from the SOAP call from UCCX and also from SoapUI.
    First off, my Java skills are very basic at best. Also, please forgive me if I use incorrect terms when it comes to XML nomenclature.
    I need to read each <b:Bill> section and parse the various elements within each section. I can use the statement "//*[local-name()='AssessmentType']" and get the AssessmentType element from the 1st <b:Bill> section but that's it. I don't know how to access the 2nd and subsequent <b:Bill> sections. I checked a number of different articles on various sites including the forums but I haven't found anything that I can understand let alone make work. I thought using QName was going to be my answer but I can't figure out how to make that work.The more I read about this the more confused I get.
    I found a reference somewhere using //Bills/Bill[1]/AssessmentType to access the 1st section and //Bills/Bill[2]/AssessmentType to access the 2nd section but that returns null in both instances. If I use //a:Bills/b:Bill/b:AssessmentType I get an exception, prefix must resolve to a namespace a: exception in org.Apache.xpath.domapi.XPathStylesheetDOM3Exception.
    I event tried modifying the <b:Bill> tag to <b:Bill ID="1"> and using "//*[local-name()=[@ID=1]/AssessmentType" and <Bill ID="1"> but neither of those worked. I tried removing the b: from all of the elements and tried using the same syntax but I still get null.
    I'm hoping someone can point me in the right direction on how I can do what I need to do, if it's even possible. I'm sure it is, I just don't know how to go about it.
    For testing, I just hard-coded the return XML string into a String variable, converted that to a document so I could use the Get XML Document Data step to parse it. The soapResponseStringModified variable is:
    U"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><SOAPGetBillSummaryResponse xmlns=\"http://soap.xxx\"><SOAPGetBillSummaryResult xmlns:a=\"http://schemas.xxx\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"><a:ErrorMessage i:nil=\"true\"/><a:Success>true</a:Success><a:BillCount>2</a:BillCount><a:Bills xmlns:b=\"http://schemas.xxx\"><b:Bill><b:AssessmentType>Annual</b:AssessmentType><b:BillAmount>8259.96</b:BillAmount><b:BillNumber>272818</b:BillNumber><b:BillType>Secured</b:BillType><b:IsRollover>False</b:IsRollover><b:LevyAmount>7508.24</b:LevyAmount><b:RollDate>2014</b:RollDate><b:TaxStatus>Cancelled</b:TaxStatus></b:Bill><b:Bill><b:AssessmentType>Additional</b:AssessmentType><b:BillAmount>7758.24</b:BillAmount><b:BillNumber>501340</b:BillNumber><b:BillType>Secured</b:BillType><b:IsRollover>False</b:IsRollover><b:LevyAmount>7758.24</b:LevyAmount><b:RollDate>2014</b:RollDate><b:TaxStatus>Unpaid</b:TaxStatus></b:Bill></a:Bills><a:GlobalData xmlns:b=\"http://schemas.xxx\"><b:Address>123 MAIN ST</b:Address><b:City>ANY TOWN</b:City><b:EDO>19500909</b:EDO><b:IsDelinquent>true</b:IsDelinquent><b:IsVoid>false</b:IsVoid><b:ParcelNumber>00000</b:ParcelNumber><b:State>XX</b:State><b:TaxRateArea>3016</b:TaxRateArea><b:TodaysDate>20150323</b:TodaysDate><b:Zip>00000</b:Zip></a:GlobalData><a:MainRoll>false</a:MainRoll></SOAPGetBillSummaryResult></SOAPGetBillSummaryResponse></s:Body></s:Envelope>"
    Script (run in single-step mode from the IDE):
    I appreciate any guidance.
    Bill

    It looks like I found a solution to my problem. I haven't explored this for all the possible SOAP methods I have to use but this "solution" looks encouraging.
    If I do a replace() on the namespaces for a: and b: with an empty string, then replace the a:, /a:, b: and /b: with an empty string, I can use the XPath statements //Bill[1]/<FieldName>, //Bill[2]/<FieldName>, //Bill[x]/<FieldName> I can extract the data in a loop since I know the total number of bills ahead of time.
    I replace xmlns:a="http://schemas.xxx" and xmlns:b="http://schemas.xxx" with "", I can extract the elements in the Bill tags.
    It looks like this will solve my problem. It's not elegant but it works. When I loop through the elements, they' re updating appropriately based on the returned XML response.
    I'm sure there's a more elegant way to solve this problem but based on my limited coding skills, I found this a workable solution. I don't know how to use all the various Java tools available to me so this does the job.
    If someone knows the proper way to do this, I'd like to know how it's done. This will add to my toolkit and make my code easier to maintain down the road.
    Bill

  • How use xml with namespaces

    I have the following xml which is output from Oracle Bpel.
    <OglRapportPerAdresnrResponse xmlns="http://www.itude.com/technology/Ogl/RapportPerAdresnrResponse">
    <AdresGegevens>
    <Adresnr>54321</Adresnr>
    <Straatkode>12345</Straatkode>
    </AdresGegevens>
    </OglRapportPerAdresnrResponse>
    If i remove the namespace info everything works fine but with the namespace info the output is empty if i insert e.g. <Adresnr> into a template. The field browser shows everything fine and also the value but when rendering a PDF it disappears. I read in the user guide that i need to declare the namspace in a form field like <?namespace:namespace name= namespace url?> but how do i do that with the above namespace notation where the namespace name is empty ?
    Regards,
    Andre

    Hi Tim,
    I found part of the solution but i am still stuck when i need to use <?for-each?> tags. When i use the following XML:
    <OglRapportPerAdresnrResponse xmlns="http://www.itude.com/technology/Ogl/RapportPerAdresnrResponse">
         <AdresGegevens>
              <Adresnr>8391</Adresnr>
              <Straatkode>11070</Straatkode>
         </AdresGegevens>
         <Basisgegevens>
              <paramPResult xmlns="urn:generated.ws.kgb.itude.com">
                   <paramAdresnr>8391</paramAdresnr>
                   <paramGegevenstype>GEBRUIK</paramGegevenstype>
              </paramPResult>
              <paramPResult xmlns="urn:generated.ws.kgb.itude.com">
                   <paramAdresnr>8391</paramAdresnr>
                   <paramGegevenstype>STADSDEEL</paramGegevenstype>
              </paramPResult>
         </Basisgegevens>
    </OglRapportPerAdresnrResponse>
    I read the xml file in Word. I then have access to the fields but when i select AdresGegevens/Adresnr the output is not rendered. The namespace is a default namespace for that element. I found out that if i define a namespace like <?xmlns:bpel=http://www.itude.com/technology/Ogl/RapportPerAdresnrResponse?> and then access the AdresGegevens/Adresnr through <?bpel:Adresnr?> it works!
    I then defined a second namespace <?xmlns:bpel2=urn:generated.ws.kgb.itude.com?> and tried to render the paramPResult tags with:
    <?for-each:paramPResult?>
    <?bpel2:paramAdresnr?>
    <?bpel2:paramGegevenstype?>
    <?end for-each?>
    But the above does not work. Any ideas?
    Regards,
    Andre Jochems

  • Parsing XML with Namespace

    Hi,
    Can somebody help me with the following:-
    I have an XMLType in pl/sql as follows:
    <?xml version="1.0" encoding="utf-8"?>
    <rapdrpProcessCIN:GetCINRes xmlns:rapdrpProcessCIN="http://rapdrp.com/processcin/transactional/model/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rapdrp.com/processcin/transactional/model/1.0/"
    xmlns:N1="http://rapdrp.com/common/bodcomponents/transactional/model/1.0/"
    xmlns:N2="http://rapdrp.com/gis/cin/business/model/1.0/">
    <rapdrpProcessCIN:ApplicationArea>
    <N1:Sender>
    <N1:Id>PRT01</N1:Id>
    </N1:Sender>
    <N1:Receiver>
    <N1:CompanyName>MGVCL</N1:CompanyName>
    <N1:CompanyId>string</N1:CompanyId>
    </N1:Receiver>
    <N1:Reference>
    <N1:BODCreationDateTime>1697-02-01T00:00:00Z</N1:BODCreationDateTime>
    <N1:BusinessProcessId>BP014</N1:BusinessProcessId>
    <N1:MessageId>string</N1:MessageId>
    <N1:TransactionId>string</N1:TransactionId>
    <N1:Username>string</N1:Username>
    <N1:Token>string</N1:Token>
    </N1:Reference>
    </rapdrpProcessCIN:ApplicationArea>
    <rapdrpProcessCIN:DataArea>
    <rapdrpProcessCIN:CIN>
    <N2:CIN>string</N2:CIN>
    </rapdrpProcessCIN:CIN>
    <rapdrpProcessCIN:ConsumerNumber>string</rapdrpProcessCIN:ConsumerNumber>
    <rapdrpProcessCIN:SRNumber>string</rapdrpProcessCIN:SRNumber>
    </rapdrpProcessCIN:DataArea>
    </rapdrpProcessCIN:GetCINRes>Note the xmlns attribute of the <message> tag is "" which is unusual, but not something I can't modify.
    I wish to extract the text string of the BusinessProcessId tag. I have attempted the following:
    DECLARE
    v_result varchar2(32765);
    v_xml XMLType;
    BEGIN
    v_xml := XMLType('....above XML....');
    v_result := xmltype.extract(v_xml, '/rapdrpProcessCIN:GetCINRes/rapdrpProcessCIN:ApplicationArea/Reference/BusinessProcessId/text()','xmlns:rapdrpProcessCIN="http://rapdrp.com/processcin/transactional/model/1.0/"').getStringVal();
    dbms_output.put_line('v_result:'||v_result);
    END;
    .... and I'm receiving the following result:
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    ORA-06512: at line 6
    What am I doing wrong?
    Any help appreciated.
    Regards,
    Himani

    Hello,
    Can u please help me in resolving this issue.
    I need to parse an XML in which some tags does not contain data or there is no such tag present in an XML.
    Whenever i parse such a XML i receive error-ORA-30625: method dispatch on NULL SELF Argument is disallowed.
    As per my requirement - I may get values in all tags at one time and next time i may receive values of some fields only.
    I have tried this:
    DECLARE
    v_result varchar2(32765);
    v_xml XMLType;
    BEGIN
    v_xml := XMLType('<PurchaseOrder xmlns="http://rapdrp.com/processcin/transactional/model/1.0/">
    <Reference>SBELL-2002100912333601PDT</Reference>
    <Actions>
    <Action>
    <User>SVOLLMAN</User>
    </Action>
    </Actions>
    <Reject/>
    <Requestor>Sarah J. Bell</Requestor>
    <User>SBELL</User>
    <CostCenter>S30</CostCenter>
    <ShippingInstructions>
    <name></name>
    <address>400 Oracle Parkway
    Redwood Shores
    CA
    94065
    USA</address>
    <telephone>650 506 7400</telephone>
    </ShippingInstructions>
    <SpecialInstructions>Air Mail</SpecialInstructions>
    <LineItems>
    <LineItem ItemNumber="1">
    <Description>A Night to Remember</Description>
    <Part Id="715515009058" UnitPrice="39.95" Quantity="2"/>
    </LineItem>
    <LineItem ItemNumber="2">
    <Description>The Unbearable Lightness Of Being</Description>
    <Part Id="37429140222" UnitPrice="29.95" Quantity="2"/>
    </LineItem>
    <LineItem ItemNumber="3">
    <Description>Sisters</Description>
    <Part Id="715515011020" UnitPrice="29.95" Quantity="4"/>
    </LineItem>
    </LineItems>
    </PurchaseOrder>');
    v_result := xmltype.extract(v_xml,'/PurchaseOrder/ShippingInstructions/name/text()','xmlns="http://rapdrp.com/processcin/transactional/model/1.0/"').getStringVal();
    dbms_output.put_line('v_result:'||v_result);
    END;
    In this the value in <name></name> tag is NULL.
    Please let me know if i can parse this XML.
    Regards,
    Himani

  • Using XMLQuery with namespace

    Hi,
    I have following XML document stored as XMLType column,
    <ocaStatus xmlns="http://xmlbeans.apache.org/ocastatus"><status><statusCode>934</statusCode><statusDate>Wed Apr 07 16:05:53 GMT+05:30 2010</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>934</statusCode><statusDate>Wed Apr 07 15:58:25 GMT+05:30 2010</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>934</statusCode><statusDate>Wed Apr 07 15:54:02 GMT+05:30 2010</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>750</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Document Metadata is correct.</comment></status><status><statusCode>934</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>932</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Loaded to Novus</comment></status><status><statusCode>700</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Document is deleted from OCA.</comment></status></ocaStatus>
    This XML row contains namespace in it. Also there are some XML that does not have any namespace in it.
    I am running following XMLQuery() to get statusCode,
    select docfamily_uuid,
    XMLQuery(
    'for $i in /ocaStatus/status
    where $i/statusCode = 934
    return <statusDate>{$i /statusDate}</statusDate>'
    passing document_status_bean RETURNING CONTENT)
    from document_status_xml;
    Interestingly the query returns null for XML with namespace and statusCode value for rest of the XMLs without any namespace.
    Please help me to get this resolved.
    Thanks in advanced.
    Edited by: user6117359 on Apr 8, 2010 12:17 AM

    user6117359 wrote:
    I have some XPath queries too which are using extract(). I am facing the similar problem with them.Hi,
    Extract() accepts a list of namespaces as its third parameter.
    Ex. : based on your sample, to extract the first "status" element :
    SELECT extract(document_status_bean, 'ocaStatus/status[1]', 'xmlns="http://xmlbeans.apache.org/ocastatus"')
    FROM document_status_xml

  • Extracting XML values with namespace

    Hi!
    I have a XML file:<?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/styl.xsl"?>
    <wnio:Deklaracja
    xmlns:adr="http://crd.gov.pl/xml/schematy/adres/2008/05/09/"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:ev="http://www.w3.org/2001/xml-events"
    xmlns:inst="http://crd.gov.pl/xml/schematy/instytucja/2008/05/09/"
    xmlns:meta="http://crd.gov.pl/xml/schematy/meta/2008/05/09/"
    xmlns:oso="http://crd.gov.pl/xml/schematy/osoba/2008/05/09/"
    xmlns:str="http://crd.gov.pl/xml/schematy/struktura/2009/11/16/"
    xmlns:wnio="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
    xsi:schemaLocation="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/ http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/schemat.xsd">
                                <wnio:OpisDokumentu><str:CID>[email protected]</str:CID><meta:Identyfikator typIdentyfikatora="idFormularza"><meta:Wartosc>InstytucjaPubliczna/Deklaracja podatku od środków transportowych DT-1</meta:Wartosc></meta:Identyfikator></wnio:OpisDokumentu>
                                <wnio:Naglowek>
                                    <wnio:KodFormularza kodSystemowy="DT-1(3)"/>
                                    <wnio:WariantFormularza>3</wnio:WariantFormularza>
                                    <wnio:Rok>2008</wnio:Rok>
                                    <wnio:ObowiazekSkladaniaDeklaracji>1</wnio:ObowiazekSkladaniaDeklaracji>
                                    <wnio:MiejsceSkladania/>
                                </wnio:Naglowek>
                                <wnio:Podatnik>
                                    <wnio:OsobaPrawna>
                                        <wnio:NIP>345678901</wnio:NIP>
                                        <wnio:PelnaNazwa>Testowa Instytucja Publiczna</wnio:PelnaNazwa>
                                        <wnio:NazwaSkrocona/>
                                        <wnio:REGON>234512345</wnio:REGON>
                                    </wnio:OsobaPrawna>
                                    <wnio:AdresSiedzibyZamieszkania>
                                        <wnio:KodKraju>PL</wnio:KodKraju>
                                        <wnio:Wojewodztwo>ŚLĄSKIE</wnio:Wojewodztwo>
                                        <wnio:Powiat>Katowice</wnio:Powiat>
                                        <wnio:Gmina>Katowice (gmina miejska)</wnio:Gmina>
                                        <wnio:Ulica>ul. Mikołowska</wnio:Ulica>
                                        <wnio:NrDomu>100</wnio:NrDomu>
                                        <wnio:NrLokalu>924</wnio:NrLokalu>
                                        <wnio:Miejscowosc>Katowice (miasto)</wnio:Miejscowosc>
                                        <wnio:KodPocztowy>40-065</wnio:KodPocztowy>
                                        <wnio:Poczta>Katowice</wnio:Poczta>
                                    </wnio:AdresSiedzibyZamieszkania>
                                </wnio:Podatnik>
                                <wnio:PozycjeSzczegolowe>
                                    <wnio:D.1>
                                        <wnio:P_22/>
                                        <wnio:P_23/>
                                    </wnio:D.1>
                                    <wnio:D.2>
                                        <wnio:P_28/>
                                        <wnio:P_29/>
                                    </wnio:D.2>
                                    <wnio:P_82/>
                                    <wnio:P_83/>
                                </wnio:PozycjeSzczegolowe>
                                <wnio:Zalacznik_DT-1A>
                                    <wnio:P_1/>
                                    <wnio:P_2/>
                                    <wnio:P_22>1</wnio:P_22>
                                </wnio:Zalacznik_DT-1A>
                                <wnio:Zalacznik_DT-1A>
                                    <wnio:P_1/>
                                    <wnio:P_2/>
                                    <wnio:P_22>3</wnio:P_22>
                                </wnio:Zalacznik_DT-1A>
                            </wnio:Deklaracja>and an overloaded function:
    function dodaj_DT1_z_xml(p_dt1 in out nocopy XMLType) return number as
      r_dt1   POD_SRTR_DT1%rowtype;
      r_dt1a  POD_SRTR_DT1A%rowtype;
      r_sdek  POD_SRTR_DEKLARACJE%rowtype;
      l_wariantDT1  number(2);
      l_xosf  XMLType;
      l_xosp  XMLType;
      l_xadr  XMLType;
      l_xszcz XMLType;
      l_zal   XMLType;
      l_z     XMLType;
      l_zno   pls_integer;
      l_xml   XMLType;
      l_ns    varchar2(10);
    -- xmlns:wnio="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"
    begin
      if --p_dt1.existsNode('/wnio:Deklaracja')=0 and
         p_dt1.existsNode('/Deklaracja','xmlns:wnio="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"')=0
      then  return -2;  end if;
      if p_dt1.existsNode('/wnio:Deklaracja')=1 then
        l_ns := 'wnio:';
      end if;
      if p_dt1.existsNode('/'||l_ns||'Deklaracja')=0 then                     return -2;  end if;
      if p_dt1.existsNode('/'||l_ns||'Deklaracja/'||l_ns||'Naglowek')=0 then            return -3;  end if;
      if p_dt1.existsNode('/'||l_ns||'Deklaracja/'||l_ns||'Podatnik')=0 then            return -4;  end if;
      if p_dt1.existsNode('/'||l_ns||'Deklaracja/'||l_ns||'PozycjeSzczegolowe')=0 then  return -5;  end if;
      return 1;
    end;
    function dodaj_DT1_z_xml(p_dt1 in out nocopy CLOB) return number is
      l_xml   XMLType;
    begin
      l_xml := XMLType(p_dt1);
      return dodaj_DT1_z_xml(l_xml);
    end dodaj_DT1_z_xml;I run the code:declare
      v_clob  CLOB;
      v_out   number;
    begin
      SELECT dok_content INTO v_clob FROM EPUAP.epuap_dokumenty WHERE dok_id=13;
      v_out := POD_PCK_SRTR_DT1.DODAJ_DT1_Z_XML(v_clob);
      DBMS_OUTPUT.put_line(v_out);
    end;the output is -2. What must I change to find the node "wnio:Deklaracja"? I'm newbie in XML and namespaces :(
    Help me, please...

    Thanks, BluShadow!
    added:
    What if the structure of the XML is not always the same? Suppose that <aa:USER_INFO> sometimes contains subnode <aa:AUX>.
    WITH t as (select XMLTYPE('
       <RECSET xmlns:aa="http://www.w3.org">
         <aa:REC>
           <aa:COUNTRY>1</aa:COUNTRY>
           <aa:POINT>1800</aa:POINT>
           <aa:USER_INFO>
             <aa:USER_ID>1</aa:USER_ID>
             <aa:TARGET>28</aa:TARGET>
             <aa:STATE>6</aa:STATE>
             <aa:TASK>12</aa:TASK>
             <aa:AUX>
               <aa:AUX1>111</aa:AUX1> <aa:AUX2>222</aa:AUX2>
             </aa:AUX>
           </aa:USER_INFO>
           <aa:USER_INFO>
             <aa:USER_ID>5</aa:USER_ID>
             <aa:TARGET>19</aa:TARGET>
             <aa:STATE>1</aa:STATE>
             <aa:TASK>90</aa:TASK>
           </aa:USER_INFO>
         </aa:REC>
         <aa:REC>
           <aa:COUNTRY>2</aa:COUNTRY>
           <aa:POINT>2400</aa:POINT>
           <aa:USER_INFO>
             <aa:USER_ID>3</aa:USER_ID>
             <aa:TARGET>14</aa:TARGET>
             <aa:STATE>7</aa:STATE>
             <aa:TASK>5</aa:TASK>
             <aa:AUX>
               <aa:AUX1>333</aa:AUX1>
             </aa:AUX>
           </aa:USER_INFO>
         </aa:REC>
       </RECSET>') as xml from dual)
       -- END OF TEST DATA
       select x.country, x.point, y.user_id, y.target, y.state, y.task, z.aux1, z.aux2
       from t
           ,XMLTABLE(XMLNAMESPACES('http://www.w3.org' as "aa"),
                     '/RECSET/aa:REC'
                     PASSING t.xml
                     COLUMNS country NUMBER PATH '/aa:REC/aa:COUNTRY'
                            ,point   NUMBER PATH '/aa:REC/aa:POINT'
                            ,user_info XMLTYPE PATH '/aa:REC/*'
                    ) x
           ,XMLTABLE(XMLNAMESPACES('http://www.w3.org' as "aa"),
                     '/aa:USER_INFO'
                     PASSING x.user_info
                     COLUMNS user_id NUMBER PATH '/aa:USER_INFO/aa:USER_ID'
                            ,target  NUMBER PATH '/aa:USER_INFO/aa:TARGET'
                            ,state   NUMBER PATH '/aa:USER_INFO/aa:STATE'
                            ,task    NUMBER PATH '/aa:USER_INFO/aa:TASK'
                            ,aux     XMLTYPE PATH '/aa:USER_INFO/*'
                  ) y
           ,XMLTABLE(XMLNAMESPACES('http://www.w3.org' as "aa"),
                     '/aa:AUX'
                     PASSING y.aux
                     COLUMNS aux1 NUMBER PATH '/aa:AUX/aa:AUX1'
                            ,aux2 NUMBER PATH '/aa:AUX/aa:AUX2'
                  ) z;This query returns only 2 rows. I'd like to have 3 rows returned :) 3 rows are returned when I add an empty <aa:AUX> node to the data but I wants to have 3 rows when the <aa:AUX> is missed also.

  • Using XSLT to extract value of a XML node with namespace

    I have a XML source code here.
    <?xml version="1.0" encoding="utf-8" ?>
    <rss version="2.0" xmlns:job="http://www.pageuppeople.com">
      <channel>
        <title>SMH Jobs</title>
        <link>internalrecruitment.smhgroup.com.au/jobsrss.ashx?stp=di</link>
        <description>A listing of jobs available here</description>
        <item>
          <title>eCommerce Optimisation Advisor</title>
          <description>A new and exciting opportunity exists for an experienced eCommerce Advisor to join</description>
          <job:location PUReferenceID="3711">Sydney - Inner Suburbs & CBD</job:location>
        </item>
      </channel>
    </rss>
    I want to use XSLT to extract value of a XML node with namespace <job:location>, and the returned value should be string 'Sydney - Inner Suburbs & CBD'. I tried a few XSL code below, but failed with error or nothing was returned.
    <xsl:value-of select="job:location" disable-output-escaping="yes"/>
    <xsl:value-of select="job/location" disable-output-escaping="yes"/>
    <xsl:value-of select="job\location" disable-output-escaping="yes"/>
    <xsl:value-of select="location" disable-output-escaping="yes"/>
    This might be an easy question for you, but I would appreciate if anyone can help.

    Hi Suncorp IT Learner,
    We need to tell the XSLT that some elements are in another namespace. Copy the xmls declarations for the prefixes you need to use. Then use the xsl format as:
    <xsl: value-of select=”job:location/@PUReferenceID”/>
    In following issue, Chriztian has a good explanation:
    http://our.umbraco.org/forum/developers/xslt/33353-XSLT-reading-XML-attribute-value
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Output XML with a default namespace using XQuery

    I'm having a problem with namespaces in an XQuery within ALSB.
    We receive XML from a file which doesn't have any namespace and have to transform it into a different structure, giving it a default namespace such as below:
    Input XML
    <inputRoot>
         <inputAccountName>Joe Bloggs</inputAccountName>
         <inputAccountNumber>10938393</inputAccountNumber>
    </inputRoot>
    Desired output XML
    <outputRoot xmlns="http://www.example.org/outputSchema">
         <outputAccounts>
              <outputAccountName>Joe Bloggs</outputAccountName>
              <outputAccountNumber>10938393</outputAccountNumber>
         </outputAccounts>
    </outputRoot>
    When I attempt to do this using XQuery mapper tool, I end up with a namespace prefix on the outputRoot. The XQuery and result follows:
    XQuery
    declare namespace xf = "http://tempuri.org/XQueryProject/scratchTransformations/test/";
    declare namespace ns0 = "http://www.example.org/outputSchema";
    declare function xf:test($inputRoot1 as element(inputRoot))
    as element(ns0:outputRoot) {
    <ns0:outputRoot>
    <outputAccounts>
    <outputAccountName>{ data($inputRoot1/inputAccountName) }</outputAccountName>
    <outputAccountNumber>{ data($inputRoot1/inputAccountNumber) }</outputAccountNumber>
    </outputAccounts>
    </ns0:outputRoot>
    declare variable $inputRoot1 as element(inputRoot) external;
    xf:test($inputRoot1)
    Result
    <ns0:outputRoot xmlns:ns0="http://www.example.org/outputSchema">
         <outputAccounts>
              <outputAccountName>inputAccountName_1</outputAccountName>
              <outputAccountNumber>inputAccountNumber_1</outputAccountNumber>
         </outputAccounts>
    </ns0:outputRoot>
    How can I write the XQuery in such a way thay the namespace prefix isn't output? I've tried many different methods with no success. I can't declare a default element namespace because my input element doesn't have a namespace
    Thanks in advance

    I spoke too soon, it didn't work quite as perfectly as I'd thought :-) It turns out our client can't handle the xml with the namespace prefix but we've worked out the solution to return XML in the format we originally needed.
    Example below:
    XQuery
    declare namespace xf = "http://tempuri.org/XQueryProject/scratchTransformations/test/";
    declare default element namespace "http://www.example.org/outputSchema";
    declare namespace ns1 = ""
    declare function xf:test($inputRoot1 as element(ns1:inputRoot))
    as element(outputRoot) {
    <outputRoot>
    <outputAccounts>
    <outputAccountName>{ data($inputRoot1/inputAccountName) }</outputAccountName>
    <outputAccountNumber>{ data($inputRoot1/inputAccountNumber) }</outputAccountNumber>
    </outputAccounts>
    </outputRoot>
    declare variable $inputRoot1 as element(inputRoot) external;
    xf:test($inputRoot1)

  • Problem with datagrid dataprovider

    I'm wondering why is it my search result is null after I press search button. After I press search, the datagrid is blank. But I ever test my service and it's working.
    Anyone has any idea how to solve it? So sorry I'm totally new to FLEX... >.<
    Below is my code...
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx"
                           xmlns:productbasicservice="services.productbasicservice.*"
                           width="1024" height="768">
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.controls.Alert;
                import mx.controls.TextInput;
                import mx.events.DataGridEvent;
                import mx.events.FlexEvent;
                import mx.rpc.AsyncToken;
                import valueObjects.Product_basic;
                protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                    getProduct_basic_pagedResult.token = productbasicService.getProduct_basic_paged();
                protected function saveClick(event:MouseEvent):void
                    productbasicService.commit();
                protected function revertData(event:MouseEvent):void
                    productbasicService.revertChanges();
                protected function searchData(event:MouseEvent):void
                    var searchStr:String = searchbox.toString();
                    searchProduct_basicResult.token = productbasicService.searchProduct_basic(searchStr);
                    dataGrid.dataProvider = searchProduct_basicResult.lastResult;
            ]]>
        </fx:Script>
        <fx:Declarations>
            <s:CallResponder id="getAllProduct_basicResult"/>
            <productbasicservice:ProductbasicService id="productbasicService"
                                                     fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                     showBusyCursor="true"/>
            <s:CallResponder id="getProduct_basic_pagedResult"/>
            <s:CallResponder id="searchProduct_basicResult"/>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <mx:DataGrid id="dataGrid" x="11" y="61" width="1003" height="557"
                     creationComplete="dataGrid_creationCompleteHandler(event)"
                     dataProvider="{getProduct_basic_pagedResult.lastResult as ArrayCollection}" editable="true">
            <mx:columns>
                <mx:DataGridColumn width="200" dataField="id" editable="false" headerText="ID"/>
                <mx:DataGridColumn dataField="name" headerText="name"/>
                <mx:DataGridColumn width="200" dataField="price" headerText="Price"/>
                <mx:DataGridColumn dataField="description" headerText="description"/>
            </mx:columns>
        </mx:DataGrid>
        <s:Button x="849" y="22" label="Save" click="saveClick(event)"/>
        <s:Button x="944" y="22" label="Revert" click="revertData(event)"/>
        <s:TextInput x="14" y="22" width="367" id="searchbox"/>
        <s:Button id="button" x="389" y="22" label="Search" click="searchData(event)"/>
    </s:WindowedApplication>
    I have added my own data service operation in the php file called searchProduct_basic(searchStr). Basically this function return the object of the search result.

    It's the same for lastResult as ArrayCollection.
                protected function searchData(event:MouseEvent):void
                    var searchStr:String = searchbox.toString();
                    searchProduct_basicResult.token = productbasicService.searchProduct_basic(searchStr);
                    dataGrid.dataProvider = searchProduct_basicResult.lastResult;
    For you information, the searchProduct_basic(searchStr) would return Product_basic object. >.<

  • Xsl transformation of xml with wrong namespace

    I have xml with wrong namespace:
    <PAMStartedNotification xmlns="some site">
    <tUser>PLVUSER</tUser>
    </PAMStartedNotification>I need to leave this namespace and transform it.
    As a result of transformation now I get
    <tUser></tUser>
    ...I.e. XPath is not calculated properly.
    If I leave out that namespace then everything is ok.
    But I want to leave that namespace as it is.
    I use the following code to transform xml:
    Templates stylesheet = transformerFactory.newTemplates(new StreamSource(new File(fileName)));
    Transformer processor = stylesheet.newTransformer();
    java.io.StringWriter resultWriter = new java.io.StringWriter();
    StreamResult streamResult = new StreamResult(resultWriter);
    processor.transform(new StreamSource(new StringReader(xmlData)), streamResult);
    transformedXML = resultWriter.getBuffer().toString();Any ideas how to do that(transform xml with wrong namespace)?
    Edited by: prng on Dec 15, 2008 6:43 AM
    Edited by: prng on Dec 15, 2008 6:45 AM

    prng wrote:
    Sorry.
    Here is XPath I use to select tUser:
    /PAMStartedNotification/tUser
    Right. To start out, that selects a PAMStartedNotification element which is in no namespace. But yours isn't. It's in the default namespace, which doesn't have a prefix. You could try this XPath expression:
    /*[local-name() = 'PAMStartedNotification']/*[local-name() = 'tUser'](Untested, might have mis-typings and so on.)

Maybe you are looking for

  • Error occurred during initialization of VM .. any sugesstion

    Hi, I tried to call the helloworld program from a C program in linux. but i got the following error message Error occurred during initialization of VM Unable to load native library: libverify.so: cannot open shared object file: No such file or direct

  • "Java Virtual Machine not loaded"

    I get this message every time I boot up. It just started recently. Anyone know how to fix that? Everything seems to run okay, but that annoying box pops up every time. "Java Virtual Machine not loaded" Thanks in advance. kar

  • Can't recognize the Pkcs12

    I programmed to accomplish the downloading of a pkcs12 certificate, but after it had saved in the local disk, I can't open it. It show the error: "This is a invalid Personnel Information Exchange File". my main servlet code is following: InputStreamR

  • Custom Shapes?

    I'm a long-time Photoshop user who's recently started using Fireworks for wire framing websites. It has a lot of advantages over PS in that regard, but I'm used to reaching for my custom shape tool in PS, and in Fireworks I'm not finding anything res

  • Proxy setup for R12

    Hi , Someone setup Proxy during e-business suite R12 upgrade. What is drawback of setting proxy ? Thanks,