Extracting XML values with namespace prefixes

Hint: I put this topic in "SQL and PL/SQL" but that was a bad idea, I think.
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...
Oracle version is 10.2.0.3

Hi,
If you declare a namespace prefix then corresponding elements must be qualified.
So, either do :
p_dt1.existsNode('/wnio:Deklaracja','xmlns:wnio="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"')or use a default namespace declaration :
p_dt1.existsNode('/Deklaracja','xmlns="http://test.epuap.gov.pl/FeResourceServlet/wzor_lokalny/InstytucjaPubliczna/Deklaracja_DT/"')BTW, could you explain what are you trying to accomplish?

Similar Messages

  • 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

  • Unstructured Xml Storage with Namespaces - Problem in DML Queries

    Hai All,
    I worked with xml namespace with registering schema in db and referred in my xml document.It worked fine.
    But i want to work in unstructured xml document with namespaces, to do all dml queries like, select,update,delete using Xpath to xmltype.
    I could insert the records,When i try to select some element from xmltype field using Xptah from db,it does not bring any thing like element value or any error.It just displaying as empty value.I am using oracle 10g R2.
    Please help me how to select the element value from xmltype using XPath or whatever it is.
    Please help me out from this to follow
    Advance Thanks,
    P.Savananan

    SQL> create user marco identified by marco account unlock;
    User created.
    SQL> grant dba, xdbadmin to marco;
    Grant succeeded.
    SQL> conn marco/[email protected]
    Connected.
    SQL> create table xml_tab ( details xmltype);
    Table created.
    SQL> insert into xml_tab values(XMLTYPE('<?xml version="1.0" ?>
      2  <customers xmlns="http://localhost/openuri.org" >
      3  <customer>
      4  <order xmlns="http://orcl.com" >
      5  <ordername>Computer</ordername>
      6  <cost>35785638</cost>
      7  </order>
      8  </customer>
      9  </customers>'));
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select extractValue(details,'/customers/customer/order/ordername') from xml_tab;
    EXTRACTVALUE(DETAILS,'/CUSTOMERS/CUSTOMER/ORDER/ORDERNAME')
    SQL> set long 10000
    SQL> select * from xml_tab;
    DETAILS
    <?xml version="1.0"?>
    <customers xmlns="http://localhost/openuri.org">
      <customer>
        <order xmlns="http://orcl.com">
          <ordername>Computer</ordername>
          <cost>35785638</cost>
        </order>
      </customer>
    </customers>
    SQL> select extract(details,'//order/ordername') XDATA
      2  from   xml_tab
      3  ;
    XDATA
    SQL> select extract(details,'//order/ordername','xmlns="http://orcl.com"') XDATA
      2  from   xml_tab
      3  ;
    XDATA
    <ordername xmlns="http://orcl.com">Computer</ordername>
    SQL> select extractValue(details,'//order/ordername','xmlns="http://orcl.com"') XDATA
      2  from   xml_tab
      3  ;
    XDATA
    Computer
    SQL> select extractValue(details,'/*/*/order/ordername','xmlns="http://orcl.com"') XDATA
      2  from   xml_tab
      3  ;
    XDATA
    Computer

  • BPEL SCA: XML-20129: (Error) Namespace prefix 'ui' used but not declared.

    SOASuite 11g
    Oracle Weblogic Server 10.3.3
    Oracle Solaris on SPARC (64-bit) 10
    Database: Oracle Server - Enterprise Edition 10.2.0.5
    When I start the SOA domain server, I find the following in the log file:
    <Feb 25, 2011 10:41:23 AM CET> <Error> <org.apache.commons.digester.Digester> <BEA-000000> <Parse Error at line 9 column 79: <Line 9,
    Column 79>: XML-20129: (Error) Namespace prefix 'ui' used but not declared.
    org.xml.sax.SAXParseException: <Line 9, Column 79>: XML-20129: (Error) Namespace prefix 'ui' used but not declared.
    at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:422)
    at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:287)
    at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:342)
    at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:226)
    at org.apache.commons.digester.Digester.parse(Digester.java:1785)
    at oracle.fabric.composite.Parser.parseComposite(Parser.java:132)
    at oracle.integration.platform.kernel.WLSFabricKernelInitializer.deployComposite(WLSFabricKernelInitializer.java:493)
    at oracle.integration.platform.kernel.WLSFabricKernelInitializer.prepareCompositeDeployments(WLSFabricKernelInitializer.java:
    239)
    at oracle.integration.platform.kernel.WLSFabricKernelInitializer.init(WLSFabricKernelInitializer.java:127)
    at javax.servlet.GenericServlet.init(GenericServlet.java:241)
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
    at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
    at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1976)
    at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1950)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1869)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3126)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1512)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
    at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
    at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
    at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
    at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
    at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
    at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
    at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
    at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    >
    My composite.xml is:
    <composite name="JIPSYHandleRTOTaskEBF" revision="1.0" mode="active" state="on"
    xmlns="http://xmlns.oracle.com/sca/1.0"
    xmlns:ui="http://xmlns.oracle.com/soa/designer/"^M
    xmlns:xs="http://www.w3.org/2001/XMLSchema">^M
    <import location="GetTimeoutPeriod.wsdl" namespace="http://xmlns.oracle.com/pcbpel/adapter/db/GetTimeoutPeriod/"/>
    <service ui:wsdlLocation="JIPSYHandleRTOTaskEBF.wsdl" name="client">
    </composite>
    But when it has been deployed, I see that this has been changed into:
    <composite name="JIPSYHandleRTOTaskEBF" revision="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <import location="GetTimeoutPeriod.wsdl" namespace="http://xmlns.oracle.com/pcbpel/adapter/db/GetTimeoutPeriod/"/>
    <service ui:wsdlLocation="JIPSYHandleRTOTaskEBF.wsdl" name="client">
    </composite>
    (I exported this from MDS).
    Apparently, some namespaces are stripped.
    This appears to happen during the deploy (using ant), because the version in the generated jar file is already missing the namespaces.
    The BPEL processes appear to work fine though.
    Why is this happening and how can I prevent these errors?

    I've fiddled around with the file composite.xml and found the following workaround:
    If I change the start of the file to:
    <?xml version="1.0" encoding="UTF-8"?>
    <composite name="JIPSYUpdateWorkflowReqABCSImpl"
    xmlns="http://xmlns.oracle.com/sca/1.0"
    xmlns:ui="http://xmlns.oracle.com/soa/designer/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    revision="1.0"
    mode="active"
    state="on">
    it remains unchanged and the errors during deployment are gone.

  • How can I get the element value with namespace?

    I tried to get a element value in xml has namespace but i can't.
    I removed the namespace, i can get a element value.
    How can i get a element value with namespace?
    --1. Error ----------- xml ------------------------------
    <?xml version="1.0" encoding="UTF-8"?>
    *<TaxInvoice xmlns="urn:kr:or:kec:standard:Tax:ReusableAggregateBusinessInformation:1:0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:kr:or:kec:standard:Tax:ReusableAggregateBusinessInformation:1:0 http://www.kec.or.kr/standard/Tax/TaxInvoiceSchemaModule_1.0.xsd">*
    <ExchangedDocument>
    <IssueDateTime>20110810133213</IssueDateTime>
    <ReferencedDocument>
    <ID>318701-0002</ID>
    </ReferencedDocument>
    </ExchangedDocument>
    <TaxInvoiceDocument>
    <IssueID>201106294100</IssueID>
    <TypeCode>0101</TypeCode>
    <IssueDateTime>20110810</IssueDateTime>
    <PurposeCode>02</PurposeCode>
    </TaxInvoiceDocument>
    <TaxInvoiceTradeLineItem>
    <SequenceNumeric>1</SequenceNumeric>
    <InvoiceAmount>200000000</InvoiceAmount>
    <TotalTax>
    <CalculatedAmount>20000000</CalculatedAmount>
    </TotalTax>
    </TaxInvoiceTradeLineItem>
    </TaxInvoice>
    --2. sucess ----------- xml ---------remove namespace---------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <TaxInvoice>
    <ExchangedDocument>
    <IssueDateTime>20110810133213</IssueDateTime>
    <ReferencedDocument>
    <ID>318701-0002</ID>
    </ReferencedDocument>
    </ExchangedDocument>
    <TaxInvoiceDocument>
    <IssueID>201106294100</IssueID>
    <TypeCode>0101</TypeCode>
    <IssueDateTime>20110810</IssueDateTime>
    <PurposeCode>02</PurposeCode>
    </TaxInvoiceDocument>
    <TaxInvoiceTradeLineItem>
    <SequenceNumeric>1</SequenceNumeric>
    <InvoiceAmount>200000000</InvoiceAmount>
    <TotalTax>
    <CalculatedAmount>20000000</CalculatedAmount>
    </TotalTax>
    </TaxInvoiceTradeLineItem>
    </TaxInvoice>
    ---------- program ------------
    procedure insert_table
    l_clob clob,
    wellformed out boolean,
    error out varchar2
    is
    l_parser dbms_xmlparser.Parser;
    xmldoc xmldom.domdocument;
    l_doc dbms_xmldom.DOMDocument;
    l_nl dbms_xmldom.DOMNodeList;
    l_n dbms_xmldom.DOMNode;
    l_root DBMS_XMLDOM.domelement;
    l_node DBMS_XMLDOM.domnode;
    l_node2 DBMS_XMLDOM.domnode;
    l_text DBMS_XMLDOM.DOMTEXT;
    buf VARCHAR2(30000);
    xmlparseerror exception;
    TYPE tab_type is Table of xml_upload%ROWTYPE;
    t_tab tab_type := tab_type();
    pragma exception_init(xmlparseerror, -20100);
    l_node_name varchar2(300);
    begin
    l_parser := dbms_xmlparser.newParser;
    l_doc := DBMS_XMLDOM.newdomdocument;
    dbms_xmlparser.parseClob(l_parser, l_clob);
    l_doc := dbms_xmlparser.getDocument(l_parser);
    l_n := dbms_xmldom.makeNode(l_doc);
    l_nl := dbms_xslprocessor.selectNodes(l_n, '/TaxInvoice/TaxInvoiceDocument');
    FOR cur_tax In 0..dbms_xmldom.getLength(l_nl) - 1 LOOP
    l_n := dbms_xmldom.item(l_nl, cur_tax);
    t_tab.extend;
    t_tab(t_tab.last).ed_id := '5000000';
    dbms_xslprocessor.valueOf(l_n, 'IssueID/text()', t_tab(t_tab.last).tid_issue_id);
    dbms_xslprocessor.valueOf(l_n, 'TypeCode/text()', t_tab(t_tab.last).tid_type_code);
    END LOOP;
    FORALL i IN t_tab.first .. t_tab.last
    INSERT INTO xml_upload VALUES t_tab(i);
    COMMIT;
    dbms_xmldom.freeDocument(l_doc);
    wellformed := true;
    exception
    when xmlparseerror then
    --xmlparser.freeparser(l_parser);
    wellformed := false;
    error := sqlerrm;
    end insert_table;

    l_nl := dbms_xslprocessor.selectNodes(l_n, '/TaxInvoice/TaxInvoiceDocument');try to change as follow
    l_nl := dbms_xslprocessor.selectnodes(l_n,'/TaxInvoice/TaxInvoiceDocument','xmlns="urn:kr:or:kec:standard:Tax:ReusableAggregateBusinessInformation:1:0"');Edited by: AlexAnd on Aug 17, 2011 12:36 AM

  • Failing to extract xml value using Jdom & Xpath

    I have a method (getSingleNodeValue()) which when passed an xpatch expression will extract the value of the specified element in the xml document refered to in 'doc'. Assume doc at this point has been initialised as shown below and xmlInput is the buffer containing the xml content.
        SAXBuilder     builder          =     null;
        Document     doc          =     null;
        XPath          xpathInstance     =      null;
        doc     = builder.build(new StringReader(xmlInput));When i call the method, i pass the following xpath xpression
        /TOP4A/PERLODSUMDEC/TINPLD1/text()Here is the method. It basically just takes an xml buffer and uses xpath to extract the value:
        public static String getSingleNodeValue(String xpathExpr) throws Exception{
             Text list = null;
             try {
                  xpathInstance = XPath.newInstance(xpathExpr);
                  list = (Text) xpathInstance.selectSingleNode(doc);
             } catch (JDOMException e) {
                  throw new Exception(e);
             }catch (Exception e){
                  throw new Exception(e);
             return list==null ? "?" : list.getText();
        }The above method always returns "?" i.e. nothing is found so 'list' is null.
    The xml document it looks at is
        <TOP4A xmlns="http://www.testurl.co.uk/enment/gqr/3232/1">   
          <HEAD>
            <Doc>ABCDUK1234</Doc> 
          </HEAD>   
          <PERLODSUMDEC>
            <TINPLD1>10109000000000000</TINPLD1>
          </PERLODSUMDEC>
        </TOP4A>The same method works with other xml documents so i am not sure what is special about this one. There is no exception so the xml is valid xml. Its just that the method always sets 'list' to null. Any ideas?
    Edit
    Here is a running program testing the above:
        import org.jdom.*;
        import org.jdom.input.*;
        import org.jdom.xpath.*;
        import java.io.IOException;
        import java.io.StringReader;
        public class XpathTest {
             public static String getSingleNodeValue(String xpathExpr, String xmlInput) throws Exception{
                 Text list = null;
                  SAXBuilder  builder           =   null;
                  Document    doc                    =   null;
                  XPath       xpathInstance   =   null;
                 try {
                      builder     = new SAXBuilder();     
                      doc          = builder.build(new StringReader(xmlInput));
                     xpathInstance = XPath.newInstance(xpathExpr);
                     list = (Text) xpathInstance.selectSingleNode(doc);
                 } catch (JDOMException e) {
                     throw new Exception(e);
                 }catch (Exception e){
                     throw new Exception(e);
                 return list==null ? "Nothing Found" : list.getText();
             public static void main(String[] args){
                  String xmlInput1 = "<TOP4A xmlns=\"http://www.testurl.co.uk/enment/gqr/3232/1\"><HEAD><Doc>ABCDUK1234</Doc></HEAD><PERLODSUMDEC><TINPLD1>10109000000000000</TINPLD1></PERLODSUMDEC></TOP4A>";
                  String xpathExpr = "/TOP4A/PERLODSUMDEC/TINPLD1/text()";
                  XpathTest xp = new XpathTest();
                  try {
                       System.out.println(xp.getSingleNodeValue(xpathExpr, xmlInput1));
                  } catch (Exception e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
        }When i run the above, the output is
        Nothing foundEdit
    I have run some further testing and it appears that if i remove the namespace url it does work. Not sure why yet. Is there any way i can tell it to ignore the namespace?
    Edited by: ziggy on Sep 3, 2011 4:57 PM

    ziggy wrote:
    <TOP4A xmlns="http://www.testurl.co.uk/enment/gqr/3232/1">   
    <HEAD>
    <Doc>ABCDUK1234</Doc> 
    </HEAD>   
    <PERLODSUMDEC>
    <TINPLD1>10109000000000000</TINPLD1>
    </PERLODSUMDEC>
    </TOP4A>
    It works fine, the problem is not with namespace, it is with url have given.
    Editing:
    Found a way to say the program to ignore namespace.
    You have to use Xpath.addNamespace(prefix,uri), and pass the prefix to your pattern string.
    If not clear refer the below code:
    import org.jdom.*;
        import org.jdom.input.*;
        import org.jdom.xpath.*;
        import java.io.IOException;
        import java.io.StringReader;
        public class XpathTest {
             public static String getSingleNodeValue(String xpathExpr, String xmlInput) throws Exception{
                 Text list = null;
                  SAXBuilder  builder           =   null;
                  Document    doc                    =   null;
                  XPath       xpathInstance   =   null;
                 try {
                      builder     = new SAXBuilder();     
                      doc          = builder.build(new StringReader(xmlInput));
                     xpathInstance = XPath.newInstance(xpathExpr);
                        xpathInstance.addNamespace("ns","http://www.testurl.co.uk/enment/gqr/3232/1");
                     list = (Text) xpathInstance.selectSingleNode(doc);
                 } catch (JDOMException e) {
                     throw new Exception(e);
                 }catch (Exception e){
                     throw new Exception(e);
                 return list==null ? "Nothing Found" : list.getText();
             public static void main(String[] args){
                  String xmlInput1 = "<TOP4A xmlns=\"http://www.testurl.co.uk/enment/gqr/3232/1\"><HEAD><Doc>ABCDUK1234</Doc></HEAD><PERLODSUMDEC><TINPLD1>10109000000000000</TINPLD1></PERLODSUMDEC></TOP4A>";
                  String xpathExpr = "/ns:TOP4A/ns:PERLODSUMDEC/ns:TINPLD1/text()";
                  XpathTest xp = new XpathTest();
                  try {
                       System.out.println(xp.getSingleNodeValue(xpathExpr, xmlInput1));
                  } catch (Exception e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
        }Edited by: 833545 on Sep 8, 2011 11:35 PM

  • Using selectSingleNode with namespace prefixes like "xmlsns:xsi"???

    I'm having a little trouble manipulating a document with the xmlparserv2 library. The XMLNode.selectSingleNode method does not seem to work when the attribute in question is part of a namespace. For example, I have a document that has a schema declaration like so:
    ****CUT****
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="..\XMLStressTestCase.xsl"?>
    <XMLTestCase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../XmlStressTestCase.xsd" Name="Engenious (Switch) Eligible Test" MaxTime="30000">
    ****CUT****
    If I create an XMLDocument (myDoc) from the file in question and try to execute the following line of code
    Node n = myDoc.selectSingleNode("@xmlns:xsi");
    I get the following error
    " Namespace prefix 'xmlns' used but not declared."
    In google I found a thread (http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=ugJD7hJ3BHA.2236%40tkmsftngp02&rnum=2&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dxmlns%2B%252B%2BselectSingleNode%26sa%3DN%26tab%3Dwg)that points to setProperty/selectionNamespaces
    as qa possible way to resolve the problem in the MSXML implementation. It looks like the oracle XDK has the same method, but I can't seem to find any documentation on the values that are supported for that method (http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Production9i/doc/java/javadoc/oracle/xml/parser/v2/XMLNode.html#setProperty(java.lang.String, java.lang.Object))
    Any help? Should I be declaring the namespace in my XML someplace?

    In fact it used to be possible to set a NamespacePrefixMapper that controls the namespace prefixes in the JAXB 2.0 from Glasfish like this:
    marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new MyNamespacePrefixMapper());
    When using the Java 6 implementation of JAXB this coded will throw an exception. Has anyone got a clue how to control the namespace prefix in Java 6?
    Thanks,
    Ager

  • Extract xml file with rowset schema using plsql

    I want to extract the rowsheet data from an xml file using plsql database procedure
    Here is an example of the xml file:
    <xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
         xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
         xmlns:rs='urn:schemas-microsoft-com:rowset'
         xmlns:z='#RowsetSchema'>
    <s:Schema id='RowsetSchema'>
         <s:ElementType name='row' content='eltOnly'>
              <s:AttributeType name='Sheet_Number' rs:number='1' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
              </s:AttributeType>
              <s:AttributeType name='Appl_Number1' rs:number='2' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
              </s:AttributeType>
              <s:AttributeType name='Rating1' rs:number='3' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='string' dt:maxLength='25'/>
              </s:AttributeType>
              <s:AttributeType name='Criteria1' rs:number='4' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='string' dt:maxLength='25'/>
              </s:AttributeType>
              <s:AttributeType name='Appl_Number2' rs:number='5' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
              </s:AttributeType>
              <s:AttributeType name='Rating2' rs:number='6' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='string' dt:maxLength='25'/>
              </s:AttributeType>
              <s:AttributeType name='Criteria2' rs:number='7' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='string' dt:maxLength='25'/>
              </s:AttributeType>
              <s:extends type='rs:rowbase'/>
         </s:ElementType>
    </s:Schema>
    <rs:data>
         <z:row Sheet_Number='32486' Appl_Number1='198970' Rating1='-2' Criteria1='RTG' Appl_Number2='198989' Rating2='5'
              Criteria2='RTG'/>
         <z:row Sheet_Number='12345' Appl_Number1='198970' Rating1='-3' Criteria1='RTG' Appl_Number2='198989' Rating2='3'
              Criteria2='RTG'/>
    </rs:data>
    </xml>
    I need to extract the values from all of the columns : sheet_number, appl_number1, rating1, criteria1, appl_number2, rating2, criteria2. Validate the data and insert into oracle tables.
    I'm having dificulties extrating the data from the "z:row" recordset
    Can anyone help with the syntax ?
    I'm use to extracting with tags using syntax like this
    declare
    v_xml_content XMLTYPE;
    begin
    v_xml_content := db_get_xml_from_file (p_file_name, p_directory, 'ISO-8859-1');
    FOR f IN (SELECT value(x) file_data
    FROM TABLE
    (xmlsequence
    (extract (v_xml_content,'/data'))) x) LOOP
    SELECT extractvalue(f.file_data,'/data/row') into v_row from dual;                                                                      END LOOP;

    I want to extract the rowsheet data from an xml file using plsql database procedure
    Here is an example of the xml file:
    <xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
         xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
         xmlns:rs='urn:schemas-microsoft-com:rowset'
         xmlns:z='#RowsetSchema'>
    <s:Schema id='RowsetSchema'>
         <s:ElementType name='row' content='eltOnly'>
              <s:AttributeType name='Sheet_Number' rs:number='1' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
              </s:AttributeType>
              <s:AttributeType name='Appl_Number1' rs:number='2' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
              </s:AttributeType>
              <s:AttributeType name='Rating1' rs:number='3' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='string' dt:maxLength='25'/>
              </s:AttributeType>
              <s:AttributeType name='Criteria1' rs:number='4' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='string' dt:maxLength='25'/>
              </s:AttributeType>
              <s:AttributeType name='Appl_Number2' rs:number='5' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' rs:fixedlength='true'/>
              </s:AttributeType>
              <s:AttributeType name='Rating2' rs:number='6' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='string' dt:maxLength='25'/>
              </s:AttributeType>
              <s:AttributeType name='Criteria2' rs:number='7' rs:nullable='true' rs:maydefer='true' rs:writeunknown='true'>
                   <s:datatype dt:type='string' dt:maxLength='25'/>
              </s:AttributeType>
              <s:extends type='rs:rowbase'/>
         </s:ElementType>
    </s:Schema>
    <rs:data>
         <z:row Sheet_Number='32486' Appl_Number1='198970' Rating1='-2' Criteria1='RTG' Appl_Number2='198989' Rating2='5'
              Criteria2='RTG'/>
         <z:row Sheet_Number='12345' Appl_Number1='198970' Rating1='-3' Criteria1='RTG' Appl_Number2='198989' Rating2='3'
              Criteria2='RTG'/>
    </rs:data>
    </xml>
    I need to extract the values from all of the columns : sheet_number, appl_number1, rating1, criteria1, appl_number2, rating2, criteria2. Validate the data and insert into oracle tables.
    I'm having dificulties extrating the data from the "z:row" recordset
    Can anyone help with the syntax ?
    I'm use to extracting with tags using syntax like this
    declare
    v_xml_content XMLTYPE;
    begin
    v_xml_content := db_get_xml_from_file (p_file_name, p_directory, 'ISO-8859-1');
    FOR f IN (SELECT value(x) file_data
    FROM TABLE
    (xmlsequence
    (extract (v_xml_content,'/data'))) x) LOOP
    SELECT extractvalue(f.file_data,'/data/row') into v_row from dual;                                                                      END LOOP;

  • Selecting XML Children with Namespaces

    I am trying to select child nodes of an XML element that have
    a different namespace from the parent, but xml.child(name) returns
    an empty list.
    In the attached code, londonList contains a single XML
    element and parisList is empty. I can't figure out how to find the
    paris child, and have tried adding the prefix to findParis (so it
    is "ff:b") as well as turning findParis into an XML object with the
    name "b" and adding the ff namespace to it, then passing that to
    child. Neither of those have worked.
    Any help is appreciated.

    Unfortunately in my real scenario I don't know what the
    element will be called. It could be in <foo> or <bar>
    etc, so I need to be able to use a variable (in which the element
    name is set beforehand). With "::" I can't use a variable, so
    textXML.ns::findParis looks for a "findParis" element and not "b".
    That's why I'm trying to use testXML.child(findParis) because
    I can use a variable. I just can't figure out how to make it
    incorporate the namespace as well.

  • Problem with namespace prefix

    Dear all,
    I'm using code generated by NW Developer Studio  2004s for use inside Portal components acting as a web service consumer. The problem is that the code generated includes a namespace prefix for each element in the body of the message, but ECC (ERP 6.0) doesn't like the namespace prefixes (the namespace was not recognised by the ECC mapping tool.)and throws back a DeliveryException.
    The SOAP message created by the generated NWDS code is:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wn3="http://www.w3.org/1999/XMLSchema" xmlns:wn2="http://www.w3.org/2000/10/XMLSchema" xmlns:wn1="http://www.w3.org/2001/XMLSchema" xmlns:wn0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wn4="urn:sap-com:document:sap:rfc:functions" xmlns:tns="urn:sap-com:document:sap:rfc:functions">
    - <SOAP-ENV:Body>
    - <wn4:Z_APPOINTMENT_GET_JCO_ORG>
      <wn4:DATE_FROM>2007.01.01</wn4:DATE_FROM>
      <wn4:DATE_TO>2008-02-02</wn4:DATE_TO>
      <wn4:USERID>EGREO</wn4:USERID>
      </wn4:Z_APPOINTMENT_GET_JCO_ORG>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
    I've had a very good look around the generated code - the serializers for creating the soap request - but could not find what exactly might be changed to leave off the prefixes.
    I am using portal server 2004s
    Many thanks for any advice/help
    Reza

    I find out how should I do that.
    /Reza

  • Best way to extract XML value wiith an xpath

    Hello,
    I wonder what is the best way to extract text value from XmlType with an xpath.
    I need to insert a row inside a table where the row's data come from xpath extractions of an XmlType. I do a lot of (approximative 20) :
    EXTRACTVALUE(var.myxmltype , '/an/xpath/to/extract/elem1').
    EXTRACTVALUE(var.myxmltype , '/an/xpath/to/extract/elemI').
    EXTRACTVALUE(var.myxmltype , '/an/xpath/to/extract/elem20').
    inside the insert statement
    Is this way is the best or is there a more optimal way ?
    For example extracting the node '/an/xpath/to/extract/' and sarting from this node extracting "elem1", ... , "elemI", "elemN" children.
    Thanks for your help,
    Regards,
    Nicolas

    Hi Nicolas,
    The answer depends on your actual storage method (binary, OR, CLOB?), and db version.
    You can try XMLTable, it might be better in this case :
    SELECT x.elem1, x.elem2, ... , x.elem20
    FROM your_table t
       , XMLTable(
          '/an/xpath/to/extract'
          passing t.myxmltype
          columns elem1  varchar2(30) path 'elem1'
                , elem2  varchar2(30) path 'elem2'
                , elem20 varchar2(30) path 'elem20'
         ) x
    ;

  • How must getElementsByTagName work on an xml file with namespaces?

    Hello together,
    is there any normative document, which specifies
    which nodes must be returned by
    the org.w3c.dom.Document method
    getElementsByTagName when which was
    created by a namespace aware dom parser
    from an xml file containing namespaces?
    In other words:
    when you have an xml file:
    <someprefix:somenode xmlns:someprefix="http://someuri">
    <someprefix:innertag>
    <someprefix:mostinnertag>
    </someprefix:mostinnertag>
    <someprefix:mostinnertag>
    </someprefix:mostinnertag>
    </someprefix:innertag>
    </someprefix>
    and you call
    document.getElementsByTagName( ... );
    1) How many nodes must be returned when giving
    "mostinnertag" as parameter?
    2) How many nodes when giving "someprefix:mostinnertag" as parameter?
    Is it allowed to use the "non namespaceaware"
    method and not "getElementsByTagNameNS"?
    I know:
    a) xerces returns 2 nodes when using
    alternative 2 and none with alternative 1
    b) oracle xml parser returns 2 nodes when using
    alternative 1 and none when using alternative 2
    Which implementation is right?
    Yours
    Stefan

    I've got some problems with this methos and xerces too.
    Perhaps the two implementations (xerces and oracle) are different. I mean xerces implementation gives you nodes of this name but without namespace and oracles's implementation gives you modes with namespace whose unprefix-name is "mostinnertag".

  • Create XML-element with different prefixes

    Hello,
    In Infopath 2010 I want to generate a XML-element with C#.
    I've got a XML-structure with following elements:
    /my:meineFelder/my:gruppe1/my:gruppe2/my:unter/my:art
    /my:meineFelder/my:gruppe1/my:gruppe2/ns1:FW1/MANDT
    To fill the field "art" I use this code:
    string myNamespace = NamespaceManager.LookupNamespace("my");
    writer.WriteStartElement("gruppe2", myNamespace);
      writer.WriteStartElement("unter", myNamespace);
        writer.WriteElementString("art", myNamespace, "lets go");
      writer.WriteEndElement();
    writer.WriteEndElement();
    writer.Close();
    This works very well.
    Problem: the code above do not work for the second field MANDT. Error: Error during Schema Validation.
    /my:meineFelder/my:gruppe1/my:gruppe2/ns1:FW1/MANDT
    I tried this:
     writer.WriteStartElement("ns1", "FW1", myNamespace);
            writer.WriteElementString("ns1", "MANDT", myNamespace, "100");
            writer.WriteEndElement();
    As you can see, the problem is ns1:FW1. How to fix it?
    Thank you very much!
    Regards,
    spadmin

    Hi,
    solved with:
    String xpath = "/my:xxx/my:gruppe1/my:gruppe2[last()]";
    XPathNavigator oldGroup = MainDataSource.CreateNavigator().SelectSingleNode(xpath, NamespaceManager);
    XPathNavigator newGroup = oldGroup.Clone();
    oldGroup.InsertBefore(newGroup);
    Regards

  • Is it possible to create indexes & use them on xml docs with namespaces?

    I have put an XML doc in a BDBXML container which looks like this:
    *<ns1:note xmlns:ns1="http://www.testsch.org/ns">*
    *<ns1:to>Eric</ns1:to>*
    *<ns1:from>Brendan</ns1:from>*
    *<ns1:msg>How r u?</ns1:msg>*
    *</ns1:note>*
    Now, I am creating an index on the element "to", as:
    addIndex "ns1" "to" node-element-equality-string
    Though the index has been shown as getting created using the listIndexes command, if I lookup that index with the following command:
    lookupIndex node-element-equality-string "ns1" "to"
    the output is:
    *0 objects returned for eager index lookup 'node-element-equality-string'*
    Whereas, if I do the whole procedure without the namespaces in the document & the commands, the result is fine:
    *1 object returned for eager index lookup 'node-element-equality-string'*
    Can someone please tell me whether using namespaces, the indexes can be created or not? If yes, how?
    Thanks,
    Dev
    Edited by: user11871332 on Sep 7, 2009 3:53 PM

    Hi Dev,
    When using XML, the prefix for the namespace is really just syntactic sugar. The actual namespace in your example is "http://www.testsch.org/ns", and that's the value that you need to use when creating your index:
    addIndex "http://www.testsch.org/ns" "to" node-element-equality-stringJohn

Maybe you are looking for