How to Query XML Xpath?

Hi!
I am new XML as datasource.
I am using XML in iReport.
Below is my XML Datasource.
<?xml version="1.0" encoding="UTF-8"?>
<MyReport>
     <EvalData>
          <Quarter>
               <no>Q3'06</no>
               <EvalValue>2.4</EvalValue>
          </Quarter>
          <Quarter>
               <no>Q4'06</no>
               <EvalValue>3.6</EvalValue>
          </Quarter>
          <Quarter>
               <no>Q1'07</no>
               <EvalValue>3.7</EvalValue>
          </Quarter>
     </EvalData>
     <QHighLight>
          <Header hdrText="Created IC Calculates and rolled out to field">
               <subHeader>We are posting personalized IC Calculators every month.</subHeader>
          </Header>
          <Header hdrTest="Cteated SA(Sales Analysis) Reports and rolled out to field managers">
               <subHeader>We are posting SA Reports every month.</subHeader>     
          </Header>
          <Header hdrTest="Created Personalized web homepages with all current and revelant IC documents">
               <subHeader>Created personalized Viewer homepages where the reps get links.</subHeader>
          </Header>
          <Header hrdtest="Reduced the proceeeing time for monthly processing">
               <subHeader>Completing the non-payout month processing in just one week.</subHeader>
          </Header>
     </QHighLight>
     <OutlookNQ>
          <Header>1-Create new IC Calculator Summary report and deliver the same in non payout month</Header>
          <Header>2-Deliver Budget Management and Plan Effectiveness Reports concurrent with the Payroll report.</Header>
     </OutlookNQ>
     <SynygyCI>
          <Name>Schering-Plough</Name>
          <Title>Healthcare Products</Title>
          <Phone_Number>610-494-3300x2129</Phone_Number>
          <Email_Add>[email protected]</Email_Add>
          <Name>Divid Grossberg</Name>
          <Title>Managing Consultant</Title>
          <Phone_Number>610-494-3300x(7045)</Phone_Number>
          <Email_Add>[email protected]</Email_Add>
          <Name>Peter Lamb</Name>
          <Title>Managing Direntor</Title>
          <Phone_Number>610-494-3300x(7656)</Phone_Number>
          <Email_Add>[email protected]</Email_Add>
     </SynygyCI>
     <ccur>
          <quarter no="1">
               <Credit>210 </Credit>
               <TC>180</TC>
          </quarter>
          <quarter no="2">
               <Credit>190 </Credit>
               <TC>160</TC>
          </quarter>
          <quarter no="3">
               <Credit>175 </Credit>
               <TC>155</TC>
          </quarter>
     </ccur>
</MyReport>The problem is that i just get the first value of the node.
And not all value.
So the Report I am tying to create is always has only one value.
This is query string I am using " //MyReport/* ".
Thanks for your help in advance.

It sounds to me as if you have some code somewhere that has the problem you described. Since I can't see any of that code, all I can advise is that you look at it and fix it.
Or you could post it here. That might have been more useful than all that XML.

