Xsql: merging data with include-xml

Is there any way for the data returned from <xsql:include-xml> to include a primary key so that the stylesheet can merge the data in.
In my situation, I have a primary result set from xsql:query but it has two fields in varchar2's that include xml content. (This is oracle 8i.) So I need to query for this separately -- using xsql:include-xml.
I'm trying to merge this data back in to the primary result set via an xsl transform. But I need some way of identifying corresponding records. Can I have a second field in my xsql:include-xml query that will be used as a primary key? And maybe inserted as an attribute?
Has anyone been through this or have any thoughts on my conundrum?

Can show an example for what you plan to do? Normally, you need to use reparse="yes".

Similar Messages

  • Merging data with LiveCycle questions

    I have LiveCycle Designer 8.0 and I didn't find a forum for it so just point me in the right direction if this is not the place.
    I have a couple of questions with merging data with Livecycle PDFS
    1. XDP is the file format for merging data with LiveCycle created PDFs (FDF was with Acrobat)? if not, what is the format?
    2. We want different colors of the same PDF without actually making the different PDFS, is there a way we can do this through the merging the data?  For example: In the XDP file, we specify the color of the border of a rectangle.  When the PDF merges with the data, will the PDF be able to change the border of the rectangle with the specified color?
    3. Can a picture (a specific size) be merged in the PDF?
    Thanks!

    1. XDP is the file format for merging data with LiveCycle created PDFs (FDF was with Acrobat)? if not, what is the format?
    An XDP file is simply an XML file that packages a PDF file in XML, along with XML form and template data. Data can be merged from generic .xml or the XML version of FDF called XFDF.
    2. We want different colors of the same PDF without actually making the different PDFS, is there a way we can do this through the merging the data?  For example: In the XDP file, we specify the color of the border of a rectangle.  When the PDF merges with the data, will the PDF be able to change the border of the rectangle with the specified color?
    Yes. Consider a field called 'firstName'. I can add a script to the form:ready event that checks the value of the data merged with the field and changes the border edge color to red if the data is not equal to 'Steve'.
    // customer.page1.firstName::ready:form - (JavaScript, client)
    if (this.rawValue != "Steve") {
         this.border.edge.color.value = "255,0,0";
    3. Can a picture (a specific size) be merged in the PDF?
    Yes.
    Steve

  • How to read data with different XML schemas within the single connection?

    I have Oracle 11g database
    I access it through jdbc:oracle:thin, version 11.2.0.3, same as xdb.
    I have several tables, each has one XMLType column, all schema-based.
    There are three different XML schemata registered in the DB
    I may need to read the XML data from several tables.
    If all the XMLTypes have the same XML schema ,there is no problem,
    If the schemata are different, the second read throws BindXMLException.
    If I reset the connection between the reads of the XMLType column with different schemata, it works.
    The question is: how can I configure the driver, or the connection to be able to read the data with different XML schemata without resetting the connection (which is expensive).
    The code to get the XMLType data is textbook implementation:
    1   ResultSet resultSet = statement.executeQuery( sql ) ;
    2   String result = null ;
    3    while(resultSet.next()) {
    4   SQLXML sqlxml = resultSet.getSQLXML(1) ;
    5   result = sqlxml.getString() ;
    6   sqlxml.free();
    7   }
    8   resultSet.close();
    9    return result ;

    It turns out, that I needed to serialize the XML on the server and read it as Blob. Like this:
    1    final Statement statement = connection.createStatement() ;
    2    final String sql = String.format("select xmlserialize(content xml_content_column as blob encoding 'UTF-8') from %s where key='%s'", table, key ) ;
    3   ResultSet resultSet = statement.executeQuery( sql ) ;
    4   String result = null ;
    5    while(resultSet.next()) {
    6   Blob blob = resultSet.getBlob( 1 );
    7   InputStream inputStream = blob.getBinaryStream();
    8   result = new Scanner( inputStream ).useDelimiter( "\\A" ).next();
    9   inputStream.close();
    10   blob.free();
    11   }
    12   resultSet.close();
    13   statement.close();
    14
    15   System.out.println( result );
    16    return result ;
    17
    Then it works. Still, can't get it work with XMLType in resultset.On the client unwrapping XML blows up when trying to switch to different XML schema. JDBC/XDB problem?

  • Replace or Merge data with iCloud

    Mobile Me provided the facility to replace all data on a device from the data on Mobile Me.
    I have updated my contacts on my iMac. I let iCloud update my newer Mac Book Air but ended up with duplicates
    Now I want to update my Mac Book Pro which hasn't been used for 4 months and contains all the old contact information I edited off my other two machines.
    iCloud says the contacts data from my MBP will be MERGED with the data on iCloud.
    That suggests I will be letting myself in for a complete re-edit again and repeating work already done on the other devices.
    Is this the case and can it be avoided?

    Dear wjosten
    Thank you for your prompt reply which arrived while I was signed out.
    I didn't see your post and would need a little more detail. I am not familiar enough with the systems to know where you are making the changes you describe.  But I used have the following more laborious work-around:
    Leave the ccntacts sync unchecked in iCloud prferences on my MBP
    Back up the address book on MBP
    Wipe all contacts in the address book on my MBP
    Sign into iCloud on-line
    Open address book and select the first entry in A
    In the tools pop up menu select all
    in the tools pop up menu select Export vCard
    The whole address book is downloaded and a query window opens asking if all the (counted) contacts are to be imported into the address book on my MBP
    >>Result a complete copy of the address book on iCloud and it is safe to check the sync box in iCloud preferences on my MBP so the merge will not corrupt the iCloud master.
    Back up the new Address Book on my MBP
    Kind regards
    Word-Weaver

  • Merging data with the cloud

    Backed up on the cloud, I have my latest data, however on my iphone I have Notes data that is not in the cloud. How can I merge the Notes with the data on the cloud so that everything is the latest information and data ? Thanks

    I don't think you're going to get a Merge option for Notes.  You're going to have to email each note on your phone to yourself that is not already in iCloud, then allow iCloud to overwrite your notes, then delete any notes that you don't want, then copy/paste the text of the notes you emailed ealier into new notes created in the iCloud account.

  • LiveCyle Forms and LiveCycle Designer - Merging data

    Hello,
    I´m using the following products:
    Adobe Professional/Reader/Livecycle Designer = 8
    LiveCycle FormServer (Forms) = 7.0
    My questions are about using livecycle forms with livecycle Forms. I think this is the right forum because the functionality I´m getting seems to be more designer related.
    The goal: merge data with template and execute some code (server side) while letting the template dynamic at client side.
    1) Merge a xml file with a xdp file
    The data is well merged. The code is executed at client and at server side.
    2) Merge a xml file with a dynamic 8 pdf file
    I get this message:
    To view the full contents of this document, you need a later version of the PDF viewer. You can upgrade
    to the latest version of Adobe Reader from www.adobe.com/products/acrobat/readstep2.html
    For further support, go to www.adobe.com/support/products/acrreader.html
    I think this is "normal" because the version of LiveCycle Forms I´m using is 7.0. But if I want to work with pdf 8 files, what is the right version of Livecycle Forms? Do I need to whait until version 8? Where can I update (or download trial) of the latest versions: 7.1; 7.2?
    Used:
    RenderAtClient=true
    FormPreference = "PDFForm";
    3) Merge a xml file with a dynamic 7 pdf file
    Doesn´t work: data will not merge; code will not run at the server and client side code will not work, too. However, if I try to merge the data with a dynamic pdf form created with livecycle designer 7.1, the data will merge.
    In my opinion there are incompatible differences between how a liveCycle 7.1 pdf form and a Livecycle 8 pdf form (saved with version 7) is worked by LiveCycle Forms.
    Despite this, there is some bugs in Livecycle Forms when working with PDF files. It woks well with xdp but not with pdf, maybe because a xdp is more simple to work with...
    Is this solved in other versions? Where can I get them?
    Thank you

    Forms are forms. They don't change just because you upload them. While it has nothing to do with LiveCycle as such, FC should be able to open your frorm and convert it. In any case, ask such specific questions in teh relevant product forums.
    Mylenium

  • How to merge data returned from server after you hit SUBMIT button

    I have a PDF form with blank ID field. When user click Submit button on the form, an ID will be generated from database on the server side. How do I merge this ID with client's original PDF from so he knows his ID number? Any help thanks.

    When the user submits the form, he or she is redirected to the web page that you put in the submit URL. The form doesn't generally stick around. A typical response would be to return an HTML page that confirms receipt and gives a reference number. If you want to merge data with the PDF and present that back to the user, it's possible, but not very easy. If you decide that you'd like to go down that path, you can start by searching this forum on "vnd". You'll find a long thread with 30+ messages that show how to merge data with a PDF using various types of CGI scripts.

  • #DATA# in Chart XML

    The #DATA# field in Chart XML takes the data from your SQL query and wraps it in XML so that AnyChart can render the chart correctly.
    Is there a way for me to customize how the XML is generated?
    Where do I find the definition for the #DATA# field?
    Thanks
    Austin

    Hi Austin,
    Firstly, what version of APEX are you using? Pre-APEX 4.0, the supported Flash charts use AnyChart 3.3 charts, however with APEX 4.0 we've integrated AnyChart 5 charts. The XML Reference differs quite alot between the two chart versions, so I'd just like to ensure that I provide you with the correct information for the version of charts you'#re using.
    The #DATA# substitution string in your chart XML is replaced at runtime with XML tags containing the resultset from your chart series query. If the chart XML does not contain the #DATA# substitution string, then we assume that you are providing your own data, and the chart series query will not be used. The generation of the XML tags for the data differs from chart type to chart type e.g. the data tags for a Pie chart are very different to that of a Gantt chart. Generally, users don't need to worry about that. They just need to provide the chart series query, and the underlying logic takes care of the rest. However, if you need to customize that XML tags for data, for whatever reason, then you essentially have two options here:
    1) Hard-code the necessary XML into the Custom XML region of your chart. This would require that you set "Use Custom XML" to Yes, on the Chart Attributes page, and in the Custom XML region, replace #DATA# with your XML e.g
    <data>
      <series name="VALUE" type="Line" color="0x1D8BD1">
        <point name="ALLEN" y="300">
        </point>
        <point name="MARTIN" y="1400">
        </point>
        <point name="TURNER" y="0">
        </point>
        <point name="WARD" y="500">
        </point>
      </series>
    </data><b>NOTE</b>: the above XML is in AnyChart 5 format, so if you're using AnyChart 3.3 charts then the XML will look very different. I can provide a sample for that if necessary. The AnyChart 3.3 XML Reference can be accessed here: http://3.anychart.com/products/docs/anychart/index.htm and the AnyChart 5 XML Reference can be accessed here: http://anychart.com/products/anychart/docs/xmlReference/index.html.
    or
    2) Generate your own data tags, via a page process for example, save the output to a hidden page item, and then reference that page item in the chart Custom XML...again, you'd be removing the #DATA# substitution string and replacing it with a reference to a hidden item e.g. &P1_DATA. I've got an example of how to do this on my Sample Application Thresholds example, here: http://apex.oracle.com/pls/apex/f?p=36648:35. Basically I've used an On-Demand process to generate the XML, which needed to be customised because the <data> tag needs to reference a threshold attribute e.g. <data threshold="salary_thresholds">, and by default the <data> tag does not reference this attribute.
    I hope the above information is helpful, and if you require any further explanation or assistance, just let me know.
    Regards,
    Hilary

  • How to create a data connection with dynamic XML file?

    Thanks for all reply first!
    I have formatted the submitted data into an XML file on the server side,this file can be import to PDF form correctly.
    I try to send this XML file to the user to let him can review what he has submitted.
    I guess that I should create a data connection to the XML file so that it can be reviewed by the user.
    But the question is that the XML file is dynamic generated.
    How can i do?
    give me some clus or examples,please.
    thanks,
    Jasper.

    Hi Jasper,
    To show user back the result, you can use PDF instead of XML. You can store the PDF template in server and you can merge XML data with PDF template by Livecycle Form Data Integration service.
    We, as KGC, can generate huge number of Adobe Livecycle forms in small periods. Also we give consultancy on Adobe Livecycle ES products and Adobe Livecyle Designer. In case of any need, do not hesitate to contact us.
    Asiye Günaydın
    Project Consultant
    KGC Consulting Co.
    www.kgc.com.tr

  • How to Map XML data with XSD Schema in JAXB

    Hello,
    I am very much new to JAXB.
    I am in need of someone help to go further in my dev.
    I am having an XSD and i could able to do marshall and unmarshall using JAXB.
    My problem is...
    Consider followings are my Schema...
    - <person id="general" help="USER.DOM.HELP.GENERAL" label="USER.DOM.LABEL.GENERAL" access="READWRITE">
    <attribute id="Name" mandatory="true" type="STRING" access="READONLY" widget="NONE" />
    <attribute id="login" label="USER.LABEL.LOGIN" help="USER.HELP.LOGIN" regexp="[A-a]" type="STRING" summary="true" access="WCREATE_RUPDATE" widget="TEXTFIELD" />
    <attribute id="firstname" summary="true" label="USER.LABEL.FIRSTNAME" help="USER.HELP.FIRSTNAME" type="STRING" regexp="[A-a]" access="READWRITE" widget="TEXTFIELD" />
    In this example a person contains set of attributes... some are mandatory(Name)...
    In my application i will unmarshall the the schema file and show in GUI as a set of attributes when the operator want to create a person. And its very well working.
    Now say for example, i am requesting my server to show all the created persons and its showing. when i click on the particular person the GUI will place the request to the server to get the corresponding date for the selected person.
    But the response contains only the mandatory attribute.. i mean Name.... this may be because of the way my server working. So now i want to show the operator all the set of attributes for that person with the Name.
    I mean i need to merge the schema with me resultant data and show it in the GUI.
    My result is in the form of xml stream. And i will convert my schema also in the form of XML...
    Now i need to merge both of this XMl and need to present in the GUI...
    Any help please...
    Thank You!!!

    Still i am not getting any reply :(

  • Problems with Merge Data Files

    Created a form with radio buttons and finally have it working on my computer including the Merge Data Files creating the report.csv file.  However, when my co-worker creates the report.csv, the columns for the radio buttons are not included.  Had this problem on my computer when I had names for the radio buttons, but fixed it.  The data columns for the radio buttons are not exported on the co-workers computer.  Both are Pro X version, mine 10.0.0 but co-worker's is 10.1.7.
    Any suggestions?

    Back up all data.
    Please triple-click anywhere in the line below on this page to select it:
    defaults delete -app Safari WebKitOmitPDFSupport
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Quit Safari. Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window by pressing the key combination command-V. I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting.
    Wait for a new line ending in a dollar sign (“$”) to appear below what you entered. You can then quit Terminal. Test.

  • Possible to include merge fields with exported PDF?

    Hello,
    I have only a simple question - is it possible to include data merge fields when exporting to pdf?
    Using InDesign CS2, we are doing a direct mailing campaign and having the printing outsourced. It is a 4 page document with only page 1 personalised - sending to over 1,500 recipients.
    The printer says he doesn't want our indesign file, he just wants us to create the 4 page indesign document, prepare the data merge fields, export to pdf and then send it to him.
    He says he'll then import it back into his own indesign one he gets this pdf and do the merge himself with the excel .csv file we provide.
    Does this sound about right? If so, how can I ensure the pdf is correct to send over?
    I have managed to get the data merge fields to be clickable like links in the exported PDF by including 'hyperlinks' and 'interactive elements' when exporting - but is this correct?
    Thank you in advance for all your help...

    The printer is right that he can use your pdf.  It is ok to place a pdf into InDesign. It might fit into his workflows and experience to do this work so.
    I would recommend to use a PDF/X4 with bleed as the printer requieres to place into an INDD file. But you should communicate with your printer how he wants it.

  • Problem with data template in XML publisher

    When I create data template in xml publisher and save it, I get next message:
    dbase:
    Failed to save data.
    Error occurred when creating xml data.
    undefined
    NaN
    NaN
    dbase is a database server
    JDBC connection name:asu_fox
    JDBC connection URL: jdbc:oracle:thin:@dbase:1521:ora03
    Text in data template:
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="data_report_2" description="data template for reports 2 and 10"
    dataSourceRef="asu_fox" version="1.0">
    <dataQuery>
         <sqlStatement name="Q1">
              <![CDATA[select kol_pl,kol_sv,trud_pl,trud_sv,nom_per_p,kod_polu_p,p_v,kod_tmc,liter,kol_skl,nom_per,shifr_dse,shifr_izd,kod_polu,kod_post,trud,kol_m,tip_rin,kod_op,kod_op0,order1,n_val,shifr_usel_val,sum_trud_val,sum_trud_val_sv from reporter.t_plan_report_2]]>
         </sqlStatement>
    </dataQuery>
    <dataStructure>
         <group name="group_all" source="Q1">
              <element name="kol_pl_l" value="kol_pl"/>
              <element name="kol_sv_l" value="kol_sv"/>
              <element name="trud_pl_l" value="trud_pl"/>
              <element name="trud_sv_l" value="trud_sv"/>
              <element name="nom_per_p_l" value="nom_per_p"/>
              <element name="kod_polu_p_l" value="kod_polu_p"/>
              <element name="p_v_l" value="p_v"/>
              <element name="kod_tmc_l" value="kod_tmc"/>
              <element name="liter_l" value="liter"/>
              <element name="nom_per_l" value="nom_per"/>
              <element name="shifr_dse_l" value="shifr_dse"/>
              <element name="shifr_izd_l" value="shifr_izd"/>
              <element name="kod_polu_l" value="kod_polu"/>
              <element name="kod_post_l" value="kod_post"/>
              <element name="trud_l" value="trud"/>
              <element name="kol_m_l" value="kol_m"/>
              <element name="tip_rin_l" value="tip_rin"/>
              <element name="kod_op_l" value="kod_op"/>
              <element name="kod_op0_l" value="kod_op0"/>
              <element name="order1_l" value="order1"/>
              <element name="n_val_l" value="n_val"/>
              <element name="shifr_usel_val_l" value="shifr_usel_val"/>
              <element name="sum_trud_val_l" value="sum_trud_val"/>
              <element name="sum_trud_val_sv_l" value="sum_trud_val_sv"/>
         </group>
    </dataStructure>
    </dataTemplate>
    I get this error with different data templates.
    Help me, please.
    Vladimir

    Hi Vladimir
    Can you test the data template posted here. http://static7.userland.com/oracle/gems/leslieStuddard/EMPLOYEES.xml
    It needs to connect to the sample scott schema, hopefully you have it installed?
    Let me know if you get the same error.
    thanks
    Tim

  • Create data merged document with data on every second page?

    Is it possible to create a data merged document with the variable data only on every second page?
    I have set up the pages with the variable data as a master page (on every odd page) with the text box and paragraph style all set up, and I have set 'override master page items' so the data can be placed, but InDesign seems to freeze up when I try to create the merged document?

    There should be no problem doing the merge with a two-page master and a two-page template document with fields only on one page (and off the top of my head there's no reason to move them off the master page if that's where you put them). I think the problem here is that rachrachm already has a file of 500 pages (based on another thread asking how to apply masters to every other page).
    It's potentially possible to simply place the data file (without the header row) as a text file and auto-flow through the master page frames (can't say for sure without seeing the files), or if the pages without the merge fields are the same just, remove all but the first two pages from the template and do the merge.
    As I metioned earlier, though, this is a very inefficient method of producing that sort of document. A true variable data print flow would be better (you'd need to find a commercial printer who can do it with your data file), or the home version would be to make one single page file for the static content, print 250 copies (plus a few extras, just in case), then make a single page merge template, do the merge, and print that on the back of the already printed pages, or as a separate page. It is immeasurably faster to print multiple copies of a document than it is to print a document that has multiple identical pages.

  • 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

Maybe you are looking for