How do i query attributes from xml documents

I want to to query only details in Issue id="705230" (id is an attribute)
I tried this, but does not help. I should be able to query the value of core_org_id attribute
select extract(CLOB_DATA, 'PcrDocument/PcrOrganization/core_org_id) CORE_ORG_ID from from pcr_files where existsNode(CLOB_DATA, 'PcrDocument/PcrOrganization/Issues/Issue[@id="705230"]')=1;
-- does not return anything....
I tried to extract value for R_DATE & R_REVIEW_DATE for issue id=705230, but iam not able to.
Data for all the issues is retured.
Here is the query used...
select extract(CLOB_DATA, 'PcrDocument/PcrOrganization/Issues/Issue') ISSUE from pcr_files where existsNode(CLOB_DATA, 'PcrDocument/PcrOrganization/Issues/Issue[@id="705230"]')=1;
Here is the part of XML document iam querying on...
- <ns1:PcrDocument id="PCR-13562" title="EU Disclosures - EC 1060/2009" version="1" pcrPublishDate="2012-01-11T12:49:02" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://integration.mysite.com/ServiceSchema/v3">
- <ns1:PcrOrganization core_org_id="345840">
<ns1:PcrLinkedTo value="ISSUE" />
- <ns1:AdditionalInfo>
<ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
</ns1:AdditionalInfo>
- <ns1:Issues>
- <ns1:Issue id="705230">
- <ns1:AdditionalInfo>
<ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
<ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
<ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
</ns1:AdditionalInfo>
- <ns1:IssueDetail id="114766798">
- <ns1:AdditionalInfo>
<ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
<ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
<ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
</ns1:AdditionalInfo>
</ns1:IssueDetail>
</ns1:Issue>
- <ns1:Issue id="727193">
- <ns1:AdditionalInfo>
<ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
<ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
<ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
</ns1:AdditionalInfo>
- <ns1:IssueDetail id="117994574">
- <ns1:AdditionalInfo>
<ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
<ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
<ns1:Info type="AdditionalInfo_QuartelyReport_URL"><br></br>MGH</ns1:Info>
</ns1:AdditionalInfo>
</ns1:IssueDetail>
</ns1:Issue>
</ns1:Issues>
</ns1:PcrOrganization>
</ns1:PcrDocument>

I did not include the name space declaration for it is working fine. Really? Then I suppose you must be using a schema-based XMLType column?
Is it Object-Relational or Binary XML storage?
You mentioned it is depricated in 11.2, but iam able to run it on 11.2.Deprecated doesn't mean it ceases functioning.
Any suggestions to covert this to XMLTable/XMLQuery format please..If you read the documentation, it covers this part too ;)
Example :
create table tmp_xml of xmltype;
insert into tmp_xml values(
xmltype('<ns1:PcrDocument id="PCR-13562" title="EU Disclosures - EC 1060/2009" version="1" pcrPublishDate="2012-01-11T12:49:02" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://integration.mysite.com/ServiceSchema/v3">
  <ns1:PcrRatingDetails>
    <ns1:LeadAnalyst>
      <ns1:FirstName>xxxxx</ns1:FirstName>
      <ns1:MiddleName/>
      <ns1:LastName>xxxxxx</ns1:LastName>
      <ns1:Title>Director</ns1:Title>
      <ns1:Label>Primary Analyst</ns1:Label>
      <ns1:Telephone>xxxxxxxxxxxx</ns1:Telephone>
      <ns1:Email>[email protected]</ns1:Email>
      <ns1:Address>
        <ns1:Line1>Main Tower</ns1:Line1>
        <ns1:Line2>Neue Mainzer Strasse</ns1:Line2>
        <ns1:City>FFT</ns1:City>
        <ns1:State/>
        <ns1:ZipCode>99999</ns1:ZipCode>
        <ns1:Country>Germany</ns1:Country>
      </ns1:Address>
    </ns1:LeadAnalyst>
    <ns1:RatingApprover>
      <ns1:FirstName>Nick</ns1:FirstName>
      <ns1:MiddleName/>
      <ns1:LastName>Mate</ns1:LastName>
    </ns1:RatingApprover>
  </ns1:PcrRatingDetails>
  <ns1:PcrOrganization core_org_id="345840">
    <ns1:PcrLinkedTo value="ISSUE"/>
    <ns1:AdditionalInfo>
      <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
        <br/>
        <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
      </ns1:Info>
    </ns1:AdditionalInfo>
    <ns1:Issues>
      <ns1:Issue id="705230">
        <ns1:AdditionalInfo>
          <ns1:Info type="R_DATE">Credit  Release Date: 09-Apr-2010</ns1:Info>
          <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
          <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
            <br/>
            <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
          </ns1:Info>
        </ns1:AdditionalInfo>
        <ns1:IssueDetail id="114766798">
          <ns1:AdditionalInfo>
            <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
            <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
            <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
              <br/>
              <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
            </ns1:Info>
          </ns1:AdditionalInfo>
        </ns1:IssueDetail>
      </ns1:Issue>
      <ns1:Issue id="727193">
        <ns1:AdditionalInfo>
          <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
          <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
          <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
            <br/>
            <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
          </ns1:Info>
        </ns1:AdditionalInfo>
        <ns1:IssueDetail id="117994574">
          <ns1:AdditionalInfo>
            <ns1:Info type="R_DATE">Credit Release Date: 09-Apr-2010</ns1:Info>
            <ns1:Info type="R_REVIEW_DATE">Credit Last Review Date: 12-Oct-2011</ns1:Info>
            <ns1:Info type="AdditionalInfo_QuartelyReport_URL">
              <br/>
              <A href="http://www.mysite.com/rts/articles/en/us/?articleType=HTML&amp;assetID=1245321070686" target="_blank">MGH</A>
            </ns1:Info>
          </ns1:AdditionalInfo>
        </ns1:IssueDetail>
      </ns1:Issue>
    </ns1:Issues>
  </ns1:PcrOrganization>
</ns1:PcrDocument>')
SQL> set long 10000
SQL>
SQL> select x1.analyst
  2       , x1.chair
  3       , x1.core_org_id
  4       , x2.*
  5  from tmp_xml t
  6     , xmltable(
  7         xmlnamespaces(default 'http://integration.mysite.com/ServiceSchema/v3')
  8       , '/PcrDocument'
  9         passing t.object_value
10         columns analyst     xmltype path 'PcrRatingDetails/LeadAnalyst'
11               , chair       xmltype path 'PcrRatingDetails/RatingApprover'
12               , core_org_id number  path 'PcrOrganization/@core_org_id'
13               , issues      xmltype path 'PcrOrganization/Issues/Issue'
14       ) x1
15     , xmltable(
16         xmlnamespaces(default 'http://integration.mysite.com/ServiceSchema/v3')
17       , '/Issue'
18         passing x1.issues
19         columns issue                 number       path '@id'
20               , rating_date           varchar2(40) path 'AdditionalInfo/Info[@type="R_DATE"]'
21               , rating_review_date    varchar2(40) path 'AdditionalInfo/Info[@type="R_REVIEW_DATE"]'
22               , issue_detail          number       path 'IssueDetail/@id'
23               , id_rating_date        varchar2(40) path 'IssueDetail/AdditionalInfo/Info[@type="R_DATE"]'
24               , id_rating_review_date varchar2(40) path 'IssueDetail/AdditionalInfo/Info[@type="R_REVIEW_DATE"]'
25       ) x2
26  where x2.issue = 705230
27  ;
ANALYST                                                                          CHAIR                                                                            CORE_ORG_ID      ISSUE RATING_DATE                              RATING_REVIEW_DATE                       ISSUE_DETAIL ID_RATING_DATE                           ID_RATING_REVIEW_DATE
<LeadAnalyst xmlns="http://integration.mysite.com/ServiceSchema/v3">             <RatingApprover xmlns="http://integration.mysite.com/ServiceSchema/v3">               345840     705230 Credit  Release Date: 09-Apr-2010        Credit Last Review Date: 12-Oct-2011        114766798 Credit Release Date: 09-Apr-2010         Credit Last Review Date: 12-Oct-2011
  <FirstName>xxxxx</FirstName>                                                     <FirstName>Nick</FirstName>                                                                                                                                                                                                                  
  <MiddleName/>                                                                    <MiddleName/>                                                                                                                                                                                                                                
  <LastName>xxxxxx</LastName>                                                      <LastName>Mate</LastName>                                                                                                                                                                                                                    
  <Title>Director</Title>                                                        </RatingApprover>                                                                                                                                                                                                                              
  <Label>Primary Analyst</Label>                                                                                                                                                                                                                                                                                                
  <Telephone>xxxxxxxxxxxx</Telephone>                                                                                                                                                                                                                                                                                           
  <Email>[email protected]</Email>                                                                                                                                                                                                                                                                                         
  <Address>                                                                                                                                                                                                                                                                                                                     
    <Line1>Main Tower</Line1>                                                                                                                                                                                                                                                                                                   
    <Line2>Neue Mainzer Strasse</Line2>                                                                                                                                                                                                                                                                                         
    <City>FFT</City>                                                                                                                                                                                                                                                                                                            
    <State/>                                                                                                                                                                                                                                                                                                                    
    <ZipCode>99999</ZipCode>                                                                                                                                                                                                                                                                                                    
    <Country>Germany</Country>                                                                                                                                                                                                                                                                                                  
  </Address>                                                                                                                                                                                                                                                                                                                    
</LeadAnalyst>                                                                                                                                                                                                                                                                                                                  

Similar Messages

  • How to remove elements/attributes from XML using Xpath in XSLT ??

    Hello ,
    Is there anyway or method of Xpath from which I can delete the elements and attributes from XML at runtime ??
    Like I have such XML and I have to remove per attribute highlighted below
    <person per="and">
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    And want a result like this
    <person>
    <e:emp a="ir" b="ad" >
    </e:emp>
    </person>
    Thanks

    To achieve this you can use the bpelx:remove function: http://download.oracle.com/docs/cd/E12483_01/integrate.1013/b28981/manipdoc.htm#CIHJBJFD
    your assign will look like:
    <bpel:assign>
    <bpelx:remove>
    <target variable="person" query="/person/@per" />
    </bpelx:remove>
    </bpel:assign>
    Regards,
    Melvin

  • How can I query data from XML file stored as a CLOB ?

    Hi folks,
    please see below sample of XML file, which is stored in "os_import_docs", column "document" as CLOB.
    I would like to query this XML file using some SQL select.
    How can I query data form below XML?
    <?xml version="1.0" encoding="UTF-8"?>
    <etd>
      <header>
        <AR>000000000</AR>
        <AW>0</AW>
        <CT>S</CT>
        <CU>H</CU>
        <CZ>SS48</CZ>
        <BU>4</BU>
        <CH>0032</CH>
        <CK>2012-11-01</CK>
        <CL>21:18</CL>
        <CW>225</CW>
        <CX>0</CX>
        <CF>SS-CZL18</CF>
        <DV>2</DV>
      </header>
      <account_group id="234">
        <account id="234">
          <invoice id="000742024">
            <da>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>A</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>88754515</BS>
              <AD>Mike Tyson</AD>
              <AC>Mike Tyson</AC>
              <AZ>CZ6521232465</AZ>
              <AE/>
              <CG>A</CG>
              <AL>A</AL>
              <BZ>.</BZ>
              <AH>Some street</AH>
              <AI/>
              <AF>Some city</AF>
              <AK>Kraj</AK>
              <AG>CZ</AG>
              <AJ>885 21</AJ>
              <CR>21-11-2012</CR>
              <AY>602718709</AY>
              <AV>800184965</AV>
              <AP/>
              <AO/>
              <AQ/>
              <AN/>
            </da>
            <da>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>A</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>88754515</BS>
              <AD>Mike Tyson</AD>
              <AC>Mike Tyson</AC>
              <AZ>CZ6521232465</AZ>
              <AE/>
              <CG>A</CG>
              <AL>L</AL>
              <BZ>Mike Tyson</BZ>
              <AH>Some street</AH>
              <AI/>
              <AF>Some city</AF>
              <AK>Kraj</AK>
              <AG>CZ</AG>
              <AJ>885 21</AJ>
              <CR>21-11-2012</CR>
              <AY/>
              <AV>800184965</AV>
              <AP/>
              <AO/>
              <AQ/>
              <AN/>
            </da>
            <detaildc CH="0032" AB="234" BS="11888954" BB="32" BA="CZ" AT="" CI="7077329000002340342" AU="" DU="1Z48395" CB="CZK">
              <dc>
                <AW>0</AW>
                <CT>D</CT>
                <CU>C</CU>
                <BY>31-10-2012</BY>
                <CA>25-10-2012</CA>
                <CV>8151</CV>
                <BT>12111</BT>
                <CJ>1</CJ>
                <AM>0</AM>
                <DR>PC</DR>
                <DS/>
                <DO>25-10-2012</DO>
                <DQ>18:42</DQ>
                <CE>1</CE>
                <BH>8151</BH>
                <CY>8151 SHELL MALKOVICE P</CY>
                <DP>049336</DP>
                <DT/>
                <BQ/>
                <BR>500000</BR>
                <CN>30</CN>
                <CM>030</CM>
                <BO>160,00</BO>
                <BF>38,900</BF>
                <BC>6224,00</BC>
                <BI>32,417</BI>
                <CD>B</CD>
                <BG>0,600</BG>
                <BK>31,817</BK>
                <BJ>0,000</BJ>
                <DI>8</DI>
                <BP>20,00%</BP>
                <CC>CZK</CC>
                <BM>5090,67</BM>
                <BN>1018,13</BN>
                <BL>6108,80</BL>
                <BD>5090,67</BD>
                <BE>1018,13</BE>
                <DW>6108,80</DW>
                <CO>Nafta</CO>
              </dc>
            </detaildc>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>1</DG>
              <CN>30</CN>
              <CM>030</CM>
              <DF>160,00</DF>
              <DH>litr</DH>
              <DJ>20,00%</DJ>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA>P</DA>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>2</DG>
              <CN/>
              <CM/>
              <DF>160,00</DF>
              <DH>litr</DH>
              <DJ/>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA/>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>19</DG>
              <CN/>
              <CM/>
              <DF/>
              <DH/>
              <DJ/>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA/>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
            <dt>
              <AR>000742024</AR>
              <AW>0</AW>
              <CT>D</CT>
              <CU>T</CU>
              <CH>0032</CH>
              <BY>31-10-2012</BY>
              <CA>25-10-2012</CA>
              <AB>234</AB>
              <AA>234</AA>
              <BS>11888954</BS>
              <BB/>
              <BA>CZ</BA>
              <DG>8</DG>
              <CN/>
              <CM/>
              <DF/>
              <DH/>
              <DJ/>
              <DD>5090,67</DD>
              <DE>1018,13</DE>
              <DC>6108,80</DC>
              <DB>CZK</DB>
              <DA/>
              <AX/>
              <CQ/>
              <CP/>
            </dt>
          </invoice>
        </account>
      </account_group>
      <footer>
        <AR>999999999</AR>
        <AW>0</AW>
        <CT>S</CT>
        <CU>T</CU>
        <CZ>SS48</CZ>
        <BU>4</BU>
        <CH>0032</CH>
        <CK>2012-11-01</CK>
        <CL>23:04</CL>
        <CW>225</CW>
        <BX>1</BX>
        <CS>7</CS>
        <BW>0000000000000610880</BW>
      </footer>
    </etd>sample - not working:
        select  x.*
        from os_import_docs d
             ,XMLTABLE('/etd/header'
                        PASSING httpuritype(d.document).getXML()
                        COLUMNS
                           response_status varchar2(50) PATH 'AR'
                        )  x
       where d.object_id = 2587058
         and rownum = 1; 
    ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 6196, maximum: 4000)Many thanks,
    Tomas

    Hello,
    many thanks for the reply. Your examples are very usefull for me.
    To answer your questions.
    An XML structure:
    /etd
        /header - repeat in each row in output
        /account_group/account
            /invoice
                /da - repeat for each details under "selected "invoice
                /detaildc/dc - the lowest level 
                /detaildn/dn - the lowest level 
                /dt - repeat for each details under "selected "invoice
        /footer - repeat in each row in outputI would like to to have a 1 row for each "record" in /detaildc section and include related nodes at higher levels.
    Please see below XML file, which is simplified file of example in first post, but includes a complete xml structure which needs to be queried in db.
    <?xml version="1.0" encoding="UTF-8"?>
    <etd>
      <header>
        <AR>000000000</AR>
        <CK>2012-10-31</CK>
        <CF>SS-CZL19</CF>
      </header>
      <account_group id="234">
        <account id="234">
          <invoice id="EI08P4000">
            <da>
              <AR>EI08P4000</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildc DU="1Z56655" CB="EUR">
              <dc>
                <DO>16-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>1940,60</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="2Z55050" CB="EUR">
              <dc>
                <DO>17-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>1328,10</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="2Z90001" CB="EUR">
              <dc>
                <DO>27-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>185,10</BM>
                <CO>Poplatek</CO>
              </dc>
            </detaildc>
            <dt>
              <AR>EI08P4000</AR>
              <DG>8</DG>
            </dt>
          </invoice>
        </account>
        <account id="234">
          <invoice id="EI13T7777">
            <da>
              <AR>EI13T7777</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildc DU="1Z48302" CB="EUR">
              <dc>
                <DO>26-10-2012</DO>
                <CY>SANEF 07706 A 07704</CY>
                <BM>232,10</BM>
                <CO>Dalnicni poplatek</CO>
              </dc>
            </detaildc> 
            <detaildc DU="1Z48302" CB="EUR">
              <dc>
                <DO>20-10-2012</DO>
                <CY>TEST A 07704</CY>
                <BM>30,10</BM>
                <CO>Poplatek</CO>
              </dc>
            </detaildc>       
            <dt>
              <AR>EI13T7777</AR>
              <DG>8</DG>         
            </dt>
          </invoice>
        </account>
        <account id="234">
          <invoice id="EI327744">
            <da>
              <AR>EI327744</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildn  CI="707732 00000234" >
              <dn>
                <BY>30-10-2012</BY>
                <BM>8,10</BM>
              </dn>
            </detaildn>
            <detaildn CI="707732 00000234" >
              <dn>
                <BY>30-10-2012</BY>
                <BM>399,50</BM>
              </dn>
            </detaildn>
            <dt>
              <AR>EI327744</AR>
            </dt>
          </invoice>
        </account>
        <account id="234">
          <invoice id="EI349515">
            <da>
              <AR>EI349515</AR>
              <AD>Mickey Mouse</AD>
            </da>
            <detaildc DU="1Z56514" CB="EUR">
              <dc>
                <DO>29-10-2012</DO>
                <CY>ALLAMI AUTOPALYAKEZE</CY>
                <BM>1240,60</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="1Z56515" CB="EUR">
              <dc>
                <DO>19-10-2012</DO>
                <CY>ASFINAG POST_MAUT</CY>
                <BM>7428,10</BM>
                <CO>Dalnicni znamka</CO>
              </dc>
            </detaildc>
            <detaildc DU="1Z56515" CB="EUR">
              <dc>
                <DO>12-10-2012</DO>
                <CY>UK</CY>
                <BM>954,10</BM>
                <CO>Poplatek</CO>
              </dc>
            </detaildc>
            <dt>
              <AR>EI349515</AR>
              <DG>8</DG>
            </dt>
          </invoice>
        </account>
      </account_group>
      <footer>
        <CZ>SS47</CZ>
        <BU>4</BU>
        <CH>0032</CH>
        <CK>2012-10-31</CK>
        <CL>01:25</CL>
      </footer>
    </etd>Expected output
    AR     CK     CF             AR4             AD             DU     CB     DO             CY                     BM      CO                AR5             DG     CI             BY               BM6     CZ     BU       CH       CK7    CL
    0     41213     SS-CZL19     EI08P4000     Mickey Mouse     1Z56655     EUR     16-10-2012     ASFINAG POST_MAUT     1940,60     Dalnicni znamka        EI08P4000     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI08P4000     Mickey Mouse     2Z55050     EUR     17-10-2012     ASFINAG POST_MAUT     1328,10     Dalnicni znamka        EI08P4000     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI08P4000     Mickey Mouse     2Z90001     EUR     27-10-2012     ASFINAG POST_MAUT      185,10     Poplatek        EI08P4000     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI13T7777     Mickey Mouse     1Z48302     EUR     26-10-2012     SANEF 07706 A 07704      232,10     Dalnicni poplatek  EI13T7777     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI13T7777     Mickey Mouse     1Z48302     EUR     20-10-2012     TEST A 07704               30,10     Poplatek        EI13T7777     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI327744     Mickey Mouse                                                                      EI327744          707732 00000234     30-10-2012     8,10     SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI327744     Mickey Mouse                                                                      EI327744          707732 00000234     30-10-2012     399,50     SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI349515     Mickey Mouse     1Z56514     EUR     29-10-2012     ALLAMI AUTOPALYAKEZE     1240,60     Dalnicni znamka        EI349515     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI349515     Mickey Mouse     1Z56515     EUR     19-10-2012     ASFINAG POST_MAUT     7428,10     Dalnicni znamka        EI349515     8                                    SS47     4     32     41213     01:25
    0     41213     SS-CZL19     EI349515     Mickey Mouse     1Z56515     EUR     12-10-2012     UK                      954,10     Poplatek        EI349515     8                                    SS47     4     32     41213     01:25

  • Could not retrieve attributes from XML document loaded in JDOM

    Hi All,
    I am having difficulty reading and parsing the following XML City.xml document using Saxon parser and XPath:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/ /EN" "http://www. w3.org/TR/ xhtml1/DTD/ xhtml1-transitio nal.dtd">
    <html xmlns="http: //www.w3. org/1999/ xhtml">
        <head>
            <meta http-equiv=" Content-Type" content="text/ html; charset=UTF- 8" />
        </head>
        <body>
            <div id="content">
                <table class="sresults">
                    <tr>
                        <td>
                            <a href="http:/ /www.abc.com/areas" title=" Hollywood , CA "> hollywood </a>
                        </td>
                        <td>
                            <a href="http:/ /www.abc.com/areas" title=" San Jose , CA "> san jose </a>
                        </td>
                        <td>
                            <a href="http:/ /www.abc.com/areas" title=" San Francisco , CA "> san francisco </a>
                        </td>
                        <td>
                            <a href="http:/ /www.abc.com/areas" title=" San Diego , CA "> San diego </a>
                        </td>
                    </tr>
            </body>
    </html> Below is the code snippets that illustrates how I tried to retrieve the attribute title of <a>:
    1. BufferedReader incomingbrXml = new BufferedReader(new FileReader("C:\City.xml"));
    2. SAXBuilder saxBuilder = new SAXBuilder(false);
    3. Document jdomXmlDocument = saxBuilder.build(incomingbrXml);4. String city_content = null;
    5. XPath cityXPath = XPath.newInstance("/ns:html/ns:body/ns:div[@id='content']/ns:table[@class='sresults']/ns:tr/ns:td/ns:a/@title");
    6. java.util.List cityList = cityXPath.selectNodes(jdomXmlDocument);
    7. Iterator city_iterator = cityList.iterator();
    8. while (city_iterator.hasNext()) {
    9.     city_content = ((org.jdom.Attribute)city_iterator.next()).getValue();
    10.   if (city_content.length() != 0) {
    11.       System.out.println("Area Url:" + area_content.toString()); }
    12. } I would like to get the following output:
    Hollywood , CA
    San Jose , CA
    San Francisco , CA
    San Diego , CA
    Instead, the jdomXmlDocument is made up of only the first few lines of City.xml and nothing on the body when debugging in Netbeans and nothing in cityList. I am running this program online so there would not be an issue with entity resolver that took place on line 2.
    I am running JDK 1.6.0_17, Netbeans 6.7, JDOM 1.1, Saxon9.1 on Windows XP platform.
    Any assistance would be appreciated.
    Thanks in advance,
    Jack.

    Hi,
    Correction to line 11 - System.out.println("City title:" + city_content.toString()); instead.
    Thanks,
    Jack

  • How can i extract attributes from XML-file

    Hi!
    I want to extract XML-files.
    And the most tags are no problem,but how can i extract attributes?
    Here is a part from the XML-Schema:
    <xs:complexType name="ATT_LIST">
              <xs:sequence>
                   <xs:element name="ATTRIB" minOccurs="0" maxOccurs="unbounded">
                        <xs:complexType>
                             <xs:sequence>
                                  <xs:element name="VALUE"/>
                             </xs:sequence>
                             <xs:attribute name="ATTNAM" use="required"/>
                        </xs:complexType>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
    Thanks for help.
    With best regards.
    Nicole

    Hi!
    If i delete one '/' i get the error message:
    data can't be found'
    This is my xml-file:
    <?xml version="1.0" encoding="UTF-8"?>
    <INSOBJ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sv6:8080/sys/schemas/SCOTT/sv6:8080/public/mydocs/inspection_pda_schema.xsd">
         <INSP_PDA>
              <SYSID>900000438</SYSID>
              <INSPECTOR/>
              <INSDAT>20001223</INSDAT>
              <INSOBJ_TYP>MSP-Mast</INSOBJ_TYP>
              <INSOBJ_ID1>BAM / Bad Aussee / Bad Mitterndorf/Grundlsee</INSOBJ_ID1>
              <INSOBJ_ID2>MITTERNDORF 2 - M 259</INSOBJ_ID2>
              <INSOBJ_ID3>239</INSOBJ_ID3>
              <INSOBJ_NAME>259</INSOBJ_NAME>
              <PDA_PORTION>0000000391</PDA_PORTION>
              <GESQUALITAET/>
              <AUSFALLSEINSCH/>
              <ANMERKUNGEN/>
              <LAGE_NORD>48,2281993</LAGE_NORD>
              <LAGE_OST>14,2394658</LAGE_OST>
              <HOEHE/>
              <GPS_STATUS/>
              <KOORD_SYSTEM/>
              <KOORD_EINHEIT/>
              <PLZ/>
              <ORT/>
              <STR_ORTSTEIL/>
              <NUMMER/>
              <BEZEICHNUNG/>
              <GRUNDBESITZER/>
              <TELENR/>
              <ERREICHBARKEIT/>
              <ATT_LIST>
                   <ATTRIB ATTNAM="BAUWEISE">
                        <VALUE>E-Mast</VALUE>
                   </ATTRIB>
                   <ATTRIB ATTNAM="HOLZART">
                        <VALUE>KIEFER</VALUE>
                   </ATTRIB>
              </ATT_LIST>
              <MZ_LIST>
                   <MAS_ZU MZ_NAM="AUSHOLZEN">
                        <VALUE>J</VALUE>
                        <BEMERKUNG/>
                        <INSP_AM/>
                        <INSP_VON/>
                        <DONE_AM>N</DONE_AM>
                        <DONE_VOM/>
                        <URSACHE>2</URSACHE>
                        <DRINGLICH>2</DRINGLICH>
                        <ZIEL_DAT/>
                        <MZ_PARAM_LIST/>
                   </MAS_ZU>
                   <MAS_ZU MZ_NAM="ALLGEMEIN-ANMERKUNG">
                        <VALUE>2 Isolatoren</VALUE>
                        <BEMERKUNG/>
                        <INSP_AM/>
                        <INSP_VON/>
                        <DONE_AM/>
                        <DONE_VOM/>
                        <URSACHE>2</URSACHE>
                        <DRINGLICH/>
                        <ZIEL_DAT/>
                        <MZ_PARAM_LIST/>
                   </MAS_ZU>
                   <MAS_ZU MZ_NAM="Stange erdfaul/hohl">
                        <VALUE>J</VALUE>
                        <BEMERKUNG/>
                        <INSP_AM/>
                        <INSP_VON/>
                        <DONE_AM/>
                        <DONE_VOM/>
                        <URSACHE/>
                        <DRINGLICH/>
                        <ZIEL_DAT/>
                        <MZ_PARAM_LIST/>
                   </MAS_ZU>
                   <MAS_ZU MZ_NAM="Masttyp nicht normgerecht">
                        <VALUE>J</VALUE>
                        <BEMERKUNG/>
                        <INSP_AM/>
                        <INSP_VON/>
                        <DONE_AM/>
                        <DONE_VOM/>
                        <URSACHE/>
                        <DRINGLICH/>
                        <ZIEL_DAT/>
                        <MZ_PARAM_LIST/>
                   </MAS_ZU>
              </MZ_LIST>
         </INSP_PDA>
         <INSP_PDA>
              <SYSID>900000437</SYSID>
              <INSPECTOR/>
              <INSDAT>20001223</INSDAT>
              <INSOBJ_TYP>MSP-Mast</INSOBJ_TYP>
              <INSOBJ_ID1>BAM / Bad Aussee / Bad Mitterndorf/Grundlsee</INSOBJ_ID1>
              <INSOBJ_ID2>MITTERNDORF 2 - M 259</INSOBJ_ID2>
              <INSOBJ_ID3>239</INSOBJ_ID3>
              <INSOBJ_NAME>259</INSOBJ_NAME>
              <PDA_PORTION>0000000391</PDA_PORTION>
              <GESQUALITAET/>
              <AUSFALLSEINSCH/>
              <ANMERKUNGEN/>
              <LAGE_NORD>48,2281993</LAGE_NORD>
              <LAGE_OST>14,2394658</LAGE_OST>
              <HOEHE/>
              <GPS_STATUS/>
              <KOORD_SYSTEM/>
              <KOORD_EINHEIT/>
              <PLZ/>
              <ORT/>
              <STR_ORTSTEIL/>
              <NUMMER/>
              <BEZEICHNUNG/>
              <GRUNDBESITZER/>
              <TELENR/>
              <ERREICHBARKEIT/>
              <ATT_LIST>
                   <ATTRIB ATTNAM="BAUWEISE">
                        <VALUE>E-Mast</VALUE>
                   </ATTRIB>
                   <ATTRIB ATTNAM="HOLZART">
                        <VALUE>KIEFER</VALUE>
                   </ATTRIB>
              </ATT_LIST>
              <MZ_LIST>
                   <MAS_ZU MZ_NAM="AUSHOLZEN">
                        <VALUE>J</VALUE>
                        <BEMERKUNG/>
                        <INSP_AM/>
                        <INSP_VON/>
                        <DONE_AM>N</DONE_AM>
                        <DONE_VOM/>
                        <URSACHE>2</URSACHE>
                        <DRINGLICH>2</DRINGLICH>
                        <ZIEL_DAT/>
                        <MZ_PARAM_LIST/>
                   </MAS_ZU>
                   <MAS_ZU MZ_NAM="ALLGEMEIN-ANMERKUNG">
                        <VALUE>2 Isolatoren</VALUE>
                        <BEMERKUNG/>
                        <INSP_AM/>
                        <INSP_VON/>
                        <DONE_AM/>
                        <DONE_VOM/>
                        <URSACHE>2</URSACHE>
                        <DRINGLICH/>
                        <ZIEL_DAT/>
                        <MZ_PARAM_LIST/>
                   </MAS_ZU>
                   <MAS_ZU MZ_NAM="Stange erdfaul/hohl">
                        <VALUE>J</VALUE>
                        <BEMERKUNG/>
                        <INSP_AM/>
                        <INSP_VON/>
                        <DONE_AM/>
                        <DONE_VOM/>
                        <URSACHE/>
                        <DRINGLICH/>
                        <ZIEL_DAT/>
                        <MZ_PARAM_LIST/>
                   </MAS_ZU>
                   <MAS_ZU MZ_NAM="Masttyp nicht normgerecht">
                        <VALUE>J</VALUE>
                        <BEMERKUNG/>
                        <INSP_AM/>
                        <INSP_VON/>
                        <DONE_AM/>
                        <DONE_VOM/>
                        <URSACHE/>
                        <DRINGLICH/>
                        <ZIEL_DAT/>
                        <MZ_PARAM_LIST/>
                   </MAS_ZU>
              </MZ_LIST>
         </INSP_PDA>
    </INSOBJ>
    Thanks for help.
    With best regards
    Nicole

  • How to remove xmlns attribute from XML tag?

    Hello!
    I have a XMLType document:
    --- P R O B L E M # 1 ---
    <?xml version="1.0" encoding="windows-1257" ?>
    <RESPONSE xmlns="http://testserver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://testserver response.xsd">
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>
    I very need to remove from RESPONSE tag all addition information. Result I need is:
    <?xml version="1.0" encoding="windows-1257" ?>
    <RESPONSE>
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>
    What can I do in this situation? My Oracle version is 9.2.
    --- P R O B L E M # 2 ---
    How I can create from source XML this one:
    <?xml version="1.0" encoding="windows-1257" ?>
    <MY_RESPONSE>
    <RESPONSE xmlns="http://testserver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://testserver response.xsd">
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>
    </MY_RESPONSE>
    Thanks for your answers!
    Flu

    Maybe the problem#1 can be solved with a simple pl/sql using REPLACE statement. start with the <RESPONSE and look for the end > and get the entire string and replace that with only <RESPONSE> or maybe you can achieve this using xmldom to delete the attributes as part of the element.
    PRoblem#2 can be solved in this way.
    select xmlelement("MY_RESPONSE",
    xmltype('<RESPONSE xmlns="http://testserver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://testserver response.xsd">
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>')).GetClobVal()
    from dual
    /

  • Querying attributes from XML

    I have Oracle 10g . In a table with just one record there is a a clob with the following xml.
    <container>
    <param name="paramA" value="valueA" />
    <param name="paramB" value="valueB" />
    </container>
    How can I enumerate paramA, paramB from above?

    Your query neglected to show the error message you were getting, which should have been
    select x.paramName, x.paramValue
      from test_xml t
         , xmltable('/container/param'
                    passing xmltype(t.xmlcontent)
                    columns
                    paramName varchar2(30) path '@type'
                  , paramValue varchar2(80) path '@value') x
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00234: namespace prefix "xsi" is not declared
    Error at line 2
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1Taking that, you would ask yourself how to declare the namespace and some searching would eventually turn up that
    1) your sample XML is invalid as it does not have a namespace prefix defined for xsi
    2) You need to use XMLNamespaces within the [url http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions228.htm#SQLRF06232]XMLTable function
    Putting those together and assuming you mean the standard URI for the xsi prefix, your sample XML should look like
    <container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <param xsi:type="paramA" value="valueA"/>
         <param xsi:type="paramB" value="valueB"/>
    </container>and the query would look like
    select x.paramName, x.paramValue
      from test_xml t
         , xmltable(XMLNamespaces('http://www.w3.org/2001/XMLSchema-instance' as "xsi"),
                   '/container/param'
                    passing xmltype(t.xmlcontent)
                    columns
                    paramName varchar2(30) path '@xsi:type'
                  , paramValue varchar2(80) path '@value') x;

  • Extracting attributes from XML document using plsql

    Hello,
    I have successfully written a plsql procedure that has been
    using Xpath to extract the element values from an XML doument:
    i.e.
    l_xpath := '/Form_Data/Person_Details/Initials';
    l_DomNodeList := xslprocessor.SelectNodes(l_RootNode, l_xpath);
    l_DomNode := xmldom.item(l_DomNodeList,0); -- first Element
    l_DomNode := xmldom.getfirstchild(l_DomNode);
    l_id_number := xmldom.getNodeValue(l_DomNode);
    However the data (Initials) I wish to extract is now stored as
    attributes within the Person_Details element and I was wondering
    how I would go about explicitly extracting the attributes values!
    I have not been able to find any examples, although I have been
    pointed in the direction of xmldom.getattribute without any
    success!
    Any help, or code examples greatly appreciated,
    - Mark...

    example:-
    xpath.VALUEOF(i_doc,v_PricingPath||'@LockIndicator');

  • How to insert the data from XML to a table

    Hi,
    I'm using Oracle 10g Express Edition
    I need help in How to insert the data from XML file into the table.
    Below is the example i'm working on..
    I have create ridb user with below mentioned privileges:
    Account Status Locked Unlocked
    Default Tablespace: USERS
    Temporary Tablespace: TEMP
    User Privileges :
    Roles:
    CONNECT
    RESOURCE
    Direct Grant System Privileges:
    CREATE DATABASE LINK
    CREATE MATERIALIZED VIEW
    CREATE PROCEDURE
    CREATE PUBLIC SYNONYM
    CREATE ROLE
    CREATE SEQUENCE
    CREATE SYNONYM
    CREATE TABLE
    CREATE TRIGGER
    CREATE TYPE
    CREATE VIEW
    & table is created TRIALZIPCODES below mentioned is the DDL:
    CREATE TABLE TRIALZIPCODES
    STATE_ABBR VARCHAR2(20) NOT NULL
    , ZIP_CODE NUMBER(10, 0) NOT NULL
    , ZIP_CODE_EXT VARCHAR2(20)
    Below is the XML FILE: which is stored in C:\OracleProject Folder
    File name: trial.xml
    <?xml version="1.0" ?>
    <metadata>
    - <Zipcodes>
    - <mappings Record="4">
    <STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
    <ZIPCODE>94301</ZIPCODE>
    </mappings>
    - <mappings Record="5">
    <STATE_ABBREVIATION>CO</STATE_ABBREVIATION>
    <ZIPCODE>80323</ZIPCODE>
    <ZIP_CODE_EXTN>9277</ZIP_CODE_EXTN>
    </mappings>
    </Zipcodes>
    </metadata>
    PL/SQL Procedure:which i'm trying to execute from SQLDeveloper
    create or replace
    PROCEDURE TRIAL AS
    BEGIN
    DECLARE
    -- declare attributes
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    v_FileHandle UTL_FILE.FILE_TYPE;
    l_context_handle dbms_xmlgen.ctxHandle;
    insCtx DBMS_XMLStore.ctxType;
    begin
    -- DBMS_XMLGEN.setRowTag ( ctx IN ctxHandle, rowTag IN VARCHAR2);
    -- DBMS_XMLGEN.setRowSetTag ( ctx IN ctxHandle, rowSetTag IN VARCHAR2);
    -- the name of the table as specified in our DTD
    DBMS_XMLGEN.SETROWSETTAG(l_context_handle,'zipcodes');
    -- the name of the data set as specified in our DTD
    DBMS_xmlgen.setRowTag(l_context_handle,'mappings');
    -- for getting the output on the screen
    dbms_output.enable(1000000);
    -- open the XML document in read only mode
    v_FileHandle := utl_file.fopen('c:/OracleProject','trial.xml', 'r');
    loop
    BEGIN
    utl_file.get_line(v_FileHandle, charString);
    exception
    when no_data_found then
    utl_file.fclose(v_FileHandle);
    exit;
    END;
    dbms_output.put_line(charString);
    if finalStr is not null then
    finalStr := finalStr || charString;
    else
    finalStr := charString;
    end if;
    end loop;
    -- for inserting the XML data into the table
    insCtx := DBMS_XMLSTORE.NEWCONTEXT('RIDB.TRIALZIPCODES');
    insCtx := DBMS_XMLSTORE.INSERTXML(insCtx, finalStr);
    dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
    DBMS_XMLStore.closeContext(insCtx);
    END;
    END TRIAL;
    For the first time when i complied i got the errors as :
    Procedure RIDB.PROCEDURE1@RIDB
    Error(16,14): PLS-00201: identifier 'UTL_FILE' must be declared
    Error(16,14): PL/SQL: Item ignored
    Error(29,1): PLS-00320: the declaration of the type of this expression is incomplete or malformed
    Error(29,1): PL/SQL: Statement ignored
    Error(33,1): PL/SQL: Statement ignored
    Error(33,19): PLS-00320: the declaration of the type of this expression is incomplete or malformed
    Error(36,1): PL/SQL: Statement ignored
    Error(36,17): PLS-00320: the declaration of the type of this expression is incomplete or malformed
    So i logged in as sys & grant the permission to execute on UTL_FILE to ridb (user):
    SQL Statement:
    grant execute on utl_file to ridb
    So, it got compiled successfully but when i execute it gives me error as:
    Source does not have a runnable target.
    What does this mean?
    So I browse through forum & i got to know that i need to initial the UTL_FILE_DIR ="C:/OracleProject" in init.ora
    So can i edit the init.ora with notepad.When i tried to do that it says permission denied
    In my system it shows the init.ora file in path C:\oraclexe\app\oracle\product\10.2.0\server\config\scripts
    but there is also other file initXETemp in the same path do i need to do the changes in it.
    I have tried even editing the SPFILE as mentioned below:
    C:\oraclexe\app\oracle\product\10.2.0\server\dbs\SPFILEEXE - I had edit this file using notepad & set the value of UTL_FILE_DIR ="C:/OracleProject". So next time when i restarted i'm unable to log on to the database.
    So i had reinstall the software again.
    Could you please let me know how to proceed..

    hi,
    I have created the directory from sys database
    CREATE or replace DIRECTORY XML_DIR2 AS 'C:\OracleProject';
    & grant read,write access to the user
    grant read,write on directory XML_DIR2 to RIDB;
    & i had change the tag name in the xml file as shown below:
    <?xml version = '1.0'?>
    <metadata>
    <Zipcodes>
    <mappings Record="4">
    <STABBRE>CA</STABBRE>
    <ZIPCODE>94301</ZIPCODE>
    </mappings>
    <mappings Record="5">
    <STABBRE>CO</STABBRE>
    <ZIPCODE>80323</ZIPCODE>
    <ZIPCODEEXT>9277</ZIPCODEEXT>
    </mappings>
    </Zipcodes>
    </metadata>
    TRIALZIPCODE table as shown below:
    CREATE TABLE "RIDB"."TRIALZIPCODE"
    (     "STABBRE" VARCHAR2(20 BYTE),
         "ZIPCODE" NUMBER(*,6) NOT NULL ENABLE,
         "ZIPCODEEXT" NUMBER
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ;
    I have tried two methods as shown below:
    Procedure 1:
    create or replace
    PROCEDURE TRIAL_V2 AS
    BEGIN
    DECLARE
    -- declare attributes
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    v_FileHandle UTL_FILE.FILE_TYPE;
    l_context_handle dbms_xmlgen.ctxHandle;
    insCtx DBMS_XMLStore.ctxType;
    cnt NUMBER;
    xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
    --XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
    BEGIN
    insCtx := DBMS_XMLStore.newContext('DEV.TRIALZIPCODES');
    DBMS_XMLStore.setUpdateColumn(insCtx, 'STABBRE');
    DBMS_XMLStore.setUpdateColumn(insCtx, 'ZIPCODE');
    DBMS_XMLStore.setUpdatecolumn(insCtx, 'ZIPCODEEXT');
    DBMS_XMLStore.setRowTag(insCtx, 'mappings');
    cnt := DBMS_XMLStore.insertXML(insCtx, xmldoc);
    DBMS_XMLStore.closeContext(insCtx);
    END;
    Procedure 1 was compiled with out errors but when i execute i got the error as :
    Source does not have a runnable target.
    Procedure 2_
    CREATE OR REPLACE PROCEDURE TRIAL_V3 AS
    BEGIN
    DECLARE
    -- declare attributes
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    v_FileHandle UTL_FILE.FILE_TYPE;
    l_context_handle dbms_xmlgen.ctxHandle;
    insCtx DBMS_XMLStore.ctxType;
    cnt NUMBER;
    xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
    --XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
    BEGIN
    INSERT INTO trialzipcode (STABBRE, ZIPCODE, ZIPCODEEXT)
    SELECT extractvalue(x.column_value, 'mappings/STABBRE'),
    extractvalue(x.column_value, 'mappings/ZIPCODE'),
    extractvalue(x.column_value, 'mappings/ZIPCODEEXT')
    FROM TABLE(
    XMLSequence(
    EXTRACT(
    xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') ),
    'metadata/Zipcodes/mappings'
    ) x
    END;
    END TRIAL_V3;
    Procedure 2 was complied without errors but when i execute i got the error as:
    Connecting to the database RIDB.
    ORA-22288: file or LOB operation FILEOPEN failed
    The system cannot find the file specified.
    ORA-06512: at "SYS.DBMS_LOB", line 523
    ORA-06512: at "SYS.XMLTYPE", line 287
    ORA-06512: at "RIDB.TRIAL_V3", line 12
    ORA-06512: at line 2
    Process exited.
    Disconnecting from the database RIDB.
    Could you please let me know how to proceed...

  • How to parse this kind of XML documents and store in a relational tables

    Can u guys help me out ,..how to parse these kind of XML documents..like under PR there Sr,CreationDate and DoBID.. Again under Sr...there are LD, CID,TID, RID and so on.....
    so how to parse this kind of data..how to create the structure of the table....pls help me out..
    <nk8:PR>
              <nk8:Sr>
                   <nk8:LD>---------</nk8:LID>
                   <nk8:CID>---------</nk8:CID>
                   <nk8:TID>---------</nk8:TID>
                   <nk8:RID>---------</nk8:RID>
                   <nk8:CC>OnError</nk8:CC>
                   <nk8:AID>---------</nk8:AID>
              </nk8:Sr>
              <nk8:CreationDateTime>2002-07-01</nk8:CreationDateTime>
              <nk8:DOBID>---------</nk8:DOBID>
         </nk8:PR>
         <ssm:ER>
              <ssm:PN>---------</ssm:PN>
              <ssm:SN>---------</ssm:SN>
              <ssm:SCt>---------</ssm:SC>
              <ssm:IA>
                   <ssm:NT>---------</ssm:NT>
                   <nk8:LID>---------</nk8:LID>
                   <nk8:CID>---------</nk8:CID>
                   <ssm:AN>---------</ssm:AN>
              </ssm:A>
         </ssm:ER>
         </nk8:PR>

    First, your XML document is not well formatted. Once you're done with that you can extract the values and store it in a table column.
    sql> WITH xml_table AS
      2  (SELECT XMLTYPE(
      3  '
      4  <nk8:PR xmlns:nk8="http://www.w3.org">
      5  <nk8:Sr>
      6  <nk8:LID>LID Value</nk8:LID>
      7  <nk8:CID>CID Value</nk8:CID>
      8  <nk8:TID>TID Value</nk8:TID>
      9  <nk8:RID>RID Value</nk8:RID>
    10  <nk8:CC>OnError</nk8:CC>
    11  <nk8:AID>---------</nk8:AID>
    12  </nk8:Sr>
    13  </nk8:PR>') XMLCOL FROM DUAL)
    14  SELECT extractvalue(t.column_value,'//nk8:LID','xmlns:nk8="http://www.w3.org"') "LID",
    15   extractvalue(t.column_value,'//nk8:CID','xmlns:nk8="http://www.w3.org"') "CID",
    16   extractvalue(t.column_value,'//nk8:RID','xmlns:nk8="http://www.w3.org"') "RID",
    17  extractvalue(t.column_value,'//nk8:CC','xmlns:nk8="http://www.w3.org"') "CC"
    18  FROM xml_table, table(xmlsequence(extract(xmlcol,'/nk8:PR/nk8:Sr','xmlns:nk8="http://www.w3.org"'))) t;
    LID        CID        RID        CC
    LID Value  CID Value  RID Value  OnError

  • How to get string value from xml in JSF??

    In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF

    Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
    JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization.

  • How to copy a folder from one document library to another document library ?

    How to copy a folder from one document library to another document library by programmtically?
    Samarendra Swain
    Team Sharepoint
    www.manuhsolutions.com

    You can use the SPFolder.CopyTo method.
    public static void CopyFolder()
    SPFolder folder = null;
    using (SPSite site = new SPSite("http://basesmcdev2/sites/tester1"))
    using (SPWeb web = site.OpenWeb())
    folder = web.GetFolder("shared%20documents/newfolder");
    folder.CopyTo("tester4/newfolder");
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.copyto.aspx
    certdev.com

  • How to create Inbound Idoc from XML file-Need help urgently

    Hi,
    can any one tell how to create inbound Idoc from XML file.
    we have xml file in application server Ex. /usr/INT/SMS/PAYTEXT.xml'  we want to generate inbound idoc from this file.we are successfully able to generate outbound XML file from outbound Idoc by using the XML port. But not able to generate idoc from XML file by using we19 or we16.
    Please let me know the process to trigger inbound Idoc with out using  XI and any other components.
    Thanks in advance
    Dora Reddy

    Hi .. Did either of you get a result on this?
    My question is the same really .. I am testing with WE19 and it seems SAP cannot accept an XML inbound file as standard.
    I see lots of mention of using a Function Module.
    Am I correct in saying therefore that ABAP development is required to create a program to run the FM and process the idoc?
    Or is there something tht can be done with Standard SAP?
    Thanks
    Lee

  • How to get attribute from xml file

    I managed to grab all the info from xml, except the "url" attribute in <image type="poster" url="" size="mid" .../>. Any ideas?
    import java.io.*;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import java.net.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class XmlParser {
         ArrayList<Movie> myMovies;
         Document dom;
         public XmlParser(){
              //create a list to hold the movie objects
              myMovies = new ArrayList<Movie>();
         public void runExample(String adr, String tagName) {
              parseXmlFile(adr);
              parseDocument(tagName);
              printData();          
         private void parseXmlFile(String adr){
              //get the factory
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              try {               
                   //Using factory get an instance of document builder
                   DocumentBuilder db = dbf.newDocumentBuilder();
                   //parse using builder to get DOM representation of the XML file
                   URL xmlUrl = new URL(adr);
                   InputStream in = xmlUrl.openStream();
                   dom = db.parse(in);               
              }catch(ParserConfigurationException pce) {
                   pce.printStackTrace();
              }catch(SAXException se) {
                   se.printStackTrace();
              }catch(IOException ioe) {
                   ioe.printStackTrace();
         private void parseDocument(String tagName){
              //get the root elememt
              Element docEle = dom.getDocumentElement();
              //get a nodelist of <movie> elements
              NodeList nl = docEle.getElementsByTagName(tagName);
              if(nl != null && nl.getLength() > 0) {
                   for(int i = 0 ; i < nl.getLength();i++) {
                        //get the movie element
                        Element el = (Element)nl.item(i);
                        //get the Movie object
                        Movie mov = getMovie(el);
                        //add it to list
                        myMovies.add(mov);
          * I take an movie element and read the values in, create
          * an Movie object and return it
          * @param movE
          * @return
         private Movie getMovie(Element movE) {
              String title = getTextValue(movE, "original_name");
              String year = getTextValue(movE, "released");
              String imdbId = getTextValue(movE, "imdb_id");
              double score = getDoubleValue(movE, "score");
              String overview = getTextValue(movE, "overview");
              String poster = movE.getAttribute("url");
              Movie mov = new Movie(title, year, imdbId, score, overview, poster);
              return mov;
         private String getTextValue(Element ele, String tagName) {
              String textVal = null;
              NodeList nl = ele.getElementsByTagName(tagName);
              if(nl != null && nl.getLength() > 0) {
                   Element el = (Element)nl.item(0);
                   textVal = el.getFirstChild().getNodeValue();
              return textVal;
          * Calls getTextValue and returns a int value
          * @param ele
          * @param tagName
          * @return int
         private int getIntValue(Element ele, String tagName) {
              //in production application you would catch the exception
              return Integer.parseInt(getTextValue(ele, tagName));
          * Calls getTextValue and returns a double value
          * @param ele
          * @param tagName
          * @return double
         private double getDoubleValue(Element ele, String tagName) {
              return Double.parseDouble(getTextValue(ele, tagName));
          * Iterate through the list and print the
          * content to console
         private void printData(){
              System.out.println("Total Movies: " + myMovies.size());
              Iterator it = myMovies.iterator();
              while(it.hasNext()) {
                   System.out.println(it.next().toString());
         public static void main(String[] args){
              //create an instance
              XmlParser xp = new XmlParser();
              //call run example
              xp.runExample("http://api.themoviedb.org/2.1/Movie.search/en/xml/apikey/Fight+Club+1999", "movie");
    }Here is the example xml file I used
    <?xml version="1.0" encoding="UTF-8"?>
    <OpenSearchDescription xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
      <opensearch:Query searchTerms="Fight Club 1999"/>
      <opensearch:totalResults>1</opensearch:totalResults>
      <movies>
        <movie>
          <score>8.383284</score>
          <popularity>3</popularity>
          <translated>true</translated>
          <adult>false</adult>
          <language>en</language>
          <original_name>Fight Club</original_name>
          <name>Fight Club</name>
          <alternative_name>El Club de la Lucha</alternative_name>
          <type>movie</type>
          <id>550</id>
          <imdb_id>tt0137523</imdb_id>
          <url>http://www.themoviedb.org/movie/550</url>
          <votes>62</votes>
          <rating>8.4</rating>
          <certification></certification>
          <overview>A lonely, isolated thirty-something young professional seeks an escape from his mundane existence with the help of a devious soap salesman. They find their release from the prison of reality through underground fight clubs, where men can be what the world now denies them. Their boxing matches and harmless pranks soon lead to an out-of-control spiral towards oblivion.</overview>
          <released>1999-09-16</released>
          <images>
            <image type="poster" url="http://hwcdn.themoviedb.org/posters/f75/4bc908ab017a3c57fe002f75/fight-club-original.jpg" size="original" width="1000" height="1500" id="4bc908ab017a3c57fe002f75"/>
            <image type="poster" url="http://hwcdn.themoviedb.org/posters/f75/4bc908ab017a3c57fe002f75/fight-club-mid.jpg" size="mid" width="500" height="750" id="4bc908ab017a3c57fe002f75"/>
            <image type="poster" url="http://hwcdn.themoviedb.org/posters/f75/4bc908ab017a3c57fe002f75/fight-club-cover.jpg" size="cover" width="185" height="278" id="4bc908ab017a3c57fe002f75"/>
            <image type="poster" url="http://hwcdn.themoviedb.org/posters/f75/4bc908ab017a3c57fe002f75/fight-club-thumb.jpg" size="thumb" width="92" height="138" id="4bc908ab017a3c57fe002f75"/>
            <image type="backdrop" url="http://hwcdn.themoviedb.org/backdrops/f71/4bc908ab017a3c57fe002f71/fight-club-original.jpg" size="original" width="1280" height="720" id="4bc908ab017a3c57fe002f71"/>
            <image type="backdrop" url="http://hwcdn.themoviedb.org/backdrops/f71/4bc908ab017a3c57fe002f71/fight-club-poster.jpg" size="poster" width="780" height="439" id="4bc908ab017a3c57fe002f71"/>
            <image type="backdrop" url="http://hwcdn.themoviedb.org/backdrops/f71/4bc908ab017a3c57fe002f71/fight-club-thumb.jpg" size="thumb" width="300" height="169" id="4bc908ab017a3c57fe002f71"/>
          </images>
          <version>73</version>
          <last_modified_at>2010-09-11 14:33:06</last_modified_at>
        </movie>
      </movies>
    </OpenSearchDescription>

    pvujic wrote:
    Thanks, but how can I "fetch" the url from the image element?You've got to first get to the image element. But based on what you've posted though, with a little more coding, you should be able to succeed. Just give it a try! :)

  • How to remove an Element from XML by confirming Attribute of that element

    Hi guys
    I have an XML file where i have all users DB. Now i want to remove a user from that XML file. I want to check an user id attribute which is uniqe with existing users in XML file, if its the same user then delete this user from XML file and save the changes in XML file.
    here is my XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <users>
    <user id="zahid" password="X8UrUN79avT27LYwUESiliAV328=" name="Zahid Nawaz" phone="9599808" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
    <user id="Admin" name="alpha beta" password="fEqNCco3Yq9h5ZUglD3CZJT4lBs=" phone="456782656" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
    <user id="Guest" name="beta alpha" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="8765432" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" /><user id="Guest1" name="unknown unknown" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="123122112" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" />
    </users>for example i want to delete a user which have user id= Guest.
    How can i do it in Java. Any code example please. i am using JDOM document and SAXBuilder for parsing.
    Waiting for your replay.
    Thanks in Advance
    Best regard

    Hi,
    Till now i tried the following code which give null pointer exception at following line
    element.getParentNode().removeChild(element);
         public String removeUserByID(String id) throws Exception{
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                 DocumentBuilder builder = factory.newDocumentBuilder();
                 TransformerFactory tFactory = TransformerFactory.newInstance();
                 Transformer tFormer = tFactory.newTransformer();
                   doc = builder.parse(usersXml);
                 Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);
    //             Remove the node
                 element.getParentNode().removeChild(element);
    //             Normalize the DOM tree to combine all adjacent nodes
                 doc.normalize();
                 FileOutputStream fos = new FileOutputStream(this.usersXml);
                   XMLOutputter out = new XMLOutputter();
                   out.output(((org.jdom.Document)doc), fos);
              /*     Source source = new DOMSource(doc);
                 Result dest = new StreamResult(System.out);
                 tFormer.transform(source, dest);
                 System.out.println();
                 return "true";
              if following line i m trying to use first attribute of my XML file where i am passing a string which is for example like "user id=Guest". id is a string which have user Id "Guest".
    Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);So any suggestion??Whats wrong here?
    Best regards and thanks again 4 ur reply.

Maybe you are looking for