XML Manipulation

We plan on supporting multiple versions of our xml gateway. This will require some XML manipulation dependingly on the version number. By manipulating I simply mean adding and removing nodes. What we want to do is have one method to add a node and one method to remove a node. Multiple calls to each method will be made and this again depends on the version number. The main concern that we have is that DOM can be resource intensive. We want to place the xml tree in the memory once and then do all the manipulation. Should we do this part first:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.parse(new java.io.ByteArrayInputStream(xmlstring.getBytes()));
And then just pass the document to the two methods that return the modified document? Or is there a different way of doing this altogether? What is the best way to carefully and intelligently handle XML processing?

Something like:
1) select xmltype(<vc2>) from <table>
2) ... where extractvalue(<xml>, '/path/to/node') = <value>
3) update ... set <xml> = udpatexml(<xml>, '/path/to/node/text()',<new value>) ...
Check out XML DB Developer's Guide for more info.

Similar Messages

  • Xmlns problem in XML manipulation

    Hi
    I notice that if a xml (element having xmlns), and each time you assign, append or replace the child element you will always get xmlns in your child. For ex
    <a xmlns="http://www.w3.org/1999/xhtml">
    <b/>
    </a>
    new element:
    <c> test </c>
    Appending   <c> test </c> to     </b >  in A (<b>) will result
    <a xmlns="http://www.w3.org/1999/xhtml">
    <b>
    <c xmlns=""> test </c>
    </b>
    </a>
    Why does the element  <c xmlns=""> test </c>   having xmlns?? Could it be a bug of MII ?
    Edited by: Seng Kiang Hoe on Jun 30, 2011 5:00 PM

    You are trying to insert a node of xml inside other xml node which is using namespace http://www.w3.org/1999/xhtml.
    Node C is not containing the same namespace.
    if the parse will not add xmlns="" then it will use the namespace as a node which is not correct.
    it your c node will also using the same namespace as
    <c xmlns="http://www.w3.org/1999/xhtml"> test </c>
    then you will find output
    <a xmlns="http://www.w3.org/1999/xhtml">
    <b>
    <c> test </c>
    </b>
    </a>
    Thanks
    Anshul

  • Need with xml manipulation(help!!!)

    am trying to use jdom to manipulate an xml file...can anybody help on how to achieve this structure below.
    I have an xml file in this form
    <test name ="x " value="y">
    <id name="d" value="1"/>
    <id name="d" value="1"/>
    <id name="d" value="1"/> </test>
    <test name ="x " value="b">
    <id name="d" value="2"/>
    <id name="c" value="2"/>
    <id name="c" value="2"/>
    </test>
    I want to attain this below:
    <test name ="x " value="y">
    <id name="d" value="1"/>
    <id name="d" value="1"/>
    <id name="d" value="1"/>
    <test name ="x " value="b">
    <id name="d" value="2"/>
    <id name="c" value="2"/>
    <id name="c" value="2"/>
    </test>
    </test>
    The second element "test" is a child of the first element...is there a way to manipulate this to get that nesting right?

    I should think your problem is that the first of these isn't actually a valid XML document (should be a single, top level tag. Consequently a DOM approach probably won't parse it.
    I'd be inclined to turn it into a valid document first (by putting the whole thing in some new tag. Then you can turn it into a DOM, move the extra test nodes and dump it out again using the transform stuff.

  • Xml manipulation using xMII Logic Editor

    Hi Friends,
    I have an input xml file :-
    <?xml version="1.0" encoding="UTF-8"?>
    <CampaignDetails>
         <CampaignID> 1</CampaignID>
         <CampaignID> 2</CampaignID>
         <CampaignID> 3</CampaignID>
         <StartTime CampaignID="1"> st1</StartTime>
         <StartTime CampaignID="2"> st2</StartTime>
         <StartTime CampaignID="3"> st3</StartTime>
         <EndTime CampaignID="1">et1</EndTime>
         <EndTime CampaignID="2">et2</EndTime>
         <EndTime CampaignID="3">et3</EndTime>
         <Description CampaignID="1"> This is Campaign 1</Description>
         <Description CampaignID="2"> This is Campaign 2</Description>
         <Description CampaignID="3"> This is Campaign 3</Description>
    </CampaignDetails>
    I want to manipulate this xml file as per the following :-
    <?xml version="1.0" encoding="UTF-8"?>
    <CampaignDetails>
    <Campaign>
         <ID>1</ID>
         <Description> This is campaign 1</Description>
         <StartTime> st1</StartTime>
         <EndTime> et1</EndTime>
    </Campaign>
    <Campaign>
         <ID>1</ID>
         <Description> This is campaign 2</Description>
         <StartTime> st2</StartTime>
         <EndTime> et2</EndTime>
    </Campaign>
    <Campaign>
         <ID>1</ID>
         <Description> This is campaign 3</Description>
         <StartTime> st3</StartTime>
         <EndTime> et3</EndTime>
    </Campaign>
    </CampaignDetails>
    Can anybody please tell me as to how to proceed using xMII Logic Editor?? I have tried a lot but I am failing.
    And Please explain the steps in detail.
    Thanks in Advance.
    Lipsa.

    Hi Rick,
    I tried but I am getting the following ouput.
    <?xml version="1.0" encoding="UTF-8"?><Location><CampaignDetails> <Campaign> <ID>1</ID> <Description> This is Campaign 1</Description> <StartTime> st1</StartTime> <EndTime>et1</EndTime> </Campaign> <Campaign> <ID/> <Description/> <StartTime/> <EndTime/> </Campaign> </CampaignDetails><CampaignDetails> <Campaign> <ID>2</ID> <Description> This is Campaign 2</Description> <StartTime> st2</StartTime> <EndTime>et2</EndTime> </Campaign> <Campaign> <ID/> <Description/> <StartTime/> <EndTime/> </Campaign> </CampaignDetails><CampaignDetails> <Campaign> <ID>3</ID> <Description> This is Campaign 3</Description> <StartTime> st3</StartTime> <EndTime>et3</EndTime> </Campaign> <Campaign> <ID/> <Description/> <StartTime/> <EndTime/> </Campaign> </CampaignDetails><CampaignDetails> <Campaign> <ID>4</ID> <Description> This is Campaign 4</Description> <StartTime>st4</StartTime> <EndTime>et4</EndTime> </Campaign> <Campaign> <ID/> <Description/> <StartTime/> <EndTime/> </Campaign> </CampaignDetails></Location>
    And not the desirable one.
    Please help me out.
    Output has to be in the following way:-
    <?xml version="1.0" encoding="UTF-8"?>
    <Location>
         <CampaignDetails>
              <Campaign>
                   <ID>1</ID>
                   <Description> This is Campaign 1</Description>
                   <StartTime> st1</StartTime>
                   <EndTime>et1</EndTime>
              </Campaign>
              <Campaign>
                   <ID>2</ID>
                   <Description> This is Campaign 2</Description>
                   <StartTime> st2</StartTime>
                   <EndTime>et2</EndTime>
              </Campaign>
         </CampaignDetails>
         <CampaignDetails>
              <Campaign>
                   <ID>3</ID>
                   <Description> This is Campaign 3</Description>
                   <StartTime> st3</StartTime>
                   <EndTime>et3</EndTime>
              </Campaign>
              <Campaign>
                   <ID>4</ID>
                   <Description> This is Campaign 4</Description>
                   <StartTime> st4</StartTime>
                   <EndTime>et4</EndTime>
              </Campaign>
         </CampaignDetails>
    </Location>
    and the input is :
    <?xml version="1.0" encoding="UTF-8"?>
    <CampaignDetails>
         <CampaignID> 1</CampaignID>
         <CampaignID> 2</CampaignID>
         <CampaignID> 3</CampaignID>
         <CampaignID>4</CampaignID>
         <StartTime CampaignID="1"> st1</StartTime>
         <StartTime CampaignID="2"> st2</StartTime>
         <StartTime CampaignID="3"> st3</StartTime>
         <StartTime CampaignID="4">st4</StartTime>
         <EndTime CampaignID="1">et1</EndTime>
         <EndTime CampaignID="2">et2</EndTime>
         <EndTime CampaignID="3">et3</EndTime>
         <EndTime CampaignID="4">et4</EndTime>
         <Description CampaignID="1"> This is Campaign 1</Description>
         <Description CampaignID="2"> This is Campaign 2</Description>
         <Description CampaignID="3"> This is Campaign 3</Description>
         <Description CampaignID="4"> This is Campaign 4</Description>
    </CampaignDetails>
    Please help.
    Thanks in Advance,
    Lipsa.

  • XML manipulation in Oracle 9i

    Hello everybody,
    Without being able to use DB Link, I need to pass an XML to a PL/SQL package in a different Oracle 9i server.
    Let me make my example simple:
    the XML looks like this:
    <root>
       <entry>
          <name>weather</name>
          <value>rain</value>
       </entry>
    </root>The package is supposed to receive this XML and collect arbitrary number of new entries containing names and values.
    I am wondering...
    1. What is the most performance effective way to implement this requirement?
    2. Which approach should I take:
    a) to create types and de-serialize the input XML and serialize output when it's return, or
    b) read the XML clob and parse it into XMLDOM and use the XMLDOM functions to insert/delete nodes, or
    c) is there any other better option?
    3. Where can I find examples about these approaches for Oracle 9i?
    4. Will there be better ways to do these in a new Oracle version?
    Thanks a lot in advance,
    Alan.

    I would suggest not writing new code using a version of the database so old it is in desupport. Better to spend your efforts moving to 10gR2 or 11gR1 and then implement your application with a far more robust and faster set of tools.

  • XML Parser for PL/SQL

    Hi,
    I have to produce and manipulate XML documents in PL/SQL. I have downloaded the XML Parser for PL/SQL from Oracle's web site.
    Can anyone please:
    1. Point me to some examples illustrating XML DOM manipulation with PL/SQL.
    2. Any information about PL/SQL packages used for XML manipulation.
    I am using Oracle 8i version 8.1.6
    Thanks,
    Rossen

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Rossen Petkov ([email protected]):
    Hi,
    I have to produce and manipulate XML documents in PL/SQL. I have downloaded the XML Parser for PL/SQL from Oracle's web site.
    Can anyone please:
    1. Point me to some examples illustrating XML DOM manipulation with PL/SQL.
    2. Any information about PL/SQL packages used for XML manipulation.
    I am using Oracle 8i version 8.1.6
    Thanks,
    Rossen<HR></BLOCKQUOTE>
    Hope this will do something
    set serveroutput on
    create or replace procedure domsample(dir varchar2, inpfile varchar2, errfile varchar2) is
    p xmlparser.parser;
    doc xmldom.DOMDocument;
    -- Print elements
    procedure printElements( doc xmldom.DOMDocument) is
    nl xmldom.DOMNodeList;
    len number;
    n xmldom.DOMNode;
    t xmldom.DOMNode;
    begin
    -- get all elements.
    nl := xmldom.getElementsByTagName(doc,'*');
    len := xmldom.getLength(nl);
    -- loop through elements.
    for i in 0..len-1 loop
    if xmldom.isnull(nl) = FALSE then
    n := xmldom.item(nl,i);
    IF xmldom.hasChildNodes(n) then
    t := xmldom.getFirstChild(n);
    dbms_output.put(xmldom.getNodeName(n) &#0124; &#0124;':');
    dbms_output.put_line(xmldom.getNodeValue(t));
    end if;
    end if;
    end loop;
    dbms_output.put_line(' ');
    end printElements;
    -- print the attributes of each element in a document.
    procedure printElementAttributes(doc xmldom.DOMDocument) is
    nl xmldom.DOMNodelist;
    len1 number;
    len2 number;
    n xmldom.DOMNode;
    e xmldom.DOMElement;
    nnm xmldom.DOMNamedNodeMap;
    attrname varchar2(100);
    attrval varchar2(100);
    begin
    -- get all Elements
    nl := xmldom.getElementsByTagName(doc,'*');
    len1 := xmldom.getLength(nl);
    -- loop through elements.
    for j in 0 .. len1 - 1 loop
    n := xmldom.item(nl,j);
    e := xmldom.makeElement(n);
    dbms_output.put_line(xmldom.getTagName(e) &#0124; &#0124; ':');
    -- get all attributes of element
    nnm := xmldom.getAttributes(n);
    if (xmldom.isNull(nnm) = FALSE) then
    len2 := xmldom.getLength(nnm);
    -- loop through attributes
    for i in 0..len2 -1 loop
    n := xmldom.item(nnm,i);
    attrname := xmldom.getNodeName(n);
    attrval := xmldom.getNodeValue(n);
    dbms_output.put(' '&#0124; &#0124;attrname&#0124; &#0124;' = '&#0124; &#0124;attrval);
    end loop;
    dbms_output.put_line(' ');
    end if;
    end loop;
    end printElementAttributes;
    begin
    -- new parser.
    p := xmlparser.newParser;
    -- set some charecterstics.
    xmlparser.setValidationMode(p,FALSE);
    xmlparser.setErrorLog(p, dir&#0124; &#0124;'/'&#0124; &#0124;errfile);
    xmlparser.setBaseDir(p,dir);
    -- parse input file
    xmlparser.parse(p,dir&#0124; &#0124;'/'&#0124; &#0124;inpfile);
    -- get document
    doc := xmlparser.getDocument(p);
    -- print document elements.
    dbms_output.put_line('The elements are: ');
    printElements(doc);
    -- print document element attributes
    dbms_output.put_line('The attributes of each element are: ');
    printElementAttributes(doc);
    -- deal with exception
    exception
    when xmldom.INDEX_SIZE_ERR then
    raise_application_error(-20120,'Index Size Error');
    when xmldom.DOMSTRING_SIZE_ERR then
    raise_application_error(-20120,'String Size Error');
    when xmldom.HIERARCHY_REQUEST_ERR then
    raise_application_error(-20120,'Hierarchy Request Error');
    when xmldom.WRONG_DOCUMENT_ERR then
    raise_application_error(-20120,'Worng Document Error');
    when xmldom.INVALID_CHARACTER_ERR then
    raise_application_error(-20120,'Invalid Character Error');
    when xmldom.NO_DATA_ALLOWED_ERR then
    raise_application_error(-20120,'No Data Allowed Error ');
    when xmldom.NO_MODIFICATION_ALLOWED_ERR then
    raise_application_error(-20120,'No Modification Allowed Error');
    when xmldom.NOT_FOUND_ERR then
    raise_application_error(-20120,'Not Found Error');
    when xmldom.NOT_SUPPORTED_ERR then
    raise_application_error(-20120,'Not Supported Error');
    when xmldom.INUSE_ATTRIBUTE_ERR then
    raise_application_error(-20120,'In Use Attribute Error');
    end domsample;
    show errors;
    Cheers
    Srianth

  • Perl manipulator Cloning

    Hi friends
    I am trying to clone the records present in the application using perl manipulator.
    To the cloned records,I need to add a new property which is a combination of 2 properties,product id and group name.Product id is an existing property and group name is a new property to be created and should be added to the cloned records as well as existing set of records.
    I am trying to use the following code in get_records() of perl manipulator but the records are being removed once processed by baseline update.
    Can,anyone please help me on this?
    Here is the code am using.Please correct if there is anything wrong.I am not much sure of the syntax.
    EX:
    Records before:
    product_id:123
    Sku_id:456
    Cat_id:888
    Records after passing through perl manipulator:
    product_id:123
    Sku_id:456
    Cat_id:888
    group_name:A
    product_key:123_A
    product_id:123
    Sku_id:456
    Cat_id:888
    group_name:B
    product_key:123_B
    product_id:123
    Sku_id:456
    Cat_id:888
    group_name:C
    product_key:123_C
    product_id:123
    Sku_id:456
    Cat_id:888
    group_name:D
    product_key:123_D
    product_id:123
    Sku_id:456
    Cat_id:888
    group_name:X
    product_key:123_X
    my @recs;
    foreach my $src ( $this->record_sources ) {
    my @productData = $src->get_records($key);
    foreach my $rec ( @productData ) {
    foreach my $groupnames(A,B,C,D,E,X){
    # clone the record
    # add product_key property to the cloned record
    # push the cloned record into @recs
    # Psudo code starts
    my $clone = $rec->clone;
    my $productId = grep { $clone ->name eq 'product_id' } @{ $clone->pvals };
    my $groupName= grep { $clone ->name eq 'group_name' } @{ $clone->pvals };
    my $productkey = $properties{"product_id"}."_".$properties{"group_name"};
    my $pval = new EDF::PVal("product_key", $productId."_".$groupName);
    $rec->add_pvals($pval);
    # Psudo code ends
    return @recs;
    Edited by: Shreyas Ram R on Nov 10, 2012 10:33 PM
    Edited by: Shreyas Ram R on Nov 10, 2012 10:37 PM
    Edited by: Shreyas Ram R on Nov 10, 2012 10:38 PM

    I'd do this a different way. If you are cloning all records in a feed, then read the records in twice - once as normal, then another set of record adapter(s). The second set goes into an XML manipulator, and this modifies the properties (see the XML reference within Developer Studio, it looks quite complicated but is actually very easy once you get your head around an XML being used as a pseudo programming language). Finally, both sets of data go into a switch join (Record Assembler > Join Type = Switch).
    Reason for this approach is it'll be a lot faster than using a perl manipulator to create these duplicates, and a lot cleaner too. Thinking about it, you may be able to read in the data once, then send it to two separate record caches, manipulate the second cache, then feed both into the switch join. Not 100% sure if that is supported, but definitely worth trying first.
    Oh, and add a record spec - always a good idea, not least because it'll give you persistence of a unique id for record lookups (R=XYZ).
    Michael

  • XML Data

    Hi,
    We are using the offline scenario for ADOBE forms integration with ABAP. The data will be in XML format.
    The steps I have done.
    1) I have converted the XSTRING to string using FM CATT_CONV_XSTRING_TO_STRING.
       CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
      EXPORTING
        IM_XSTRING        = lv_pdf
      IM_ENCODING       = 'UTF-8'
       IMPORTING
       EX_STRING         = lv_string
    2) And, used the following piece of code:-
    Remove NEW-LINE character from XML data in STRING format
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>newline IN lv_string WITH ' '.
    Make the XML envelope compliant with identity transform
    REPLACE '<?xml version="1.0" encoding="UTF-8"?>'
    IN lv_string
    WITH '<?xml version="1.0" encoding="iso-8859-1"?><asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values>'.
    *REPLACE '<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"' in lv_string WITH ''.
    REPLACE '</data>'
    IN lv_string
    WITH '</asx:values></asx:abap>'.
    And,
    CALL TRANSFORMATION ID
    SOURCE XML lv_string
    RESULT ITPDF = GIT_PDF.
    Now the error I am getting while debugging it is   XSLT: No valid XML source
    PLease help.

    Hi Shakti,
    you can use the below coding rather than doing direct XML manipulation.
    1.     Load iXML library
    Load definition of iXML library to enable use of methods of class CL_IXML
      CLASS cl_ixml DEFINITION LOAD.
    2.     Create main factory and stream factory
    *Creating the main factory for the iXML library
      lv_ixml = cl_ixml=>create( ).
    *Create a main stream factory.
      CALL METHOD lv_ixml->create_stream_factory
        RECEIVING
          rval = lv_streamfactory.
    3.     Create a stream
    Create a stream based on stream factory object created above and the excel file that was upload in step 1.
      CALL METHOD lv_streamfactory->CREATE_ISTREAM_XSTRING
        EXPORTING
          STRING = lv_xstring      "hex string obtained from step 2
        RECEIVING
          RVAL   = lv_istream.
    4.     Create new XML DOM Object
    Create a new XML document in the same main factory object created in step 4.
                  lv_obj_dom_xml = lv_ixml->create_document( ).
    Now you can use the stream object or the dom object, to retrieve  the string format and finally apply XSLT to transform to structure data.
    Thanks,
    Anand

  • Add XML Element ID to all elements as attribute

    Hi There,
    The title hopefully states what I like to get. I'm having quite some documents that are tagged, but want to add an id to all elements to allow for better XML manipulation outside on Indesign. I've been looking around a bit but seems to be not to many people ever bothered with...
    So, how do I traverse through all my XML elements, and add the element ID as attribute ?
    Thanks,
    Koen

    Hi Koen,
    Please try the below JS code. This code its working fine in InDesign CS5.5.
    var myDoc = app.activeDocument;
    try{
        var rootElement = myDoc.xmlElements.item(0);
        var linkElementList = rootElement.evaluateXPathExpression("//para");
        for(i=linkElementList.length-1; i>=0; i--){
            var myAttribute = linkElementList[i];
            myAttribute.xmlAttributes.add("idname", "idvalue");
        }catch(e){}
    thx,
    csm_phil

  • Import/Export-Tools for XML on Oracle-Lite

    We have to import/export XML-Format on the Oracle-Lite-Database.
    -Are there any tools available supporting Import and Export of XML-Data ?
    -Can someone give us a recomendation how to perform XML-Imports/Exports if there is
    no "out of the box-tool" available ?
    Thanks.

    So try. It is called Oracle XML-SQL utility and it set of classes for direct XML manipulation from/to database with HUGE amount of features. You can use it from JAVA and PL/SQL (via Java Stored Procedures). It is realy great.

  • Sidecar.xml first generation

    Johannes granted us with the excellent : http://projects.nordsueddesign.de/sidecarxml/ so that we can organize and easily manipulate elements of a large publication.
    The thing is it requires a "first time generation" which seems to have to be done manually, filling each folio name, description, etc.
    Basically, this xml manipulation is done inside the Folio Builder panel, or the Folio Producer website. And it's "invisible" to the user.
    I don't see, and think we would require, an export option once a folio is organized, to generate this very first xml.
    Second thing is this tool is hosted freely by Johannes, when i suppose it should be hosted directly by Adobe, at the very least mentionning the creator and owner of this priceless tool.
    I also saw a discussion here http://forums.adobe.com/message/4031557 and wonder : We can update the sidecar xml alone. But it seems to require to process again all the present data, images, and send again online, when it only has to change properties and the order of the pages. Shouldn't there be a way to update ONLY this meta file in the folio/different articles ? Just thinking of the process and bandwidth for a 300MB folio when a 50k xml is all that changed…
    PS : we need a "vote for ideas" option somewhere here, no ?

    thank you Franck for your nice words. I like that I could help a few people
    out with this generator that I initially only made for myself.
    now that we require renditions, sidecars are more important than ever.
    normally, I create everything in the sidecar at first, don't edit metadata
    in the folio builder panel/organizer.
    Bob Bringhurst somewhere mentioned a possible "export" function where you
    can then transfer the metadata, wich is on some roadmap.
    but the requirement of such a file is wrong at the first place. instead of
    duplicating a folio two, three, four or five times (iPad2,3, Android,
    iPhone 3,4) this should be an integrated process.
    a folio should have defined "targets" inside: iPad, retina, android. and
    when Adding an article, all required 'internal renditions' should be
    generated automaticlly by upscaling and/or picking the right alternative
    layout.
    I think this would be the correct architecture for renditions and it is an
    approach we see by many multi device workflows (especially iOS app design).
    but now I am turning this thread into a discussion about renditions.
    sidecar.XML is good, but does not cover all things, like preview files or
    article format, so there might be an improvement as well.
    the code of my sidecar generator is also available on github for everybody
    to grab, improve and host (or check changes back in).
    —Johannes
    (mobil gesendet)

  • XML - JTree  in JBuilder environment

    Basically, my task is to create an basic java-xml based forum for part of my school project. My code has to be able to compile and run in JBuilder 7 Enterprise (Windows) without installing any extra APIs or XML Parsers [ :( ]. How do I do basic xml manipulations with JTree (i.e. read write) in this limited environment? Also I would love to see some sample codes on how to load xml into JTree. I haven't seen one around. Please advice. Thanks in advanced.

    try this:
    http://java.sun.com/j2ee/1.4/docs/tutorial/examples/jaxp/dom/samples/DomEcho02.java

  • Looping through XML Items

    Hi,
    I am selecting data from tables in forms of xml like below
    xml_data VARCHAR2(32000) :=
    SELECT XMLELEMENT("form",
    xmlagg(xmlelement("item",
    XMLFOREST(form_seq_no "form_seq_no",
    patientid "patientid",
    facilityid "facilityid"
    from (SELECT
    e.form_seq_no,
    e.patientid,
    e.facilityid
    FROM hosp e
    I am using a cursor like below to get the data
    OPEN l_rc FOR xml_data;
    LOOP
    if l_rc%notfound then
    EXIT ;
    end if;
    FETCH l_rc
    INTO l_xml;
    update hosp set transmit_date = sysdate;
    end loop;
    CLOSE l_rc;
    The above query returns all items in the table....I am trying to limit the number of records returned based on limit I pass...If the user enters 2, only two items from the node has to be returned. I am not having a clue on how to do this. It would be great if any one can help me...

    Thank you both for the replies. I am able to get the data based on the limit I pass...I have another question.
    Once the xml doc result is returned or once the select operation is performed and cursor data is fetched into a xmltype variable, I am updating a table's data with the current date...But I have to update the table based on the form_seq_no in the result xml doc...If the result set has three records, then it would have three different form_seq_no. Right now I am doing like below
    SELECT XMLELEMENT("form",
    xmlagg(xmlelement("item",
    XMLFOREST(form_seq_no "form_seq_no",
    patientid AS "patientid",
    facilityid AS "facilityid" ))))
    INTO l_xml
    from (SELECT
    e.form_seq_no,
    e.patientid,
    e.facilityid
    FROM hosp e
    ORDER BY e.form_seq_no
    WHERE ROWNUM < p_num_of_rows;
    I am using a cursor like below to get the data
    OPEN l_rc FOR xml_data;
    LOOP
    if l_rc%notfound then
    EXIT ;
    end if;
    FETCH l_rc
    INTO l_xml;
    This is the update I am doing, based on the result set I pasted below....But I get an error that extractValue can return only one child...I am at loss to know how to loop through the result set and perform the update...
    update hosp set transmit_date = sysdate where form_seq_no = extractValues(l_xml, 'form/item/form_seq_no);
    end loop;
    CLOSE l_rc;
    If I give rownum <3 , I get 3 rows, the result set might look like as follows:
    <form>
    <item>
    <form_seq_no>1</form_inst_seq_no>
    <patientid>21</patientid>
    <facilityid>23</facilityid>
    </item>
    <item>
    <form_seq_no>2</form_inst_seq_no>
    <patientid>212</patientid>
    <facilityid>233</facilityid>
    </item>
    <item>
    <form_seq_no>3</form_inst_seq_no>
    <patientid>213</patientid>
    <facilityid>234</facilityid>
    </item>
    I am new to this xml and xml manipulation in oracle...What are the concepts I would have to know in order to achieve my task above? And Right now I have this book called "Oracle Database 11g The Complete Reference" by Kevin Loney, but I neither find any elaborate explanations nor examples. What other books would anyone suggest to learn more on oracle and pl/sql.
    Thanks a lot in advance.

  • Saving xml DOM on disk through JAXP

    I am using JAXP for my xml manipulations. I want to save the DOM in some file on hard disk. Is there anyway in JAXP through which we can save xml DOM in some file.
    Also can i get the xml DOM source in JAXP.

    - this question is asked each and every day in this forum (yes, there is a search feature available)
    - this question is treated in the online tutorial available in the current website,
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.transform(new DOMSource(doc), new StreamResult(new FileOutputStream("c:/temp/mydata.xml")));have you ever heard of d�j� vu?

  • DocumentBuilderFactoryImpl not found Printing Mac OS X

    OS - Mac OS X 10.3.6
    Java - 1.4.1_01
    I'm attempting to print a report generated by Jasper Reports in a Java Application. I select the print button in the frame, and the print dialog for Mac OS X appears. I select "Print" and the following exception appears in the console ...
    Exception in thread "Thread-1" javax.xml.parsers.FactoryConfigurationError:
    Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
            at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:99)
            at net.sf.jasperreports.engine.util.JRStyledTextParser.<init>(JRStyledTextParser.java:145)
            at net.sf.jasperreports.engine.export.JRGraphics2DExporter.<init>(JRGraphics2DExporter.java:152)
            at net.sf.jasperreports.engine.print.JRPrinterAWT.print(JRPrinterAWT.java:263)
    JavaAWT: Assertion failure: Java exception thrown
    JavaAWT: File src/macosx/native/apple/awt/util/AWTException.m; Line 40
    JavaAWT: Assertion failure: _javaException
    JavaAWT: File src/macosx/native/apple/awt/util/AWTException.m; Line 48I discovered the following in the API about the FactoryConfigurationError which is seen in the stack trace..
    public class FactoryConfigurationError extends Error
    Thrown when a problem with configuration with the Parser Factories exists. This error will typically be thrown when the class of a parser factory specified in the system properties cannot be found or instantiated.
    I have included the following in the Classpath in my Manifest:
    jasperreports-0.6.2.jar itext-1.01.jar commons-logging-1.0.2.jar commons-beanutils-1.5.jar commons-digester-1.3.jar commons-collections-2.1.jar xerces.jar
    And I had been using the following System property for the parser...
    System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");I have discovered though that Mac OS X JRE version 1.4.1 (bundled within the operating system itself) contains the Crimson implementation of JAXP 1.2. As indicated in this thread:
    http://forum.java.sun.com/thread.jspa?forumID=34&messageID=2031200&threadID=448102
    This may be what is causing my problem. Although the xerces jar is on the classpath, it may be that the Crimson is being used or should be used instead(?) So I tried setting the parser to use the Crimson Driver with no success..
    System.setProperty("org.xml.sax.driver", "org.apache.crimson.parser.XMLReaderImpl");Also unsuccessfully I tried explicitly setting the System property for the DocumentBuilderFactory as suggested here:
    http://developer.apple.com/documentation/WebObjects/XML_Serialization/Transformation/chapter_5_section_4.html
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
    "org.apache.crimson.jaxp.DocumentBuilderFactoryImpl");But the same exception as previously posted is thrown.
    I have no troubles printing reports in the same manner on Windows or Linux. Usuing the same Manifest, classpath, jar files etc..I have only seen the error on Mac OS X. Any help would be appreciated. Thanks so much.

    I agree with your observation: removing xerces.jar from the classpath fixes the printing problem, but the XML parsing speed is something like 4-5 times slower (1.4.2_05, 10.3.7, PowerBook 1.5GHz, 1Gb) with the default XML parser than using Apache DOMParser explicitely... my application can print, but the rest of the XML manipulations is terribly slower. Great! : (
    --j                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for