XML data storage - How to handle symbol ' inside xml data from java code

Hi
I'm trying to store XML data in Oracle XML DB 10gR2 both through SQL and JAVA .
I have a simple test table called xmltable with a primary key and a XMLType column
My sql is:
insert into xmltable values ('020', sys.XMLType.CreateXML(
'<?xml version="1.0"?>
<Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001">
<DescriptionMetadata id="2005">
<LastUpdate>2006-10-19T12:48:22.null+01:00</LastUpdate>
<Creator/>
<CreationTime>2006-10-19T12:48:22.null+01:00</CreationTime>
<Instrument>
<Tool>
<Name>LAS MPEG-7 Services v1.0</Name>
</Tool>
</Instrument>
</DescriptionMetadata>
<Description xsi:type="urn:ContentEntityType" xmlns:urn="urn:mpeg:mpeg7:schema:2001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MultimediaContent xsi:type="urn:ImageType">
<Image id="2005">
<MediaInformation>
<MediaProfile>
<MediaFormat>
<Content/>
<Medium href="urn:mpeg:MPEG7MediumCS:2.1.1"/>
<FileFormat href="urn:mpeg:IPTCMimeTypeCS:image/jpeg"/>
<FileSize>2782043</FileSize>
<VisualCoding>
<Format colorDomain="color" href="urn:mpeg:MPEG7VisualCodingFormatCS:1"/>
<Frame height="11604" width="8676"/>
</VisualCoding>
</MediaFormat>
</MediaProfile>
</MediaInformation>
<MediaLocator>
<MediaUri>oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.MEDIA_IMAGE/IMAGE[IMG_ID=2005]</MediaUri>
</MediaLocator>
<TextAnnotation>
<FreeTextAnnotation>B?miy?n and Shikari areas</FreeTextAnnotation>
</TextAnnotation>
<Semantic>
<SemanticBaseRef href="oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.OBJECT_XML/MPEG7_SB#/mpeg7:Mpeg7/mpeg7:DescriptionMetadata[@id='65']"/>
<SemanticBaseRef href="oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.OBJECT_XML/MPEG7_SB#/mpeg7:Mpeg7/mpeg7:DescriptionMetadata[@id='148']"/>
</Semantic>
</Image>
</MultimediaContent>
</Description>
</Mpeg7>
Unfortunately I'm facing problem with the symbol ' at the tags:
<SemanticBaseRef href="oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.OBJECT_XML/MPEG7_SB#/mpeg7:Mpeg7/mpeg7:DescriptionMetadata[@id='65']"/>
<SemanticBaseRef href="oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.OBJECT_XML/MPEG7_SB#/mpeg7:Mpeg7/mpeg7:DescriptionMetadata[@id='148']"/>
If I tried with double ' (not '' ) it works with SQL through SQLPLUS but not with java. Indeed I have to store the data through my application
In java I get java.sql.SQLException: ORA-19102
Many thanks in advance,
Evanela

Thanks for your answer. I downloaded the JDBC AddressBook application and I found it very usefull. I was able to populate a datalist from a datasource and show it in my application. My problem still remains in the sense that I am unable to show the KPI data in a "custom node" meaning I woul like not only to extract directly the database record to a datalist object but also put the information of a single record in a textbok and a gauge and keep control of paging. I think this is done with the parser in the other examples but I can not figure out how to do it with MySQL and the new Desktop screen designer. Should I use a clip object? or is that managed already by the desktop screen designer? or where can I find an example with the functionality I need?.

Similar Messages

  • How to send SMS ( Short Message Service ) from java code

    Hi
    How to send SMS ( Short Message Service ) from java code.
    Thanks
    Gaurav

    Do you need to receive SMS? If you need to receive SMS, you will need to host your own GSM device or modem so that people can send you SMS.
    If not, you can just use internet SMS gateways like clickatell as mentioned above will do the work, and post to them by HTTP, XML or email. The cost is about 6-8 cents per SMS. There are cheaper services, but not always reliable. If you need to host your own GSM device, you can use software like http://www.kannel.org (GPL Open Source) or http://www.visualgsm.com. Alternatively, you may obtain a shortcode from your Telco - but these come with monthly subscription of maybe one or two hundreds.
    Regards,
    Joshua
    <SMS Gateway>@Expert

  • How to execute solaris lpd printing command from java code

    hi folk,
    I want to print a post script file on a network printer (my java code will receive the Printer's IP Address and the filename ) , i'm using the solaris lpd printing command :
    lpadmin -p banana_ps -o protocol=bsd,dest=IP -v /dev/null
    -m netstandard -T PS -I postscript
    my question is how execute this command from the java code :)
    i really appreciate ur advices

    Hi,
    See RunTime.getRuntime ().exec (...).
    Hope that help,
    Jack

  • How to click a HTML page button from Java code?

    Know the HTML page name and the button id in this page, how to click the button automaticly in java code(Like in awt or swing)?

    ukkus wrote:
    Hi,
    Thank for the quick reply,
    It will be very helpful if you can tell me how can we do this, I am not able to get how to do the same, with the link that you have provided.You haven't even had time to read it yet.
    >
    Actually main scenario is:
    I have to RUN a JSP report which will call this script. That JSP report and script is in UNIX server. Can you please explain how to perform this task.Running this from a JSP is an even worse programming practice than running it from a standalone application.

  • How do I invoke another s/w from java code(urgent)

    Hi all,
    My code looks like this :
    Runtime rt =Runtime.getRuntime();
    String command = "~/tts/bin/mbrola" +" ~/tts/mbrola/us2 " + " /home/dir1/dir2/final/temp.pho "+
    " - | ~/tts/bin/mbrplay -";
    rt.exec(command );
    Whenever I ru n this code thru java , I get an error that this command was not found but am able to run it in my unix terminal. Would anyone have any clue as to why this is happening.
    Thanks
    Sohini

    Hi all,
    My code looks like this :
    Runtime rt =Runtime.getRuntime();
    String command = "~/tts/bin/mbrola" +"
    la" +" ~/tts/mbrola/us2 " + "
    /home/dir1/dir2/final/temp.pho "+
    " - | ~/tts/bin/mbrplay -";
    rt.exec(command );
    Whenever I ru n this code thru java , I get an error
    that this command was not found but am able to run it
    in my unix terminal. Would anyone have any clue as to
    why this is happening.
    Thanks
    SohiniHi,
    I guess that you're trying to run command WITH arguments, aren't you?
    So, you have to do it this way(just verify arguments):
        Runtime rt =Runtime.getRuntime();
        String command[] = {"~/tts/bin/mbrola", "la", "~/tts/mbrola/us2",
                                              "/home/dir1/dir2/final/temp.pho",  "-", " | ~/tts/bin/mbrplay", "-"}
        rt.exec(command);(making PROGRAM and ARGUMENTS an array - EACH argument SEPARATELY(I don't know their exact number in your script ))
    Hope to help,
    SHW

  • How to handle dbms_xmldom with no data values.(no_data_found error in dom)

    hi,
    i have below block,
    DECLARE
    doc dbms_xmldom.DOMDocument;
    node dbms_xmldom.DOMNode;
    elem dbms_xmldom.DOMElement;
    cur_node dbms_xmldom.DOMNode;
    root_elem_data dbms_xmldom.DOMElement;
    root_elem_tab dbms_xmldom.DOMElement;
    root_node_data dbms_xmldom.DOMNode;
    mode_elmn dbms_xmldom.DOMElement;
    mode_node dbms_xmldom.DOMNode;
    mode_text dbms_xmldom.DOMText;
    doc1 DBMS_XMLDOM.DOMDOCUMENT;
    root_node_data1 DBMS_XMLDOM.DOMNODE;
    child_document DBMS_XMLDOM.DOMDOCUMENT;
    child_rootnode DBMS_XMLDOM.DOMNODE;
    V_CLOB CLOB;
    v_doc CLOB;
    v_EMP CLOB;
    v_output_filename VARCHAR2(300) := 'SPOOL_DIR/'||'EMP_XML_FILE.xml';
    l_xmltype XMLTYPE;
    BEGIN
    doc := dbms_xmldom.newDOMDocument;
    node := dbms_xmldom.makeNode(doc);
    dbms_xmldom.setversion(doc, '1.0');
    dbms_xmldom.setCharset(doc, 'UTF8');
    elem := dbms_xmldom.createElement(doc, 'PartnerInfo');
    dbms_xmldom.setAttribute(elem,'xmlns','EMP');
    cur_node := dbms_xmldom.appendChild(node, dbms_xmldom.makeNode(elem));
    mode_elmn := dbms_xmldom.createElement(doc, 'EMPLOYEE');
    mode_node := dbms_xmldom.appendChild(cur_node,dbms_xmldom.makeNode(mode_elmn));
    BEGIN
    SELECT value(e) INTO l_xmltype
    FROM TABLE(XMLSequence(Cursor(SELECT * FROM EMP1 where EMPNO=7501))) e;
    child_document := DBMS_XMLDOM.newDOMDocument(l_xmltype);
    root_node_data1 := dbms_xmldom.importNode(doc,dbms_xmldom.makeNode(dbms_xmldom.getDocumentElement(child_document)),TRUE);
    root_node_data1 := DBMS_XMLDOM.appendChild(root_node_data, root_node_data1);
    EXCEPTION
    WHEN OTHERS THEN
    Dbms_Output.Put_Line('Error in SELECT stmt(UC_PARTNER_MS):::'||'error::'||SQLERRM);
    END;
    dbms_lob.createtemporary(v_doc, true);
    dbms_xmldom.writeToClob(doc,v_doc,'UTF8');
    v_EMP:= v_doc;
    dbms_xmldom.writeToFile(DOC,v_output_filename,'UTF8');
    dbms_xmldom.freeDocument(doc);
    --Dbms_Output.Put_Line('THE OUTPUT IS::'||V_EMP);
    EXCEPTION
    WHEN OTHERS THEN
    Dbms_Output.Put_Line('Error in SELECT stmt(UC_PARTNER_MS):::'||'error::'||SQLERRM);
    END;
    The xml file is 'EMP_XML_FILE.xml'
    <empno>U++kYmcVuGchxbh+++++++++++++++1+</empno>
    <empname>J</empname>
    suppose the empno 7501 is not available in our emp table,
    i got error
    ORA-03113: end-of-file on communication channel
    how to handle xmldom with no data values.
    by
    siva

    hi,
    please give the solution
    by
    siva

  • I have made a burn folder with photos exported from I-photo.  It now shows in information, that the date is created and modified is different from the original digitized date.  How can I get the original date to show in the info from Finder?

    I have made a burn folder with photos exported from I-photo.  It now shows in information, that the date  created and modified is different from the original digitized date.  How can I get the original date to show in the info from Finder?

    The Finder reports File information. The date and time of the photo are in the Photo's Exif metadata. The Finder has no awareness of this. All photos apps on any system do.
    Regards
    TD

  • How to modify an existing xml file from java code.

    Hi
    I have worked on creating a new xml file from java code using xmlbeans.But if i try to modify an already existing file using java code I am unable to get errorfree xmlfile.
    For example if xml file(studlist.xml) is as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    Now suppose i have set name to victor using student.setName,
    and set age to 20 using setAge from javacode,
    the new xml file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    <Student>
              <Name>victor</Name>
              <Age>20</Age>
         </Student>
    As observed this is not a valid xml file.But how can i modify without any errors?

    I know it's an old post, but I found this while doing a google search for something else, and don't like to leave it un-aswered
    Just in case anyone has a similar problem... In this case the new elements have been appended outside of the root element
    What you need to do is first get the root element and then append the new children to that, there are several ways of getting the root element, which depend on what you want to do with the elements you get back here's a simple (incomplete) way.
    // gets the root element of the specified file (code not shown)
    Element rootElement= new SAXReader().read(file).getRootElement();Then just append the new elements as below (this is non-generic code and would need to be modified for your situation)
    // write a new student element
    Element student = document.createElement("Student");  // creates the new student
    rootElement.appendChild(student); // ***appends it to the root element***
    Element name = document.createElement("Name"); // creates the name element
    name.appendChild(document.createTextNode("Fred")); // adds the name text to the name element
    student.appendChild(name); // appends the name to the student
    Element age= document.createElement("Age"); // creates the age element
    age.appendChild(document.createTextNode("26")); // adds the age text to the age element
    student.appendChild(age); // appends the name to the studentThen flush ya buffers or whatever and write the file
    Edited by: Dream-Scourge on Apr 23, 2008 11:10 AM

  • I upgraded to the new IOS, but lost data and apps. When I try and restore the only backup I see is the one made AFTER the lost data. How can I access an older backup from the cloud?

    I upgraded to the new IOS, but lost data and apps. When I try and restore the only backup I see is the one it made AFTER the lost data. How can I access an older backup from the cloud?

    Why don't you talk to apple and find out if backup exists? That conversation with apple will stop your guessing.

  • In the Date Picker, How can I default to select * dates if the user does ..

    In the Date Picker, How can I default to select * dates if the user does not select a date.
    Thanks,
    Doug

    Doug,
    Now lets say l want everythingCould you post some sample data and the output that you want to get..? It would be much easy to understand the requirements...
    When you mean everything, I am assuming you need all possible dates possible between date1 and date2.
    you can use... (from asktom.oracle.com).
      1  select to_date('12-jan-2009','DD-MON-YYYY') + rownum -1
      2    from ALL_OBJECTS
      3    where rownum <= (to_date('20-jan-2009','dd-mon-yyyy') -
      4*                     to_date('12-jan-2009','DD-MON-YYYY') +1 )
    sql> /
    TO_DATE('
    12-JAN-09
    13-JAN-09
    14-JAN-09
    15-JAN-09
    16-JAN-09
    17-JAN-09
    18-JAN-09
    19-JAN-09
    20-JAN-09
    9 rows selected.
    For your case, since you have date1 and date2...
    select to_date(:p12_date1,'DD-MON-YYYY') + rownum -1
      from ALL_OBJECTS
      where rownum <= (to_date(:p12_date2,'dd-mon-yyyy') -
                        to_date(:p12_date1,'DD-MON-YYYY') +1 )Should work.. in my opinion...Haven't tested the second one in Apex .
    Is this what you were looking for ..?? If not, please elaborate...
    Thanks,
    Rajesh.

  • When the PC System timing runs as per normal, reaches 0000hrs - a new date. How to Auto re-execute the VI from its first sequence order?

    When the PC System timing runs as per normal, reaches 0000hrs - a new date. How to Auto re-execute the VI from its first sequence order?

    Duplicate Post

  • Generation of xml file from java code

    hi,
    I want to manipulate data in a xml file with java code.I have read data from xml file and also changed it. But i am unable to covert it again in xml file from java code. Can you please tell me how i can do this?

    Let me know which parser are you using currently for reading xml files so that i assist you. For now, you can refer to STAX Parser API under this link
    http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP3.html

  • How to trigger tree table from java code

    Trying to trigger tree table from java code, using :
    AdfFacesContext.getCurrentInstance().addPartialTarget(treeTableComponent);
    But its not working. Am i using the correct approach?

    Sorry for the incomplete information,
    I have a tree table in a region and that region i am including inside a jspx file. In the region i have one popup and based on the input taken from the popup i want to trigger the table to show the data.
    For that i am trying :
    FacesContext context = FacesContext.getCurrentInstance();
    UIComponent component = findComponent( context.getViewRoot(),"treeTableID");
    if(component != null){
    AdfFacesContext.getCurrentInstance().addPartialTarget(component);
    public static UIComponent findComponent(UIComponent base, String id)
    if (id.equals(base.getId()))
    return base;
    UIComponent children = null;
    UIComponent result = null;
    Iterator childrens = base.getFacetsAndChildren();
    while (childrens.hasNext() && (result == null))
    children = (UIComponent) childrens.next();
    if (id.equals(children.getId()))
    result = children;
    break;
    result = findComponent(children, id);
    if (result != null)
    break;
    return result;
    Model is getting data before i use : AdfFacesContext.getCurrentInstance().addPartialTarget(component);
    But table is not calling getData() in model to show the populated data on UI.

  • How am i supposed to prevent sm from pasting code in my JSP page?

    Hello,
    as i was testing my JSP page i noticed that when sm places code in an input box , it seems that the page is affected by that.
    Well i have a very simple form like:
    <form  style="text-align:left" method="POST" name="edit" action="Edit" >
    <input type="text" name="year" size="5" maxlength ="50" value="<%= convertdate.ReturnYear((resultset.getString(19)) %>">
    <input type="submit" name="Submit" value="Store Data" >
    </form>i noticed that when i was placing code in the button year of the form like:
    out.println("<HTML><HEAD><TITLE> " + "Error in PAGE BLAH BLAH BLAH" + " </TITLE></HEAD><BODY>");my website was affected by that and some pages looked different and couldn't display data from the database, although the data existed in the db.
    What am i supposed to do? How am i supposed to prevent a user from inserting code in inputs of a form?
    Also, sometimes when i was pasting code, some SQL exceptions appeared saying : Data too long for field etc.
    The weird was that the data was in the limit. I'm very worried about this problem because the sql exceptions show the names of my tables and i think
    that this is dangerous for malicious attacks in the website.
    Thanks, in advance!
    Edited by: g_p_java on Sep 5, 2009 5:09 PM
    Edited by: g_p_java on Sep 5, 2009 5:14 PM
    Edited by: g_p_java on Sep 5, 2009 5:15 PM

    smogura.eu wrote:
    All notices are important & how to say... you can place Java code in JSP, but in commercial job you will need to find new job.
    Well i'm not actually working somewhere, i'm student and i have to make this project.
    It's the first time I use JSP, servlets etc, so that's why i find a difficulty in using them.
    Why your pages are messed? If you put HTML code in db, rendered page is like
    ..="50" value="<HTML><HEAD...{code}
    this will prevent browser to render page properly. Well i was actually pasting some data in order to check if the data is too long for the field and afterwards the page changed and many fields disappeared...
    There are two ways to prevent inserting code, in your JSP, and you need use it, as no separating view logic, data acquisition from page will not prevent this error
    1. You need disallow user entering ", <, ' etc...., best way by validating input on server side, by this will prevent user from entering all texts, or
    2. You need replace all HTML special char with their HTML codes when rendering, the simplest way
    convertdate.ReturnYear((resultset.getString(19)).replace("\"", "&#34'").replace(...).replace(...)
    {code}
    You must use this in back logic.May you please elaborate on that, you mention that i shall replace the year with "&#34'",
    What is that "&#34'"?
    and why do you use 3 "replaces"?
    About prepared statements.
    Preparation will not only prevent you from SQL injections, but can speed up application, if your driver uses statement caching.
    Why after creating prepared statement, you then create normal statement, in your example code?I hadn't noticed that, thanks.I 'll change them. But Statement is less secure than PrepareStatement?
    Thanks, in advance!

  • How to run Executables or .bat files from Java?

    Hi!
    I need to open a Web Browser from Java App.
    Please, help me to do this without calling JNI
    -or-
    provide me with sample which works with
    Runtime.execute() method.
    I have done full permission:
    grant
         permission java.security.AllPermission "","";
    };Thank You in advance!

    To run any command from java code, the method is
    Runtime.getRuntime().exec( myCommandString )
    Where, myCommandString is something like "/full/pathname/command".
    If the pathname contains spaces, e.g. "c:\program files\windows\notepad", then enclose it in quotes within the quoted string. Or pre-tokenize them into elements of an array and call exec(String[] cmd) instead of exec(String cmd).
    From JDK1.3 there are two new overloaded Runtime.exec() methods. These allow you to specify starting directory for the child process.
    Note, there is a gotcha associated with reading output from commands. When the runtime exec's the process, it passes to it 3 streams, for stdin, stdout, and stderr; the out and err are buffered but the buffer size isn't very big. When your process runs, it reads (if needed) from in, and writes to out and err.
    If it doesn't write more than the buffer-size, it can run to completion.
    But if it tries to write more data to one or the other stream than the buffer can hold, the write blocks, and your process hangs, waiting for you to empty the buffer so it can write some more.
    So after the exec call, get the streams, and read from them in a loop until they both hit end-of-stream (don't block on either one, just read whatever is available from each, each loop iteration).
    Then when the streams have ended, call the process.waitFor() method to let it finish dying.
    Now, here is a code snippet how you achieve this.
    String strCommand = "cmd.exe /c " + strCommand;
    boolean bWait = true;
    //execute the command
    try
         Runtime r = Runtime.getRuntime();
         Process pr = r.exec(strCommand);
         Process pr = r.exec(callAndArgs);
         BufferedInputStream bis =new BufferedInputStream(pr.getInputStream ());
         int c=0;
         /** Outlet for IO for the process **/
         while (c!=-1)
              c=bis.read();
         /**Now wait for the process to get finished **/
         if(bWait == true)
              pr.waitFor();
              pr.destroy();
    catch(Exception e)
         System.out.println("Could not execute process " + strCommand);
         return(false);

Maybe you are looking for