MakeProcessingInstruction PL/SQL DOM API for XMLType

Does anyone have a code snippet on how to use makeProcessingInstruction()(PL/SQL DOM API for XMLType)
Description
Casts a given DOMNode to a DOMProcessingInstruction, and returns the
DOMProcessingInstruction.
Syntax
FUNCTION makeProcessingInstruction( n DOMNode)
RETURN DOMProcessingInstruction;
Thanks in advance

pieter,
I think you would want to use xmlview. A schema can be attached to the view definition, thereby creating a schema-based xmltype view.
ie create view nameview of xmltype
xmlschema "nameschema.xsd" ELEMENT "namehere"
as
select
xmlelement ("....xmlforest(....(select xmlagg(xmlelement(....
or something similar.
see link for more information regarding xml views.
http://www.vldb.org/conf/2003/papers/S30P02.pdf

Similar Messages

  • Loading PL/SQL LDAP API for 9i database

    hi,
    i need to connect with ldap and found out about dbms_ldap
    package. in the doc, it says that need to load it by using
    a script called catldap.sql that is located in the $ORACLE_HOME/rdbms/admin directory. i am using oem SQL plus and connected as sysdba. after i execute, it shows me this error:
    SP2-0738: Restricted command "@@ (START)" not available
    SP2-0738: Restricted command "@@ (START)" not available
    SP2-0738: Restricted command "@@ (START)" not available
    pls help.

    The Member Feedback forum is for suggestions and feedback for OTN Developer Services. This forum is not monitored by Oracle support or product teams and so Oracle product and technology related questions will not be answered. We recommend that you post this thread to the SQL*Plus forum. The URL is:
    iSQL*Plus [ARCHIVE]

  • PL/SQL DOM API (dbms_xmldom) -- XML-Schema support ?

    hello,
    I have a very large xml-schema, and al my data is in a relational database.
    I want to create a xml-document according the xml-schema, with a lot of data out of de relational database.
    I think I have to user this dbms_xmldom package, but is their a way to start with the schema. To Create the structure of the document ??
    I read in the oracle documentation that their is xml-schema support, but I can't find how I have to use this.
    Pieter

    pieter,
    I think you would want to use xmlview. A schema can be attached to the view definition, thereby creating a schema-based xmltype view.
    ie create view nameview of xmltype
    xmlschema "nameschema.xsd" ELEMENT "namehere"
    as
    select
    xmlelement ("....xmlforest(....(select xmlagg(xmlelement(....
    or something similar.
    see link for more information regarding xml views.
    http://www.vldb.org/conf/2003/papers/S30P02.pdf

  • How can I analyse corba idl files just as xml files are analysed by dom api

    I want to analyse and control corba idl files just like xml. We know that xml can be controled with org.omg.dom api, every element in xml can be read and write.But now, I want to realize a small program which can read every element in idl (eg. module, interface, methord) and auto-produce a element-tree. How can I do? Have dom api for idl files?

    You need a parser - try Antlr (http://www.antlr.org/). I believe it comes with an IDL grammar.
    Chuck

  • Java API for running entire ".sql" files on a remote DB ( mySQL or Oracle)?

    Hi,
    Would anyone happen to know if there's a java API for executing entire ".sql" files (containing several different SQL commands), on a remote database server ?
    It's enough if the API works with MySQL and/or Oracle.
    Just to demonstrate what i'm looking for:
    Suppose you've created sql file "c:/test.sql" with several script lines:
    -- test.sql:
    insert into TABLE1 values(3,3);
    insert into TABLE1 values(5,5);
    create table TABLE2 (name VARCHER) ENGINE innoDB; -- MYSQL specific
    Then the java API should look something like:
    // Dummy java code:
    String driver="com.mysql.jdbc.Driver";
    String url= "jdbc:mysql://localhost:3306/myDb";
    SomeAPI.executeScriptFile( "c:/test.sql", driver, url);
    Thanks.

    No such a API, but it's easy to parse all sqls in a file, then run those command:
    For instance:
    import java.sql.*;
    import java.util.Properties;
    /* A demo show how to load some sql statements. */
    public class testSQL {
    private final static Object[] getSQLStatements(java.util.Vector v) {
    Object[] statements = new Object[v.size()];
    Object temp;
    for (int i = 0; i < v.size(); i++) {
    temp = v.elementAt(i);
    if (temp instanceof java.util.Vector)
    statements[i] = getSQLStatements( (java.util.Vector) temp);
    else
    statements[i] = temp;
    return statements;
    public final static Object[] getSQLStatements(String sqlFile) throws java.
    io.IOException {
    java.util.Vector v = new java.util.Vector(1000);
    try {
    java.io.BufferedReader br = new java.io.BufferedReader(new java.io.
    FileReader(sqlFile));
    java.util.Vector batchs = new java.util.Vector(10);
    String temp;
    while ( (temp = br.readLine()) != null) {
    temp = temp.trim();
    if (temp.length() == 0)
    continue;
    switch (temp.charAt(0)) {
    case '*':
    case '"':
    case '\'':
    // System.out.println(temp);
    break; //Ignore any line which begin with the above character
    case '#': //Used to begin a new sql statement
    if (batchs.size() > 0) {
    v.addElement(getSQLStatements(batchs));
    batchs.removeAllElements();
    break;
    case 'S':
    case 's':
    case '?':
    if (batchs.size() > 0) {
    v.addElement(getSQLStatements(batchs));
    batchs.removeAllElements();
    v.addElement(temp);
    break;
    case '!': //Use it to get a large number of simple update statements
    if (batchs.size() > 0) {
    v.addElement(getSQLStatements(batchs));
    batchs.removeAllElements();
    String part1 = temp.substring(1);
    String part2 = br.readLine();
    for (int i = -2890; i < 1388; i += 39)
    batchs.addElement(part1 + i + part2);
    for (int i = 1890; i < 2388; i += 53) {
    batchs.addElement(part1 + i + part2);
    batchs.addElement(part1 + i + part2);
    for (int i = 4320; i > 4268; i--) {
    batchs.addElement(part1 + i + part2);
    batchs.addElement(part1 + i + part2);
    for (int i = 9389; i > 7388; i -= 83)
    batchs.addElement(part1 + i + part2);
    v.addElement(getSQLStatements(batchs));
    batchs.removeAllElements();
    break;
    default:
    batchs.addElement(temp);
    break;
    if (batchs.size() > 0) {
    v.addElement(getSQLStatements(batchs));
    batchs.removeAllElements();
    br.close();
    br = null;
    catch (java.io.FileNotFoundException fnfe) {
    v.addElement(sqlFile); //sqlFile is a sql command, not a file Name
    Object[] statements = new Object[v.size()];
    for (int i = 0; i < v.size(); i++)
    statements[i] = v.elementAt(i);
    return statements;
    public static void main(String argv[]) {
    try {
    String url;
    Object[] statements;
    switch (argv.length) {
    case 0: //Use it for the simplest test
    case 1:
    url = "jdbc:dbf:/.";
    if (argv.length == 0) {
    statements = new String[1];
    statements[0] = "select * from test";
    else
    statements = argv;
    break;
    case 2:
    url = argv[0];
    statements = getSQLStatements(argv[1]);
    break;
    default:
    throw new Exception(
    "Syntax Error: java testSQL url sqlfile");
    Class.forName("com.hxtt.sql.dbf.DBFDriver").newInstance();
    //Please see Connecting to the Database section of Chapter 2. Installation in Development Document
    Properties properties = new Properties();
    Connection con = DriverManager.getConnection(url, properties);
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    //Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
    // stmt.setMaxRows(0);
    stmt.setFetchSize(10);
    final boolean serializeFlag = false;//A test switch to serialize/deserialize the resultSet
    ResultSet rs;
    for (int i = 0; i < statements.length; i++) {
    if (statements[i] instanceof java.lang.String) {
    String temp = (java.lang.String) statements;
    switch (temp.charAt(0)) {
    case 'S':
    case 's':
    case '?':
    System.out.println(temp);
    rs = stmt.executeQuery(temp);
    if (serializeFlag) {
    // serialize the resultSet
    try {
    java.io.FileOutputStream fileOutputStream = new
    java.io.FileOutputStream("testrs.tmp");
    java.io.ObjectOutputStream
    objectOutputStream = new java.io.
    ObjectOutputStream(fileOutputStream);
    objectOutputStream.writeObject(rs);
    objectOutputStream.flush();
    objectOutputStream.close();
    fileOutputStream.close();
    catch (Exception e) {
    System.out.println(e);
    e.printStackTrace();
    System.exit(1);
    rs.close(); //Let the CONCUR_UPDATABLE resultSet release its open files at once.
    rs = null;
    // deserialize the resultSet
    try {
    java.io.FileInputStream fileInputStream = new
    java.io.FileInputStream("testrs.tmp");
    java.io.ObjectInputStream objectInputStream = new
    java.io.ObjectInputStream(
    fileInputStream);
    rs = (ResultSet) objectInputStream.
    readObject();
    objectInputStream.close();
    fileInputStream.close();
    catch (Exception e) {
    System.out.println(e);
    e.printStackTrace();
    System.exit(1);
    ResultSetMetaData resultSetMetaData = rs.
    getMetaData();
    int iNumCols = resultSetMetaData.getColumnCount();
    for (int j = 1; j <= iNumCols; j++) {
    // System.out.println(resultSetMetaData.getColumnName(j));
    /* System.out.println(resultSetMetaData.getColumnType(j));
    System.out.println(resultSetMetaData.getColumnDisplaySize(j));
    System.out.println(resultSetMetaData.getPrecision(j));
    System.out.println(resultSetMetaData.getScale(j));
    System.out.println(resultSetMetaData.
    getColumnLabel(j)
    + " " +
    resultSetMetaData.getColumnTypeName(j));
    Object colval;
    rs.beforeFirst();
    long ncount = 0;
    while (rs.next()) {
    // System.out.print(rs.rowDeleted()+" ");
    ncount++;
    for (int j = 1; j <= iNumCols; j++) {
    colval = rs.getObject(j);
    System.out.print(colval + " ");
    System.out.println();
    rs.close(); //Let the resultSet release its open tables at once.
    rs = null;
    System.out.println(
    "The total row number of resultset: " + ncount);
    System.out.println();
    break;
    default:
    int updateCount = stmt.executeUpdate(temp);
    System.out.println(temp + " : " + updateCount);
    System.out.println();
    else if (statements[i] instanceof java.lang.Object[]) {
    int[] updateCounts;
    Object[] temp = (java.lang.Object[]) statements[i];
    try {
    for (int j = 0; j < temp.length; j++){
    System.out.println( temp[j]);
    stmt.addBatch( (java.lang.String) temp[j]);
    updateCounts = stmt.executeBatch();
    for (int j = 0; j < temp.length; j++)
    System.out.println((j+1)+":"+temp[j]);
    for (int j = 0; j < updateCounts.length; j++)
    System.out.println((j+1)+":" +updateCounts[j]);
    catch (java.sql.BatchUpdateException e) {
    updateCounts = e.getUpdateCounts();
    for (int j = 0; j < updateCounts.length; j++)
    System.out.println((j+1)+":"+updateCounts[j]);
    java.sql.SQLException sqle = e;
    do {
    System.out.println(sqle.getMessage());
    System.out.println("Error Code:" +
    sqle.getErrorCode());
    System.out.println("SQL State:" + sqle.getSQLState());
    sqle.printStackTrace();
    while ( (sqle = sqle.getNextException()) != null);
    catch (java.sql.SQLException sqle) {
    do {
    System.out.println(sqle.getMessage());
    System.out.println("Error Code:" +
    sqle.getErrorCode());
    System.out.println("SQL State:" + sqle.getSQLState());
    sqle.printStackTrace();
    while ( (sqle = sqle.getNextException()) != null);
    stmt.clearBatch();
    System.out.println();
    stmt.close();
    con.close();
    catch (SQLException sqle) {
    do {
    System.out.println(sqle.getMessage());
    System.out.println("Error Code:" + sqle.getErrorCode());
    System.out.println("SQL State:" + sqle.getSQLState());
    sqle.printStackTrace();
    while ( (sqle = sqle.getNextException()) != null);
    catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();

  • Cross-DOM API and/or Techniques for simple image manipulation

    Am I correct in assuming that Cross-DOM API calls presume the target application is running? That is, these calls are not out to a "shared" library so to speak, but actually communication between two running apps.
    Assuming that is the case, is there any way, within Bridge itself, to do simple manipulations on files, such as scaling, and file type conversion. Am I required to have photoshop running to do this?

    Not sure on which platform you are using, and hoping it is not for hires/hiquality purposes, but you could use one of the many engines, for example the AppleScript Graphic Core.
    If you want/have to use PhotoShop, for what I know it has to be running.
    Bye!

  • PL/SQL DOM for xmtype problem

    Hi!
    I create the procedure:
    CREATE OR REPLACE PROCEDURE test2 IS
    var XMLType;
    doc dbms_xmldom.DOMDocument;
    ndoc dbms_xmldom.DOMNode;
    node dbms_xmldom.DOMNode;
    buf varchar2(2000);
    begin
    var := xmltype('<PERSON> <NAME> ramesh </NAME> </PERSON>');
    dbms_output.put_line('xmltype:'||var.getstringval());
    -- Create DOMDocument handle:
    doc := dbms_xmldom.newDOMDocument(var);
    ndoc := dbms_xmldom.makeNode(doc);
    dbms_xmldom.writetobuffer(doc, buf);
    dbms_output.put_line('xml:'||buf);
    node := dbms_xmldom.getFirstChild(ndoc);
    dbms_output.put_line('name:'||dbms_xmldom.getNodeName(node));
    end;
    so all seems to be ok untill the line:
    doc := dbms_xmldom.newDOMDocument(var);
    the line dbms_output.put_line('xml:'||buf); print ?????????????????
    instead of var value
    and dbms_output.put_line('name:'||dbms_xmldom.getNodeName(node));
    raise an ORA-31020 error with the message "Invalid pl/sql dom node
    hdl" that I think it is meen "the node is no valid".
    If it is anyone who have any ideea, please help me.
    Thanks!
    Gabi

    Please post this message at:
    Forums Home » Oracle Technology Network (OTN) » Products » Database » XML DB

  • EBS ISG using custom PL/SQL functions that return XMLType

    Hi,
    We have a custom PL/SQL package that we use for interfacing systems and some of the functions in this package ruturn an XMLType. We want to deploy the package functions as web services through the ISG, but it is not working as expected. When deployed through the ISG, the functions with XMLType return type produce a null response from the ISG (they work fine when called in SQL or PL/SQL; functions with non-XMLTypes work fine).
    If we change the return type to CLOB (and use getClobVal() on the XMLType) then we get a response from the ISG, but it changes all the angle-brackets in the CLOB (which is still arbitrary XML text) to &lt; &gt; ...
    What is the proper way to get the complex XMLType output through the ISG? Anyone have any more experience?
    Thanks,
    --Walt                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Alex,
    For the predicate groups that are indexed/stored, the exact operator types (as in equality, inequality, like etc) that are indexed are specified while assigning the default index parameters. In the following example, exf$indexoper is used to specify the list of indexed operators.
    BEGIN
      DBMS_EXPFIL.DEFAULT_INDEX_PARAMETERS('Car4Sale',
        exf$attribute_list (
           exf$attribute (attr_name => 'HorsePower(Model, Year)',
                          attr_oper => exf$indexoper('=','<','>','>=','<='),
                          attr_indexed => 'FALSE')    --- stored predicate group
    END;
    /You can find more information about exf$indexoper at
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/t_expfilobj.htm#ARPLS153
    Could you confirm that you chose to index 'is null' and 'is not null' while assigning the default index parameters ? This information is available in OPERATOR_LIST column of the USER_EXPFIL_DEF_INDEX_PARAMS view.
    Hope this helps,
    -Aravind.

  • How to identify a CDATA section in DOM API?

    I'm having a problem reading a CDATA section from using the DOM API. A call to Node.getNodeType() doesn't return CDATA_SECTION_NODE as expected but returns TEXT_NODE. Also, a call to getValue() doesn't return <![CDATA[<foo>]]> but returns
    <foo> instead. Does anyone know how to get getNodeType() to return the proper value?
    For example suppose I have the following XML:
    <?XML version="1.0"?>
    <document>
    <elm><![CDATA[text with <b>HTML</b>]]></elm>
    </document>
    A call to getNodeType() for the value Node (the child of the <elm> node) returns TEXT_NODE. I would expect it to return CDATA_SECTION_NODE.
    Ken

    C'mon Oracle people -- help me out here,
    Is this a known bug or what? I just discovered that if you do a cloneNode()
    the CDATA section gets messed up, too.
    Ken
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Kenneth Liu ([email protected]):
    I'm having a problem reading a CDATA section from using the DOM API. A call to Node.getNodeType() doesn't return CDATA_SECTION_NODE as expected but returns TEXT_NODE. Also, a call to getValue() doesn't return <![CDATA[<foo>]]> but returns
    <foo> instead. Does anyone know how to get getNodeType() to return the proper value?
    For example suppose I have the following XML:
    <?XML version="1.0"?>
    <document>
    <elm><![CDATA[text with <b>HTML</b>]]></elm>
    </document>
    A call to getNodeType() for the value Node (the child of the <elm> node) returns TEXT_NODE. I would expect it to return CDATA_SECTION_NODE.
    Ken<HR></BLOCKQUOTE>
    null

  • 26.4 Basing an entity Object on a PL/SQL Package API - Ref Cursor, no View

    I am hoping that I could get some help in the details of a problem. I am trying to follow the directions in the Oracle Application Development Framework Developer's Guide for Forms/4GL Developers, Section 26.4 - Basing an Entity Object on a PL/SQL Package API.
    There is example code in the downloadable AdvancedEntityExamples - EntityWrappingPL/SQLPackage
    The question is, how will the implementation change if the entity is based entirely on PL/SQL - simply stated - no view is available, just ref cursors and insert,update,delete procedures.
    In the example code, there are two procedures, lock_product and select_product. This is where things get more complicated. I can create a function to return a single record ref cursor, instead of the list of OUT variables defined in both functions (select_product and lock_product). It makes sense that I just return one cursor and get all of the columns from that instead of lots of OUT variables.
    So what's stopping me you may ask... There is one difference between select_product and select_lock. Select_lock has a select that includes "FOR UPDATE NOWAIT". I don't have that as an option when creating my ref cursor. I am not sure what the impact of "FOR UPDATE NOWAIT" is? Can I ignore it?
    In the problem I am working with, (getting data from Oracle Portal 10.1.4) I return the following:
    function getRefCursor return ref_cursor is
    v_tab wwsbr_all_items_object_type := wwsbr_all_items_object_type();
    p_recordset wwsbr_types.cursor_type;
    l_results wwsrc_api.items_result_array_type;
    begin
    wwctx_api.set_context(<username>,<password>);
    l_results := wwsrc_api.item_search(.. parameters..);
    <snip>
    ... Loop through the objects and populate v_tab
    <snip>
    open p_recordset for
    select * from table(cast(v_tab as wwsbr_all_items_object_type));
    return p_recordset;
    end getRefCursor;
    With this sample, it would be easy to return a single row by passing the masterid as a parameter.
    So I am still left with, how should the implementation of callLockProcedureAndCheckForRowInconsistency() and callSelectProcedure() be changed in order to use a ref cursor instead of a view? The user guide was missing that extra section <bg>.
    What would be REALLY helpful, is an example, say 26.4A that demonstrates creating an entity object from a ref cursor and procedures from PL/SQL only without a view.
    Thank you, Ken

    The lock procedure is expected to obtain a row-level lock on the row, given its key.
    Depending on the setting of jbo.locking.mode, the entity object's lock() method will be invoked either as soon as the first persistent attribute is successfully modified by the user (in the case of jbo.locking.mode=pessimistic), or it will be called during commit processing just before the row is updated in the database (with jbo.locking.mode=optimistic).
    Usually 2-tier Swing applications use pessimistic mode, while web applications use optimistic mode.
    The FOR UPDATE NOWAIT is the Oracle clause that can be appened to a SELECT statement to acquire a row-level lock on the selected rows. The NOWAIT modifier means that rather than hanging, waiting for a row locked by another user to free up, it will raise an exception if any of the rows being selected-and-locked are not available to lock.
    If you're not able to work the FOR UPDATE NOWAIT into the syntax of the ref cursor, perhaps you can initially perform the lock using a different cursor inside the stored procedure, then return your ref cursor.

  • Using DOM APIs

    Hi all,
    I am using the org.w3c.dom api to create a new xml document, say. for eg., as shown below -
    <root>
    <element>
    <child 1> value </child1>
    <child 2> value </child2>
    </element>
    </root>
    I used the following code to get this file generated -
    try{
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document documentDA = builder.newDocument();
    Element rootDA = documentDA.createElement("root");
    documentDA.appendChild(rootDA);
    Node elementDA = rootDA.appendChild(documentDA.createTextNode("element"));
         Node child1 = elementDA.appendChild(documentDA.createTextNode("child1"));
         child1.setTextContent("1");
         Node child2 = elementDA.appendChild(documentDA.createTextNode("child2"));
         child2.setTextContent("desc1");
    Once the "element" is created under the root, I would like to know the API to create the two children under this element. I get heirarchy exceptions thrown with the above code. Please help me to resolve the issue and let me know the exact API for creating the children nodes.
    Thanks in advance!!!!

    You are not adding the elementDA to the root node each time it is created. You only do it after the loop.
    This should work better:
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = factory.newDocumentBuilder();
              Document documentDA = builder.newDocument();
              Element rootDA = documentDA.createElement("DedicatedAccounts");
              documentDA.appendChild(rootDA);
              Node elementDA = null;
              for (int i = 0; i < 2; i++) {
                   elementDA = documentDA.createElement("DedicatedAccount");
                   rootDA.appendChild(elementDA);
                   Node DAID = documentDA.createElement("DAID");
                   Node DADesc = documentDA.createElement("DAdesc");
                   DAID.appendChild( documentDA.createTextNode( Integer.toString(i) ) );
                   DADesc.appendChild( documentDA.createTextNode( "desc" ) );
                   elementDA.appendChild(DAID);
                   elementDA.appendChild(DADesc);
              Transformer xformer = TransformerFactory.newInstance().newTransformer();
              xformer.transform(new DOMSource(rootDA), new StreamResult(System.out));- Roy
    P.S. When you post code mark the code in your post, and press the code button. This add tag before and after your code and makes it a lot more readable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to use of API for Cancel Sales Orders

    Hi....
    I want to use API for Cancel Sales Orders. Plz give me advice how we can cancel orders. I know that there is procedure provide in ORACLE APPs (i.e. OE_ORDER_PUB.process_order). But in this procedure i know the how to create and update sales order, but how to Cancel order with the use of this API.
    Plz send me soultion as soon as possible. ITS VERY VERY URGENT BASE.
    Thanks in Advance.

    Hi all,
    We are importing Sales Orders on 11.5.9 using OE_Order_PUB.Process_Order API .We have supplied most of the mandatory fields and the same data works from the front end. When we use the API it throws a Ora 20001.
    A snapshot of the error message.
    SQL> exec pk_process_object.process_order('1o');
    Message Count is :2
    Message is RA-20001: User in Package OE_Header_Util Procedure Get_Order_Number
    Message is :User-Defined Exception in Package OE_Header_Util Procedure
    Pre_Write_Process
    Return Status is ErrorU
    PL/SQL procedure successfully completed.
    --------------------------------------------------------------------------------------------

  • Any practical help about XML API for databases

    HI friends,
    I have a problem, i want to connect to my Database using JSP but by using XML api for database. I want to MAP my database tables, rows columns as xml elements to make it more flexible. Anyone who had practicaly worked on it, please help me out.
    I am waiting for a quick response.
    Thanks for any help in advance,
    Yours Truly,
    Khawaja Salman Sarfraz

    Some databases have a feature that allows you to output the result of a query as XML. But that's not standard SQL, and it probably varies from one DB to the next. Look up the documentation for your DB for more information.

  • How to move XML tree to another level using DOM api ?

    <p>
    Hi,
    </p>
    <p>
    I have a followin function
    </p>
    <p>
    <font face="courier new,courier"><strong>    public void printEmployeesAsXML(){
    </strong></font>
    </p>
    <p>
    <font face="courier new,courier"><strong>        ViewObject vo = getEmployees();
            Node no = vo.writeXML(-1,XMLInterface.XML_OPT_ALL_ROWS);
            XMLNode oraXML = (XMLNode)no; 
            try {
                    oraXML.print(System.out);
                } catch (IOException e) {
                    e.printStackTrace();
        } </strong></font>
    </p>
    <p>
    <font face="courier new,courier"><strong>that gives me following XML:</strong></font>
    </p>
    <p>
    <font face="courier new,courier"><strong>&lt;Employees&gt;
       &lt;Employee&gt;
          &lt;Empno&gt;7369&lt;/Empno&gt;
          &lt;LastName&gt;SMITH&lt;/LastName&gt;
          &lt;Job&gt;CLERK&lt;/Job&gt;
          &lt;Manager&gt;7902&lt;/Manager&gt;
          &lt;HireDate&gt;1980-12-17&lt;/HireDate&gt;
          &lt;Salary&gt;800&lt;/Salary&gt;
          &lt;Deptno&gt;20&lt;/Deptno&gt;
       &lt;/Employee&gt;</strong></font>
    <font face="courier new,courier"><strong>&lt;/Employees&gt;</strong></font>
    </p>
    <p>
    I always wil have only one row, so I need following XML:
    <font face="courier new,courier"><strong>
       &lt;Employee&gt;
          &lt;Empno&gt;7369&lt;/Empno&gt;
          &lt;LastName&gt;SMITH&lt;/LastName&gt;
          &lt;Job&gt;CLERK&lt;/Job&gt;
          &lt;Manager&gt;7902&lt;/Manager&gt;
          &lt;HireDate&gt;1980-12-17&lt;/HireDate&gt;
          &lt;Salary&gt;800&lt;/Salary&gt;
          &lt;Deptno&gt;20&lt;/Deptno&gt;
       &lt;/Employee&gt;</strong></font>
    </p>
    <p>
    Question is how to remove <strong>&lt;/Employees&gt;</strong> tag using w3c DOM API and move tree one level above
    </p>
    <p>
    Kuba 
    </p>
    <p>
    </p>

    The XSLT for the required transformation is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="/Employees">
    <xsl:copy-of select="Employee"/>
    </xsl:template>
    </xsl:stylesheet>

  • APIs for XML file creation

    hi,
    can anyone tell me whether there is any Java APIs for creating XML file( similar to the one used for parsing).
    thx in advance,
    -Soni.

    Hi,
    you can try the org.apache.xml.serialize.XMLSerializer which is included in the Apache Xerces Package (http://xml.apache.org/xerces). This Class allows you to serialize a org.w3c.dom.Document to a OutputStream which can be a FileOutputStream.
    Check out this code:
    OutputFormat format = new OutputFormat();
    format.setDoctype("mapping","mapping.dtd");
    format.setEncoding("ISO-8859-1");
    format.setLineWidth(100);
    XMLSerializer ser = new XMLSerializer(new FileOutputStream(f),format);
    ser.serialize(doc);
    Rgds,
    Sebastian

Maybe you are looking for