Similar Messages

  • How to use XML / XPath in JAVA (in 1.4) which third part component to use?

    How to use XML / XPath in JAVA (in 1.4)
    I'm absolutely novice in XML
    but I need to query XML using XPath
    As I understand XPath become avalible only in Java 1.5
    But I use 1.4 (project requirement)
    Which third part component could you recomend?

    Can anyone help me with this XPath query
    I get result [title: null]
    import java.io.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.w3c.dom.*;
    import org.jaxen.*;
    import org.jaxen.dom.*;
    import org.jaxen.saxpath.*;
    import java.util.*;
    public class TestX {
         public void ggg() {
              try {
                   File f = new File("journal.xml");
                   DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                   org.w3c.dom.Document doc = docBuilder.parse(f);
                   XPath xpath = new DOMXPath( "/journal/article/title" );
                   List result = (List) xpath.evaluate(doc);
                   System.out.println(result.get(0));
              } catch (Exception e) {
                       e.printStackTrace();
         public static void main(String[] args) {
              TestX tx = new TestX();
              tx.ggg();
    }journal.xml
    <journal>
        <article id="article.1">
            <title>Art1</title>
            <author>
               <first>Bob</first>
               <last>McWhirter</last>
            </author>
            <text>
            </text>
        </article>
        <article id="article.2">
            <title>Art2</title>
            <author>
               <first>James</first>
               <last>Strachan</last>
            </author>
            <text>
            </text>
        </article>
    </journal>

  • How to query XML data stored in a CLOB column

    I don't know XMLDB, so I have a dumb question about querying XML data which is saved as CLOB in a table.
    I have a table (OLAP_AW_PRC), with a CLOB column - AW_XML_TMPL_VAL
    This column contains this xml data - [click here|http://www.nasar.net/aw.xml]
    Now I want to query the data using the xml tags - like returning the name of AW. This is where I am having trouble, how to query the data from AW_XML_TMPL_VAL clob column.
    The following query generates error:
    ORA-31011: XML parsing failed.
    ORA-19202: Error occurred in XML processing
    LPX-00229: input source is empty
    SELECT
    extractValue(value(x), '/AW/LongName') as "AWNAME"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/Name') = 'OMCR4'
    - Nasar

    Mark,
    Thanks. This is exactly what I was looking for.
    After doing @Name in both places (SELECT and WHERE clause) it worked.
    Now I have one more question.
    There are multiple DIMENSION tags in my xml, and I want to see the NAME attribute values for all of those DIMENSIONs. The following query returns
    ORA-19025: EXTRACTVALUE returns value of only one node.
    Cause: Given XPath points to more than one node.
    Action: Rewrite the query so that exactly one node is returned.
    SELECT
    extractValue(value(x), '/AW/@Name') as "AW",
    extractValue(value(x), '/AW/Dimension/@Name') as "DIMENSIONS"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/@Name') = 'OMCR4'

  • How to query XML file RDL SSRS Report to find column titles?

    I have list of SSRS reports  theirRDL file. How can we query the file to find like text book name as below(  <Textbox Name="bippie_passed_qa_photostamps_orders_amount">). Catlog t able in report server does not provide column title
    but i am trying to find column title through RDL file. How can we query in SQL server 2012 version too? I am new in XML please help is appreciated.
      </Textbox>
                      </CellContents>
                    </TablixCell>
                    <TablixCell>
                      <CellContents>
                        <Textbox Name="bippie_passed_qa_photostamps_orders_amount">
                          <CanGrow>true</CanGrow>
                          <KeepTogether>true</KeepTogether>
                          <Paragraphs>
                            <Paragraph>
                              <TextRuns>
                                <TextRun>
                                  <Value>=Fields!bippie_passed_qa_photostamps_orders_amount.Value</Value>
                                  <Style>
                                    <FontSize>8pt</FontSize>
                                    <Format>'$'#,0.00;('$'#,0.00);''</Format>
                                  </Style>
                                </TextRun>
                              </TextRuns>
                              <Style>
                                <TextAlign>Right</TextAlign>

    You will first need to get your report XML from the dbo.Catalog table but something like this should work:
    -- !!TODO get your report XML from the dbo.Catalog table
    DECLARE @ssrsXML TABLE ( yourXML XML )
    INSERT INTO @ssrsXML
    SELECT '<TablixCell>
    <CellContents>
    <Textbox Name="bippie_passed_qa_photostamps_orders_amount">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=Fields!bippie_passed_qa_photostamps_orders_amount.Value</Value>
    <Style>
    <FontSize>8pt</FontSize>
    <Format>''$''#,0.00;(''$''#,0.00);''''</Format>
    </Style>
    </TextRun>
    </TextRuns>
    <Style>
    <TextAlign>Right</TextAlign>
    </Style>
    </Paragraph>
    </Paragraphs>
    </Textbox>
    </CellContents>
    </TablixCell>'
    SELECT t.*, c.c.value('@Name', 'VARCHAR(100)' ) nameProperty
    FROM @ssrsXML t
    CROSS APPLY yourXML.nodes('//TablixCell/CellContents/Textbox' ) c(c)

  • How to query xml data

    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    XML INPUT
    <TXLife>
    <TXLifeRequest>
    <TransRefGUID>10bc80e7d60e59b0:a134d0:10d7c4674ad:-7ffc</TransRefGUID>
    <TransType tc="1203">OLI_TRANS_TRNHLD</TransType>
    <TransExeDate>2008-10-21</TransExeDate>
    <TransExeTime>12:00:00</TransExeTime>
    <InquiryLevel tc="3">OLI_INQUIRY_OBJRELOBJ</InquiryLevel>
    <InquiryView>
    <InquiryViewCode>UpdatePolicy-CHBM-1203A</InquiryViewCode>
    </InquiryView>
    <OLifE>
    <Activity id="Activity1" HoldingID="Holding_2">
    <UserCode>User123</UserCode>
    <Opened>2011-02-27</Opened>
    <ActivityCode>CHBM10002</ActivityCode>
    <OLifEExtension VendorCode="0098" ExtensionCode="Activity">
    <ActivityExtension>
    <SubActivityCode>CHBM20001</SubActivityCode>
    <OpenedTime>15:06:35</OpenedTime>
    </ActivityExtension>
    </OLifEExtension>
    </Activity>
    <Holding id="Holding_1">
    <HoldingTypeCode tc="2">Policy</HoldingTypeCode>
    <Policy>
    <PolNumber>308221234</PolNumber>
    <LineOfBusiness tc="1">OLI_LINEBUS_LIFE</LineOfBusiness>
    <ProductType tc="1009800001">Athena UL</ProductType>
    <CarrierCode>EQC</CarrierCode>
    <PolicyStatus tc="1">OLI_POLSTAT_ACTIVE</PolicyStatus>
    <Life>
    <FaceAmt>150000</FaceAmt>
    <Coverage>
    <ModalPremAmt>500</ModalPremAmt>
    <CovOption>
    <UnderwritingClass tc="1009800001">Preferred Elite</UnderwritingClass>
    </CovOption>
    </Coverage>
    <LifeUSA>
    <OLifEExtension VendorCode="0098">
    <LifeUSAExtension>
    <Exchange1035Ind tc="1">True</Exchange1035Ind>
    </LifeUSAExtension>
    </OLifEExtension>
    </LifeUSA>
    </Life>
    <OLifEExtension VendorCode="0098">
    <PolicyExtension>
    <NYReg60Ind tc="1">True</NYReg60Ind>
    </PolicyExtension>
    </OLifEExtension>
    </Policy>
    <Arrangement>
    <ProductCode>OPT_PREM_FUND_METH</ProductCode>
    <ArrType tc="1009800001">Split Dollar – Economic Benefit</ArrType>
    <ArrSource>
    <TransferAmtType tc="2">Amount</TransferAmtType>
    <TransferAmt>2000</TransferAmt>
    </ArrSource>
    <OLifEExtension VendorCode="0098">
    <ArrangementExtension>
    <ArrSubType tc="1009800001">No Tax Bonus</ArrSubType>
    </ArrangementExtension>
    </OLifEExtension>
    </Arrangement>
    </Holding>
    <Holding id="Holding_2">
    <HoldingTypeCode tc="6">Group Master</HoldingTypeCode>
    <Policy>
    <CarrierAdminSystem>CHBM</CarrierAdminSystem>
    <PolNumber>CHB00012345</PolNumber>
    </Policy>
    </Holding>
    <Holding id="Holding_3">
    <HoldingTypeCode tc="2">Policy</HoldingTypeCode>
    <Policy>
    <PolNumber>308221235</PolNumber>
    <LineOfBusiness tc="1">OLI_LINEBUS_LIFE</LineOfBusiness>
    <ProductType tc="1009800001">Athena UL</ProductType>
    <CarrierCode>EQC</CarrierCode>
    <PolicyStatus tc="1">OLI_POLSTAT_ACTIVE</PolicyStatus>
    <Life>
    <FaceAmt>150000</FaceAmt>
    <Coverage>
    <ModalPremAmt>500</ModalPremAmt>
    <CovOption>
    <UnderwritingClass tc="1009800001">Preferred Elite</UnderwritingClass>
    </CovOption>
    </Coverage>
    <LifeUSA>
    <OLifEExtension VendorCode="0098">
    <LifeUSAExtension>
    <Exchange1035Ind tc="1">True</Exchange1035Ind>
    </LifeUSAExtension>
    </OLifEExtension>
    </LifeUSA>
    </Life>
    <OLifEExtension VendorCode="0098">
    <PolicyExtension>
    <NYReg60Ind tc="1">True</NYReg60Ind>
    </PolicyExtension>
    </OLifEExtension>
    </Policy>
    <Arrangement>
    <ProductCode>OPT_PREM_FUND_METH</ProductCode>
    <ArrType tc="1009800001">Split Dollar – Economic Benefit</ArrType>
    <ArrSource>
    <TransferAmtType tc="2">Amount</TransferAmtType>
    <TransferAmt>2000</TransferAmt>
    </ArrSource>
    <OLifEExtension VendorCode="0098">
    <ArrangementExtension>
    <ArrSubType tc="1009800001">No Tax Bonus</ArrSubType>
    </ArrangementExtension>
    </OLifEExtension>
    </Arrangement>
    </Holding>
    <Party id="Client_1">
    <PartyTypeCode tc="1">Person</PartyTypeCode>
    <Person>
    <FirstName>John</FirstName>
    <LastName>Doe</LastName>
    <Gender tc="1">Male</Gender>
    <BirthDate>1960-10-25</BirthDate>
    </Person>
    <Address>
    <AddressTypeCode tc="15">Work Location</AddressTypeCode>
    <Zip>07310</Zip>
    </Address>
    <Risk>
    <TobaccoInd tc="0">False</TobaccoInd>
    </Risk>
    <Employment>
    <EmployeeID>12345678</EmployeeID>
    <Title>Vice President</Title>
    </Employment>
    </Party>
    <Party id="Client_2">
    <PartyTypeCode tc="1">Person</PartyTypeCode>
    <Person>
    <FirstName>Jane</FirstName>
    <LastName>Doe</LastName>
    <Gender tc="2">Female</Gender>
    <BirthDate>1970-10-30</BirthDate>
    </Person>
    <Address>
    <AddressTypeCode tc="15">Work Location</AddressTypeCode>
    <Zip>07310</Zip>
    </Address>
    <Risk>
    <TobaccoInd tc="0">False</TobaccoInd>
    </Risk>
    <Employment>
    <EmployeeID>98765432</EmployeeID>
    <Title />
    </Employment>
    </Party>
    <Relation OriginatingObjectID="Holding_1" RelatedObjectID="Client_1" id="Relation_1">
    <RelationRoleCode tc="32">Insured</RelationRoleCode>
    <InterestPercent>50</InterestPercent>
    </Relation>
    <Relation OriginatingObjectID="Holding_3" RelatedObjectID="Client_2" id="Relation_2">
    <RelationRoleCode tc="32">Insured</RelationRoleCode>
    </Relation>
    <Relation OriginatingObjectID="Holding_2" id="Relation3" RelatedObjectID="Holding_1">
    <RelationRoleCode tc="50">Package Component</RelationRoleCode>
    </Relation>
    <Relation OriginatingObjectID="Holding_2" id="Relation4" RelatedObjectID="Holding_3">
    <RelationRoleCode tc="50">Package Component</RelationRoleCode>
    </Relation>
    </OLifE>
    </TXLifeRequest>
    </TXLife>
    My Requirement output should be like this
    PolNumber FirstName LastName
    308221234 John Doe
    308221235 Jane DOE
    Please help me on this anyone
    i Writtened query like this
    SELECT DISTINCT t1.firstname fnname,
    t1.LastName lstname,
    t2.polno
    FROM
    ( SELECT xData doc FROM dual
    ) temp_table,
    XMLTable (
    '/TXLife/TXLifeRequest/OLifE' passing doc
    columns
    person xmltype path '//Party[@id=/OLifE/Relation[RelationRoleCode/@tc=32]/@RelatedObjectID]',
    holding xmltype path '//Holding [@id=/OLifE/Relation[RelationRoleCode/@tc=50]/@RelatedObjectID][HoldingTypeCode/@tc=2]'
    ) t,
    XMLTable (
    '/Party' passing t.person
    columns
    firstname VARCHAR2(200) path 'Person/FirstName',
    LastName VARCHAR2(200) path 'Person/LastName'
    )t1,
    XMLTable(
    '/Holding' passing t.holding
    columns
    polno VARCHAR2(20) path 'Policy/PolNumber'
    )t2
    IN query Xdata is above XML INPUT
    The output is writting like this but in output i am typing few columns only
    PolNumber FirstName LastName
    308221234 John Doe
    308221235 John Doe
    308221235 Jane DOE
    308221234 Jane DOE
    Edited by: LRAJESH on Apr 29, 2011 4:53 AM
    Edited by: LRAJESH on Apr 29, 2011 5:26 AM
    Edited by: LRAJESH on Apr 29, 2011 5:28 AM
    Edited by: LRAJESH on Apr 29, 2011 5:30 AM
    Edited by: LRAJESH on Apr 29, 2011 5:31 AM
    Edited by: LRAJESH on Apr 29, 2011 5:33 AM

    Hi Odie,
    First of all sorry for the delayed replay and thank you very much for the solution provided by you, using which I am able to retrieve the required output after doing small changes. As mentioned earlier this functionality we are using in reading XML file which we receive as CLOB input parameter to procedure. This XML file will contain 50 multiple records which need to be read inside the procedure, using the logic provided by you. To read these 50 records it is taking 2 seconds of time.
    Now we got requirement to read up to 1500 records which will be supplied by CLOB field as input parameter to the procedure.
    But we are facing really a big challenge over here. Initially in testing phase we are trying to read just 100 records for which the time taking from point 1 to point 2(Mentioned below, that is going in to the loop) is around 60 sec. As you know this is not acceptable. So can you please help me to reduce this time frame?
    Do Let me know if you have any questions.
    POINT 1
    For I IN( select /*+ no_xml_query_rewrite */
    x.firstname fnname,
    x.LastName lstname,
    x.BirthDate birthdate,
    x.Gender gender,
    x.usercode usercode,
    x.opened opened,
    x.time time,
    x.TobaccoInd TobaccoInd,
    x.Employmeeid Employmeeid,
    x.Title Title,
    x.zip zip,
    x.riskclass riskclass,
    x.policystatus policystatus,
    x.NYReg60Ind NYReg60Ind,
    x.Exchange1035Ind Exchange1035Ind,
    x.ModalPremAmt ModalPremAmt,
    x.FaceAmt FaceAmt,
    x.vProductType vProductType,
    x.vHoldingSysKey vHoldingSysKey,
    x.InterestPercent InterestPercent,
    x.vPolno vPolno,
    /*x.DSGN_OPT_AMT DSGN_OPT_AMT,
    x.dsgn_opt_pct dsgn_opt_pct,
    x.ArrType ArrType,
    x.ArrSubType ArrSubType,
    x.ArrStatus ArrStatus,*/
    x.Arrangement,
    x.vattdate vattdate,
    x.vatttime vatttime,
    x.EVENT_NM EVENT_NM,
    x.AttachmentData AttachmentData,
    x.AttachmentSource AttachmentSource,
    x.attusercode attusercode,
    x.vHoldingid Holdingid
    from (SELECT xData doc FROM dual) t,
    xmltable(
    'let $x := $d/TXLife/TXLifeRequest/OLifE
    for $i in $x/Relation[RelationRoleCode/@tc=32]
    return element r
    $x/Holding[@id=$i/@OriginatingObjectID]/@id,
    $x/Holding[@id=$i/@OriginatingObjectID]/Policy,
    $x/Holding[@id=$i/@OriginatingObjectID]//Arrangement,
    $x/Holding[@id=$i/@OriginatingObjectID]/HoldingSysKey,
    $x/Holding[@id=$i/@OriginatingObjectID]/Attachment,
    $x/Party[@id=$i/@RelatedObjectID]/Person,
    $x/Party[@id=$i/@RelatedObjectID]/Risk,
    $x/Party[@id=$i/@RelatedObjectID]/Employment,
    $x/Party[@id=$i/@RelatedObjectID]/Address,
    $x/Activity,
    $x/Relation[@OriginatingObjectID=$x/Holding[@id=$i/@OriginatingObjectID]/@id][RelationRoleCode/@tc=32]/InterestPercent
    passing doc as "d"
    columns
    vHoldingid varchar2(50) path '@id',
    usercode varchar2(200) path 'Activity/UserCode',
    opened varchar2(20) path 'Activity/Opened',
    time varchar2(20) path 'Activity/OLifEExtension/ActivityExtension/OpenedTime',
    InterestPercent varchar2(200) path 'InterestPercent',
    vPolno number path 'Policy/PolNumber',
    riskclass varchar2(20) path 'Policy/Life/Coverage/CovOption/UnderwritingClass/@tc',
    policystatus varchar2(100) path 'Policy/PolicyStatus/@tc',
    NYReg60Ind VARCHAR2(100) path 'Policy/OLifEExtension/PolicyExtension/NYReg60Ind/@tc',
    Exchange1035Ind varchar2(10) path 'Policy/Life/LifeUSA/OLifEExtension/LifeUSAExtension/Exchange1035Ind/@tc',
    ModalPremAmt varchar2(20) path 'Policy/Life/Coverage/ModalPremAmt',
    FaceAmt varchar2(20) path 'Policy/Life/FaceAmt',
    vProductType VARCHAR2(100) path 'Policy/ProductType/@tc',
    firstname VARCHAR2(200) path 'Person/FirstName',
    LastName VARCHAR2(200) path 'Person/LastName',
    BirthDate VARCHAR2(20) PATH 'Person/BirthDate',
    Gender varchar2(10) PATH 'Person/Gender/@tc',
    TobaccoInd varchar2(5) path 'Risk/TobaccoInd/@tc',
    Employmeeid varchar2(100) path 'Employment/EmployeeID',
    Title varchar2(100) path 'Employment/Title',
    zip varchar2(100) path 'Address/Zip',
    vHoldingSysKey varchar2(100) path 'HoldingSysKey',
    Arrangement XMLTYPE PATH 'Arrangement',
    /*DSGN_OPT_AMT varchar2(100) path 'Arrangement/ArrSource[TransferAmtType/@tc=2]/TransferAmt',
    dsgn_opt_pct varchar2(100) path 'Arrangement/ArrSource[TransferAmtType/@tc=3]/TransferPct',
    ArrType VARCHAR2(20) path 'Arrangement/ArrType/@tc',
    ArrSubType VARCHAR2(20) path 'Arrangement/OLifEExtension/ArrangementExtension/ArrSubType/@tc',
    ArrStatus VARCHAR2(10) path 'Arrangement/ArrStatus/@tc',*/
    EVENT_NM VARCHAR2(1000) path 'Attachment/Description',
    AttachmentData VARCHAR2(1000) path 'Attachment/AttachmentData',
    AttachmentSource VARCHAR2(1000) path 'Attachment/AttachmentSource',
    attusercode vARCHAR2(1000) path 'Attachment/UserCode',
    vattdate VARCHAR2(20) PATH 'Attachment/DateCreated',
    vatttime VARCHAR2(20) path 'Attachment/OLifEExtension/AttachmentExtension/CreationTime'
    ) x
    LOOP
         BEGIN
              POINT 2
              <Here comes the business logic>
         END;
    END LOOP;
    Thanks & Regards,
    Edited by: LRAJESH on Feb 25, 2012 5:37 AM

  • How to query for XML-attribute with XPATH

    Hi,
    Isn't there somebody, who can tell me how to query an Attribut of an XML-element correctly ?
    All my trials lead to empty rows. What's worng in my XPATH-expresion ?
    XML-file looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <xmlexport>
    <itsystem guid="e51b91d1-ab0f-11db-2cd7-001641105333">
    <field fieldidentifier="currentVersion" />
    <field fieldidentifier="marketdatacosts">0</field>
    I can query fine the elements and sub-elements, but not attribute 'guid' of /xmlexport/itsystem. Here some trials, all lead
    SELECT t.* FROM CORIA."xmlexport156_TAB", xmltable ('/xmlexport/itsystem ' passing object_value COLUMNS
    GUID     VARCHAR2(1000) path '[@guid=*]') t
    various versions for Xpath:
    path '[@guid="*"]'
    path '/[@guid=*]'
    path '[@guid=*]'
    xmltable ('/xmlexport' ...
    path '/itsystem/[@guid=*]'
    ... combinations of part 1 and 2
    thanks for any hint, LaoDe

    You can either get them directly, or fetch the attribute in your xquery and put them in returning xml fragment, then get them like normal element.
    Method #1:
    path '@guid'
    Method #2:
    xmltable(
    let $is := /xmlexport/itsystem
    return <r><guid>{$is/@guid}</guid></r>
    passing object_value
    columns guid varchar2(1000) path '/r/guid')

  • How to query from the xml table a single, specified element.

    I'm quite new in Xml Db. Pleas, can anybody tell me how to query from the xml table below a single element (i.e. the element 'rapportoparentela = NIPOTE' related to the element 'codicefiscale = CRRVNC76R52G337R', or the element 'rapportoparentela = FIGLIO' related to the element 'codicefiscale = CRRRNT51L23G337Q')?
    - <dati xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <codiceinterno />
    <codicefiscaleassistito>CRRMNL81R31G337H</codicefiscaleassistito>
    - <famigliare>
    <codicefiscale>CRRVNC76R52G337R</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRRNT51L23G337Q</codicefiscale>
    <rapportoparentela>FIGLIO</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CBRPRN15S65E080W</codicefiscale>
    <rapportoparentela>I.S.</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRMNL81R31G337H</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>BCCCML54C50I845G</codicefiscale>
    <rapportoparentela>NUORA</rapportoparentela>
    </famigliare>
    </dati>
    Using SELECT extractValue(value(t),'/rapportoparentela') into result FROM NF_XMLT X,
    TABLE ( xmlsequence (extract(value(X),'/dati/famigliare/rapportoparentela'))) t
    I get all the elements 'rapportoparentela' and I want to get only one specified.
    Regards.
    Piero

    Piero,
    you can add the condition "CRRVNC76R52G337R" to your xpath-expression like:
    SELECT extractValue(value(t),'/rapportoparentela')
    FROM NF_XMLT x
    ,TABLE ( xmlsequence (extract(value(X),'/dati/famigliare[rapportoparentela="CRRVNC76R52G337R"]'))) tto select only those famigliare-elements that have a child-element rapportoparentela with value "CRRVNC76R52G337R".
    When you stored your XML in an XMLType column in the table, i think the following queries are better:
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE extractValue(x.your_XMLType_column,'/dati/famigliare/codicefiscale')
    = 'CRRVNC76R52G337R'or
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE existsNode(x.your_XMLType_column,'/dati/famigliare[codicefiscale="CRRVNC76R52G337R"]')
    != 0

  • How to query an ordinary xml

    I have an xml and I want to query for a particular sub element within it. I can't find any help on this in any of the documentation. All I find is the getVariableData but it can only query on xml that is defined to have part names. How to query on an ordinary xml that doesn't have any part defined? For example I want to query for USERNAME in the xml:
    <ServiceBean_Header simpleType="false">
    <USERNAME>SYSADMIN</USERNAME>
    <PASSWORD>SYSADMIN</PASSWORD>
    <RESPONSIBILITY_NAME>System Administrator</RESPONSIBILITY_NAME>
    <RESPONSIBILITY_APPL_NAME>SYSADMIN</RESPONSIBILITY_APPL_NAME>
    <SECURITY_GROUP_NAME>STANDARD</SECURITY_GROUP_NAME>
    <NLS_LANGUAGE>AMERICAN</NLS_LANGUAGE>
    </ServiceBean_Header>

    If the DOM you have was produced using the Oracle XML Developers Kit (XDK) then you can issue XPath statements against it using "selectSingleNode" and "selectNodes".
    import java.io.FileReader;
    import oracle.xml.parser.v2.DOMParser;
    import oracle.xml.parser.v2.XMLDocument;
    import org.w3c.dom.Node;
    public class Test {
        public static void main(String[] args) throws Exception {
          FileReader reader = new FileReader("YOUR_XML.xml");
          DOMParser parser = new DOMParser();
          parser.parse(reader);
          XMLDocument xmlDocument = parser.getDocument();
          Node resultNode = xmlDocument.selectSingleNode("ServiceBean_Header/USERNAME/text()");
          System.out.println(resultNode.getNodeValue());
    }-Blaise

  • "CONNECT BY"-like query using XPath

    Greetings!
    The problem is as follows:
    I have a XML document whose main part contains a set of many subelements names "rasterFile". Each of this elements has an attribute "rasterRefId" which refers to another rasterFile element (to its id attribute). These references form a tree-like structure of parent and child rasters.
    What we need is to be able to effectively extract a subset of this structure, e.g. for rasterFile with id="4" we need to get this element, its referenced elements, and the elements referenced by the previously referenced elements (but we may request event four or five levels).
    Using a relation database, we should use the CONNECT BY statement, but the document is stored in a XMLType table containing only one row (we use only one large document). So I need to do this sort of query in XPath. How? Or is there any other way to do that?
    Thanks in advance.
    Petr
    The sample document (shortened, the original has about ten thousand rasterFile elements):
    <ber:backdropData xmlns:ber="http://www.berit.com/ber">
    <ber:name>bdemx</ber:name>
    <ber:description/>
    <ber:backdropLayer backdropRefId="bt_5002826" structure="hierarchical"
    format="jpeg">
    <ber:rasterFile id="ti_bt_5002826_jpeg_0_0x0" name="0-0x0.jpeg" decreaseRatio="2">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>1.2996519899999999 1.2996519899999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_1_1x1" name="1-1x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_0_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.6498259949999999 0.6498259949999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_1_1x0" name="1-1x0.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_0_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.6498259949999999 0.6498259949999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_1_0x1" name="1-0x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_0_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.6498259949999999 0.6498259949999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_1_0x0" name="1-0x0.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_0_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.6498259949999999 0.6498259949999999</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_3x3" name="2-3x3.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_3x2" name="2-3x2.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_3x1" name="2-3x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_2x3" name="2-2x3.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_2x2" name="2-2x2.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_2x1" name="2-2x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_1x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    <ber:shear>0.0 0.0</ber:shear>
    <ber:translate>633142.205995 239189.641789</ber:translate>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_1x3" name="2-1x3.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_1x2" name="2-1x2.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_1x1" name="2-1x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_1x0" name="2-1x0.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_0x3" name="2-0x3.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_0x2" name="2-0x2.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x1">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_0x1" name="2-0x1.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    <ber:rasterFile id="ti_bt_5002826_jpeg_2_0x0" name="2-0x0.jpeg" decreaseRatio="2" rasterRefId="ti_bt_5002826_jpeg_1_0x0">
    <ber:size>1000 1000</ber:size>
    <ber:trMatrixCoord>
    <ber:scale>0.32491299749999997 0.32491299749999997</ber:scale>
    </ber:trMatrixCoord>
    </ber:rasterFile>
    </ber:backdropLayer>
    </ber:backdropData>

    Thanks for reply.
    Well, the view doesn't seem to help me. We have only one xml document stored and therefore there is only one row in the XMLType table. Using the "SELECT extract()" statement returns one row containing whole result (in CLOB or whatever) and the view has the same problem.
    What would solve this problem is the query for a collection of elements that would return each resulting element in a single row. But I haven't been able to find out how to do such a thing.
    Petr

  • How to query attributes with namespace in xmltable? thanks

    sample schema:
    <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.tse.or.jp/jp/br/tdnet/ed/pt/2006-03-31">
    <xsd:element name="LocationOfHeadOffice" id="tse-ed-pt_LocationOfHeadOffice" type="xbrli:stringItemType" substitutionGroup="xbrli:item" abstract="false" nillable="true" xbrli:periodType="instant"/>
    <xsd:schema>
    My question is how to query the attribute xbrli:periodType using function xmltable.
    My query statement(it's just a part of it and it does not work):
    xmltable(XMLNamespaces('http://www.w3.org/2001/XMLSchema' as xs,
    'http://www.xbrl.org/2003/instance' as xbrli),
    '/xs:schema/xs:element'
    passing a.schema
    columns periodType varchar2(1000) path '@xbrli:periodType') b
    And the error message:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: '/*/@xs:nillable'
    In fact, with standard xpath "doc("taxonomy.xsd")/xs:schema/xs:element/@xbrli:periodType", we can use the namespace with attributes, but why the xmltable function does not support it?
    And, how can I query this attribute?
    Thanks a lot.

    sorry for the mistake, the error message:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: '/*/@xbrli:periodType'

  • How to query send context of ccBPM in IR?

    Calling a Receiver Determination Defined in the Integration Directory
           1.      In the Receiver From field of the properties area of the send step, select Send Context.
           2.      In the Send Context field, specify a character string for the send context.
    You can choose the character string yourself. You must specify the send context to be able to send messages from the same message interfaces to different receivers in different send steps.
           3.      Query the send context in a corresponding condition in the receiver determination in the Integration Directory.
    My question is, the send context is not a part of the payload of xml, how to query the send context in IR?
    Thanks in advance.

    Hi YiNing Mao,
       Were you able to solve the problem?
       I am also facing a similar issue where i have to receiver determination with condition ProcessStep = ASNtoAII. ASNtoAII is defined as send context in IR in the BPM.
       What is the right way to give the condition
    1. In concerned receiver determination for the receiver service you give this condition
    2. when we select the condition do we need to select XPATH node or the other node to give condition ProcessStep in left operand.
    3. Do we need to give the send context against ProcessStep as ASNtoAII or 'ASNtoAII' ? The difference between two is one is without quotes other is with quotes.
    Looking forward to help from you.
    Thanks and regards,
    Amit Deshpande

  • Query xml data from a CLOB datatye

    All,
    I read in an oracle white paper that is is possible to query XML data from CLOB datatype using oracle text index using operators HASPATH() and INPATH(). I am not able to find any example on how to do this. Can someone please post a simple example here.
    Thank You very much!

    SCOTT@10gXE> CREATE TABLE your_table (id NUMBER, xml_data CLOB)
      2  /
    Table created.
    SCOTT@10gXE> INSERT INTO your_table (id, xml_data)
      2  SELECT t.deptno,
      3           DBMS_XMLGEN.GETXML
      4             ('SELECT d.dname,
      5                   CURSOR (SELECT e.ename, e.job
      6                        FROM   emp e
      7                        WHERE  e.deptno = d.deptno) emp_data
      8            FROM   dept d
      9            WHERE  d.deptno = ' || t.deptno)
    10  FROM   dept t
    11  /
    5 rows created.
    SCOTT@10gXE> COMMIT
      2  /
    Commit complete.
    SCOTT@10gXE> begin
      2    ctx_ddl.create_section_group('xmlpathgroup', 'PATH_SECTION_GROUP');
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> CREATE INDEX myindex
      2  ON your_table(xml_data)
      3  INDEXTYPE IS ctxsys.context
      4  PARAMETERS ('datastore ctxsys.default_datastore
      5              filter ctxsys.null_filter
      6              section group xmlpathgroup'
      7            )
      8  /
    Index created.
    SCOTT@10gXE> SELECT * FROM your_table
      2  WHERE  CONTAINS (xml_data, 'PERSONNEL INPATH (//DNAME)') > 0
      3  /
            ID XML_DATA
            50 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DNAME>PERSONNEL</DNAME>
                 <EMP_DATA>
                 </EMP_DATA>
                </ROW>
               </ROWSET>
    SCOTT@10gXE> SELECT * FROM your_table
      2  WHERE  CONTAINS (xml_data, 'HASPATH (//DNAME="PERSONNEL")') > 0
      3  /
            ID XML_DATA
            50 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DNAME>PERSONNEL</DNAME>
                 <EMP_DATA>
                 </EMP_DATA>
                </ROW>
               </ROWSET>
    SCOTT@10gXE> SELECT * FROM your_table
      2  WHERE  CONTAINS (xml_data, 'CLARK INPATH (//ENAME)') > 0
      3  /
            ID XML_DATA
            10 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DNAME>ACCOUNTING</DNAME>
                 <EMP_DATA>
                  <EMP_DATA_ROW>
                   <ENAME>CLARK</ENAME>
                   <JOB>MANAGER</JOB>
                  </EMP_DATA_ROW>
                  <EMP_DATA_ROW>
                   <ENAME>KING</ENAME>
                   <JOB>PRESIDENT</JOB>
                  </EMP_DATA_ROW>
                  <EMP_DATA_ROW>
                   <ENAME>MILLER</ENAME>
                   <JOB>CLERK</JOB>
                  </EMP_DATA_ROW>
                 </EMP_DATA>
                </ROW>
               </ROWSET>
    SCOTT@10gXE> SELECT * FROM your_table
      2  WHERE  CONTAINS (xml_data, 'HASPATH (//ENAME="CLARK")') > 0
      3  /
            ID XML_DATA
            10 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DNAME>ACCOUNTING</DNAME>
                 <EMP_DATA>
                  <EMP_DATA_ROW>
                   <ENAME>CLARK</ENAME>
                   <JOB>MANAGER</JOB>
                  </EMP_DATA_ROW>
                  <EMP_DATA_ROW>
                   <ENAME>KING</ENAME>
                   <JOB>PRESIDENT</JOB>
                  </EMP_DATA_ROW>
                  <EMP_DATA_ROW>
                   <ENAME>MILLER</ENAME>
                   <JOB>CLERK</JOB>
                  </EMP_DATA_ROW>
                 </EMP_DATA>
                </ROW>
               </ROWSET>
    SCOTT@10gXE>

  • How to read .xml file from embedded .swf(flash output) in captivate

    I have been trying to read .xml file from the .swf (Flash output) that is embedded within the captivate file but no luck yet . Please if anyone got any clue on how get this thing done using Action script 3.0 then let me know. I am using Adobe Captivate 5.5 at present and Flash CS 5.5.
    I am well aware about how to read .xml file through action script 3.0 in flash but when insert the same flash in captivate and publish nothing comes in captivate output. I would higly appreciate if anyone could help me out with that.
    Here is is graphical demonstration of my query :
    Message was edited by: captainmkv

    Hi Captainmkv,
    Does the information in this post cover what you're trying to do: http://forums.adobe.com/message/5081928#5081928
    Tristan,

  • Problem inserting and querying XML data with a recursive XML schema

    Hello,
    I'm facing a problem with querying XML data that is valid against a recursive XML Schema. I have got a table category that stores data as binary XML using Oracle 11g Rel 2 on Windows XP. The XML Schema is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>I registered this schema and created the category table. Then I inserted a new row using the code below:
    insert into category_a values
    (XMlElement("category",
          xmlattributes('categoryAAA' as "id"),
          xmlforest ('ma categ' as "name"),
          (xmlelement("description", (xmlelement("text", 'find doors blest now whiles favours carriage tailor spacious senses defect threat ope willow please exeunt truest assembly <keyword> staring travels <bold> balthasar parts attach </bold> enshelter two <emph> inconsiderate ways preventions </emph> preventions clasps better affections comes perish </keyword> lucretia permit street full meddle yond general nature whipp <emph> lowness </emph> grievous pedro')))    
    The row is successfully inserted as witnessed by the results of row counting. However, I cannot extract data from the table. First, I tried using SqlPlus* which hangs up and quits after a while. I then tried to use SQL Developer, but haven't got any result. Here follow some examples of queries and their results in SQL Developer:
    Query 1
    select * from category
    Result : the whole row is returned
    Query 2
    select xmlquery('$p/category/description' passing object_value as "p" returning content) from category
    Result: "SYS.XMLTYPE"
    now I tried to fully respect the nested structure of description element in order to extract the text portion of <bold> using this query
    Query 3
    select  xmlquery('$p/category/description/text/keyword/bold/text()' passing object_value as "p" returning content) from  category_a
    Result: null
    and also tried to extract the text portion of element <text> using this query
    Query 4
    select  xmlquery('$p/category/description/text/text()' passing object_value as "p" returning content) from  category_a
    Result: "SYS.XMLTYPE".
    On the other hand, I noticed, from the result of query 1, that the opening tags of elements keyword and bold are encoded as the less than operator "&lt;". This explains why query 3 returns NULL. However, query 4 should display the text content of <text>, which is not the case.
    My questions are about
    1. How to properly insert the XML data while preserving the tags (especially the opening tag).
    2. How to display the data (the text portion of the main Element or of the nested elements).
    The problem about question 1 is that it is quite unfeasible to write a unique insert statement because the structure of <description> is recursive. In other words, if the structure of <description> was not recursive, it would be possible to embed the elements using the xmlelement function during the insertion.
    In fact, I need to insert the content of <description> from a source table (called category_a) into a target table (+category_b+) automatically .
    I filled category_a using the Saxloader utility from an flat XML file that I have generated from a benchmark. The content of <description> is different from one row to another but it is always valid with regards to the XML Schema. The data is properly inserted as witnessed by the "select * from category_a" instruction (500 row inserted). Besides, the opening tags of the nested elements under <description> are preserved (no "&lt;"). Then I wrote a PL/SQL procedure in which a cursor extracts the category id and category name into varchar2 variables and description into an XMLtype variable from category_a. When I try to insert the values into a category_b, I get the follwing error:
    LSX-00213: only 0 occurrences of particle "text", minimum is 1which tells that the <text> element is absent (actually it is present in the source table).
    So, my third question is why are not the tags recognized during the insertion?
    Can anyone help please?

    Hello,
    indded, I was using an old version of Sqlplus* (8.0.60.0.0) because I had a previous installation (oracle 10g XE). Instead, I used the Sqlplus* shipped with the 11g2database (version 11.2.0.1.0). All the queries that I wrote work fine and display the data correctly.
    I also used the XMLSERIALIZE function and can now display the description content in SQL Developer.
    Thank you very much.
    To answer your question Marco, I registered the XML Schema using the following code
    declare
      doc varchar2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>';
    begin
      dbms_xmlschema.registerSchema('/xmldb/category_auction.xsd', doc,     LOCAL      => FALSE, 
            GENTYPES   => FALSE,  GENBEAN    => FALSE,   GENTABLES  => FALSE,
             FORCE      => FALSE,
             OPTIONS    => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
             OWNER      => USER);
    end;then, I created the Category table as follows:
    CREATE TABLE category_a of XMLType XMLTYPE store AS BINARY XML
        XMLSCHEMA "xmldb/category_auction.xsd" ELEMENT "category";Now, there still remains a problem of how to insert the "description" content which I serialized as a CLOB data into another table as XML. To this purpose, I wrote a view over the Category_a table as follows:
    CREATE OR REPLACE FORCE VIEW "AUCTION_XWH"."CATEGORY_V" ("CATEGORY_ID", "CNAME", "DESCRIPTION") AS
      select category_v."CATEGORY_ID",category_v."CNAME",
      XMLSerialize(content ( xmlquery('$p/category/description/*' passing object_value as "p" returning content)) as clob) as "DESCRIPTION"
      from  auction.category_a p, 
    xmltable ('$a/category' passing p.Object_Value as "a"
    columns  category_id varchar2(15) path '@id',
              cname varchar2(20) path 'name') category_v;Then, I wrote a procedure to insert data into the Category_xwh table (the source and target tables are slightly different: the common elements are just copied wereas new elements are created in the target table). The code of the procedure is the following:
    create or replace PROCEDURE I_CATEGORY AS
    v_cname VARCHAR2(30);
    v_description clob ;
    v_category_id VARCHAR2(15);
    cursor mycursor is select category_id, cname, description from category_v;
    BEGIN
    open mycursor;
      loop
      /*retrieving the columns*/
      fetch mycursor into v_category_id, v_cname, v_description ;
      exit when mycursor%notfound;
      insert into category_xwh values
      (XMlElement("category",
          xmlattributes(v_category_id as "category_id"),
          xmlelement("Hierarchies", xmlelement("ObjHierarchy", xmlelement ("H_Cat"),
                                                               xmlelement ("Rollsup",
                                                                                  (xmlelement("all_categories",
                                                                                   xmlattributes('allcategories' as "all_category_id")))
        xmlforest (
                  v_cname as "cat_name",
                  v_description as "description")    
    end loop;
      commit;
      close mycursor;
    END I_CATEGORY;When I execute the procedure, I get the following error:
    LSX-00201: contents of "description" should be elements onlyso, I just wonder if this is because v_description is considered as plain text and not as XML text, even if its content is XML. Do I need to use a special function to cast the CLOB as XML?
    Thanks for your help.
    Doulkifli

  • How to evaluate dynamic XPath expression in BPEL?

    I have an xml file where I keep many settings for my BPEL process. At runtime, I read the file and I want to select values from it based on values in the process payload.
    For example, imagine that the process payload is an order:
    <order>
    <header>
    <id/>
    <customer_id/>
    <team_id/>
    </header>
    <items>
    <item>
    <id/>
    <sku/>
    <price/>
    <quantity/>
    </item>
    </items>
    </order>
    Now, in my xml settings file, I have a section where I keep a mapping of "team_id" and "assignment_group", so that for each team id, I can select the appropriate group to whom a task should be assigned. The relevant section of the settings file will look something like this:
    <assignment_groups>
    <group team_id='0923230'>invoice_approvers</group>
    <group team_id='3094303'>order_approvers</group>
    <group team_id='3434355'>shipping_approvers</group>
    </assignment_groups>
    So, imagine I get an order input to my process where the team_id is '3094303'. Now I have to lookup the correct assignment group in my settings file.
    So, I construct the dynamic XPath expression
    /settings/assignment_groups/group[@team_id=3094303]
    I know that this would evaluate to "order_approvers". However, even though I have the XPath expression in a BPEL variable, and I have my settings file as a BPEL variable also, I don't know how to execute the XPath expression against the settings BPEL variable to retrieve the correct value.
    Any ideas appreciated.
    Thanks,
    Jack

    James:
    Thank you for the response. Incidentally, this is the very same document and section that I have been looking at for guidance. Specifically, the section titled "Dynamically indexing by Constructing an XPath at Run Time" on page 12-13.
    I tried to do something similar to the example at the top of page 13:
    <variable name="iterator" type="xsd:integer"/>
    <assign>
    <copy>
    <from expression="concat('/invoice/line-item[',bpws:getVariableData('iterator'), ']/line-total')"/>
    <to variable="xpath"/>
    </copy>
    <copy>
    <from expression="bpws:getVariableData('input', 'payload',bpws:getVariableData('xpath')) + ..."/>
    </copy>
    </assign>
    I am able to achieve the first copy operation to get my dynamic XPath into a BPEL variable and that's fairly straightforward. But I am unable to get the second copy to work. Specifically, I am not sure what to put in the second argument of the bpws:getVariableData function. I have tried many different combinations, but when I try to compile my program, I get the following compilation error:
    Error:
    [Error ORABPEL-10902]: compilation failed
    [Description]: in "C:\code\TrainingWS\SampleGetSettings\bpel\SampleGetSettings.bpel", XML parsing failed because "org.collaxa.thirdparty.jaxen.expr.DefaultFunctionCallExpr".
    [Potential fix]: n/a.
    Thanks,
    Jack

Maybe you are looking for

  • Ios6 & iPhone 4 tethering and bluetoothproblems

    Updated MacBook Pro and now iPhone 4 won't tether or Bluetooth. Tried resetting phone and updating iTunes but no results. Also tried a friends iPhone with same results. Anybody have any suggestions? Tinkered with all settings  I could find

  • Greater than?

    My code is as follows: switch(opCode){ case 41: {                     System.out.println("Jump to opCode if AC<0");                     if(getAccum() < 0){                          System.out.println("AC2: " + getAccum());                          Me

  • Good old days

    A spammer, who has now been terminated, has brought up voices from the past: Bob, Teri, Len, even in the same thread, http://www.adobeforums.com/webx?128@@.2ccf735b. Ah, those days.

  • My Spry Tooltips make page judder in IE 6 as if creating extra content.

    http://localhost/les/pages/courses.php That's the link to the page where I am using the tooltips. In IE6 on the first use of the TT it makes a judder and pushes the page content down about 10px(?). Any way to fix that? Thanks Martin

  • Exporting timeline...

    Hi, I always like to be here and read other's issues, fixes, suggestions, tips and ideas. Great!!! and really like it. As I'm a newbie who moved to Mac from painful Windows recently, I might be asking fundamental questions now and then. So, please be