Getting Hierarchial Query as XML (and maitaining the relationship)

Pls find below sample table script and desired output format.XML output should maintain the hierarchy info which is the requirement.Also is it possible to do in single sql.
Thanks.
CREATE TABLE MAIN
ID NUMBER,
NAME VARCHAR2(20 BYTE)
INSERT INTO MAIN ( ID, NAME ) VALUES (
1, 'OS');
INSERT INTO MAIN ( ID, NAME ) VALUES (
2, 'Windows');
INSERT INTO MAIN ( ID, NAME ) VALUES (
3, 'DOS');
INSERT INTO MAIN ( ID, NAME ) VALUES (
4, '1.x');
INSERT INTO MAIN ( ID, NAME ) VALUES (
5, '1.1.x');
INSERT INTO MAIN ( ID, NAME ) VALUES (
7, '1.1.1.1');
INSERT INTO MAIN ( ID, NAME ) VALUES (
8, '1.2');
INSERT INTO MAIN ( ID, NAME ) VALUES (
9, '2.x');
INSERT INTO MAIN ( ID, NAME ) VALUES (
10, '2.1');
INSERT INTO MAIN ( ID, NAME ) VALUES (
11, '2.2');
INSERT INTO MAIN ( ID, NAME ) VALUES (
12, '2.2.1');
INSERT INTO MAIN ( ID, NAME ) VALUES (
13, '2.2.2');
COMMIT;
CREATE TABLE RELA
REL_ID NUMBER,
ID NUMBER,
PARENT_REL_ID NUMBER
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
1, 1, NULL);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
2, 2, 1);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
3, 4, 2);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
4, 5, 3);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
5, 7, 4);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
6, 8, 4);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
7, 9, 2);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
8, 10, 7);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
12, 7, 11);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
14, 9, 9);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
15, 10, 14);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
9, 3, 1);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
10, 4, 9);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
11, 5, 10);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
16, 11, 14);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
13, 8, 10);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
17, 12, 16);
INSERT INTO RELA ( REL_ID, ID, PARENT_REL_ID ) VALUES (
18, 13, 16);
COMMIT;
Sample Query
select rel_id,level,lpad(' ',5*level)||name,
xmlelement("rel_id", XMLAttributes(name as "name",rel_id as "rel_id")) as val
from main , rela
where main.id=rela.id
start with parent_rel_id is null
connect by prior rel_id=parent_rel_id;
Required xml output
<rel_id name="OS" rel_id="1">
     <rel_id name="Windows" rel_id="2">
          <rel_id name="1.x" rel_id="3">
               <rel_id name="1.1.x" rel_id="4">
                    <rel_id name="1.1.1.1" rel_id="5"></rel_id>
                    <rel_id name="1.2" rel_id="6"></rel_id>
               </rel_id>
          </rel_id>
          <rel_id name="2.x" rel_id="7">
               <rel_id name="2.1" rel_id="8"></rel_id>
          </rel_id>
     </rel_id>
     <rel_id name="DOS" rel_id="9">
          <rel_id name="2.x" rel_id="14">
               <rel_id name="2.1" rel_id="15"></rel_id>
               <rel_id name="2.2" rel_id="16">
                    <rel_id name="2.2.1" rel_id="17"></rel_id>
                    <rel_id name="2.2.2" rel_id="18"></rel_id>
               </rel_id>
          </rel_id>
          <rel_id name="1.x" rel_id="10">
               <rel_id name="1.1.x" rel_id="11">
                    <rel_id name="1.1.1.1" rel_id="12"></rel_id>
               </rel_id>
               <rel_id name="1.2" rel_id="13">
               </rel_id>
          </rel_id>
     </rel_id>
</rel_id>

will this work?
select xmlelement("rel_id",
        (select dbms_xmlgen.getxmltype
                (dbms_xmlgen.newcontextfromhierarchy
                  ('select level,
                            xmlelement("rel_id",
                             xmlattributes(a.name     as "name",
                                           b.rel_id     as "rel_id")
                       from rela     b,
                            main     a
                      where b.id     = a.id
                      start with parent_rel_id is null
                    connect by prior rel_id=parent_rel_id'))
           from dual)) xmldoc
from dual
XMLDOC
<rel_id><rel_id name="OS" rel_id="1">
  <rel_id name="Windows" rel_id="2">
    <rel_id name="1.x" rel_id="3">
      <rel_id name="1.1.x" rel_id="4">
        <rel_id name="1.1.1.1" rel_id="5"/>
        <rel_id name="1.2" rel_id="6"/>
      </rel_id>
    </rel_id>
    <rel_id name="2.x" rel_id="7">
      <rel_id name="2.1" rel_id="8"/>
    </rel_id>
  </rel_id>
  <rel_id name="DOS" rel_id="9">
    <rel_id name="1.x" rel_id="10">
      <rel_id name="1.1.x" rel_id="11">
        <rel_id name="1.1.1.1" rel_id="12"/>
      </rel_id>
      <rel_id name="1.2" rel_id="13"/>
    </rel_id>
    <rel_id name="2.x" rel_id="14">
      <rel_id name="2.1" rel_id="15"/>
      <rel_id name="2.2" rel_id="16">
        <rel_id name="2.2.1" rel_id="17"/>
        <rel_id name="2.2.2" rel_id="18"/>
      </rel_id>
    </rel_id>
  </rel_id>
</rel_id>
</rel_id>
1 row selected.

Similar Messages

  • Passing parameters for a query throught XML and capturing response in the same

    Hi All,
    I have defined a RequestParameters object and i am passing paramerts for a query through XML and trying to capture the result in the same and send back to the source. In this case i am send XML from excel.
    Below is my XML format.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Insert xmlns="http://tempuri.org/">
    <dataContractValue>
    <dsRequest>
    <dsRequest>
    <SOURCE></SOURCE>
    <ACTION>Insert</ACTION>
    <RequestParams>
    <RequestParams>
    <ACC_NO>52451</ACC_NO>
    <EMP_CITY>HYD</EMP_CITY>
    <EMP_NAME>RAKESH</EMP_NAME>
    <EMP_CONTACT>99664</EMP_CONTACT>
    <EMP_JOM>NOV</EMP_JOM>
    <EMP_SALARY>12345</EMP_SALARY>
    </RequestParams>
    <RequestParams>
    <ACC_NO>52452</ACC_NO>
    <EMP_CITY>HYD</EMP_CITY>
    <EMP_NAME>RAKESH</EMP_NAME>
    <EMP_CONTACT>99664</EMP_CONTACT>
    <EMP_JOM>NOV</EMP_JOM>
    <EMP_SALARY>12345</EMP_SALARY>
    </RequestParams>
    </RequestParams>
    </dsRequest>
    <dsRequest>
    <SOURCE></SOURCE>
    <ACTION>Update</ACTION>
    <RequestParams>
    <RequestParams>
    <ACC_NO>52449</ACC_NO>
    <EMP_CITY>HYD1</EMP_CITY>
    <EMP_NAME>RAKESH1</EMP_NAME>
    <EMP_SALARY>1345</EMP_SALARY>
    </RequestParams>
    <RequestParams>
    <ACC_NO>52450</ACC_NO>
    <EMP_CITY>HYDer</EMP_CITY>
    <EMP_NAME>RAKEH</EMP_NAME>
    <EMP_SALARY>1235</EMP_SALARY>
    </RequestParams>
    </RequestParams>
    </dsRequest>
    </dsRequest>
    </dataContractValue>
    </Insert>
    </s:Body>
    </s:Envelope>
     Where i have a List of dsRequest and RequestParams, where i can send any number of requests for Insert,Update. I have two a XML element defined in RequestParams "RowsEffected","error" where the result will be caputred and is updated
    to the response XML.
    I have 6 defined in RequestParams
    EMP_SALARY(int),ACC_NO(int),EMP_CITY(string),EMP_NAME(string),EMP_CONTACT(string),EMP_JOM(string)
    My Question is:
    When i am trying to build response XML with the following code, the parameters which are not given in the Request XML are also appearing in the Response.
                    ResponseParams.Add(
    newdsResponse()
                        ACTION = OriginalParams[a].ACTION,
                        SOURCE = OriginalParams[a].SOURCE,
                        Manager = OriginalParams[a].Manager,
                        RequestParams = OriginalParams[a].RequestParams
    Where the OriginalParams is dsRequest
    Ex: In my update query i will only send three parameters, but in my response building with ablove code, i am getting all the variables defined as INT in the RequestParameters.
    Is there any way i can avoid this and build response with only the parameters given in the Request ??
    Appreciate ur help..Thanks
    Cronsey.

    Hi Kristin,
    My project is, User will be giving the parameters in the excel, and using VBA, the values are captured and an XML is created in the above mentioned format and is send to web service for the Insert/Update.
    I created a webservice which reads the values from <datacontract> and it consist of list of <dsRequests> where any number of Insert/Upate commands can be executed, with in which it contains a list of <RequestParams> for multiple insertion/Updation.
    //function call
    OriginalParams = generator.Function(query, OriginalParams);
    where OriginalParams is List<dsRequest>
    //inside function
    command.Parameters.Add()// parameters adding
    int
    val = command.ExecuteNonQuery();
    after the execution,an XML element is added for the response part.and it is looped for all the RequestParams.
    OriginalParams[i].Result.Add(
    newResult()
    { ERROR = "No Error",
    ROWS_EFFECTEFD = 1 });
    //once all the execution is done the response building part
    for(inta
    = 0; a < OriginalParams.Count; a++)
                    ResponseParams.Add(
    newdsResponse()
                      Result = OriginalParams[a].Result
    QUEST: When i am trying to build response XML with the following code, the parameters which are not given in the Request XML are also appearing in the Response.
    Ex: In my update query i will only send three parameters, but in my response building with ablove code, i am getting all the variables defined as INT in the RequestParameters.
    Is there any way i can avoid this and build response with only the parameters given in the Request ??
    Appreciate ur help..Thanks
    Cronsey.

  • How to edit bitmap which is imported in flash using xml and save the edited bitmap back to xml in flash.

    hi all
    It would be appreciated if any one let me know how to edit
    bitmap which is imported in flash using xml and save the edited
    bitmap back to xml in flash.
    Is it posible to save the bitmap data in flash?
    thanks in advance

    Yes you can... but like I said before you need to upload the
    data from the changes you make to a server.
    In terms of the solution... its unlikely that you'll find one
    specifically for your needs. You will have to learn whatever you
    don't know how already and maybe adapt some existing examples to
    your needs.
    To change the visual state of a movie clip... you just do all
    the regular things that you want to do to it using flash... scale,
    rotation, drawing API , textfields etc in actionscript. If you
    don't know how to how to do that stuff, then you need to learn that
    first. That's basic actionscript.
    You can capture the visual state of a movieclip using the
    BitmapData class. That includes a loaded jpeg. You can also
    manipulate bimatp data using the same class. You should read up on
    that if you don't know how to use it or check out the examples
    below for uploading info.
    For uploading to the server:
    Here's an as2 solution that took 15 secs to find using
    google:
    http://www.quasimondo.com/archives/000645.php
    If you're using as3, google search for "jpeg encoder as3" and
    look through that info. There are also historical answers in the
    forums here related to this type of thing that might help as
    well.

  • Search for a tag in xml and modify the content

    Hi,
    I am quite new to using xml db and i want to know how to search a xml, modify a tag value inside xml and replace the content in xml.
    Please help me to find a solution for this.
    Regards,
    Sprightee

    Hi,
    First important thing : give your database version (SELECT * FROM v$version).
    Please also provide some sample data :
    - a typical XML document you're working with (or abridged version)
    - explain what change(s) you want to do, or give expected output
    - if you're using a table to store the XML (which is preferred), give the DDL

  • If I have a movie on my mac on iTunes how do i get it off my computer and into the iCloud?

    f I have a movie on my mac on iTunes how do i get it off my computer and into the iCloud?

    You don't need to manually put iTunes Store purchases in the cloud. If that purchase can be stored there in your country, it's done so upon purchase. If not, it isn't possible.
    (84039)

  • I Cannot get my organizer to work for Elements 13. "A problem caused the program to stop working correctly. Windows will close the program......" is the error I get. I've uninstalled and reinstalled the program and tried various other things based on the

    I Cannot get my organizer to work for Elements 13. "A problem caused the program to stop working correctly. Windows will close the program......" is the error I get. I've uninstalled and reinstalled the program and tried various other things based on the MANY other complaints with this same issue and nothing is working. How can this problem be corrected?

    Hi,
    Which operating system are you running on?
    Are you upgrading from a previous version of Photoshop elements or is this your first?
    Are you trying to load the organizer or the editor or do both fail?
    Brian

  • Hi, I have an iphone 5 and unfortunately got sat on and is now bent, it worked fine bent for 3 months as the glass did not break, today how ever the screen has stopped working. Is it possible to get hold of another casing and have the electronics changed

    Hi, I have an iphone 5 and unfortunately got sat on and is now bent, it worked fine bent for 3 months as the glass did not break, today how ever the screen has stopped working. Is it possible to get hold of another casing and have the electronics changed ?

    You didn't look hard enough:
    Out-of-Warranty Service
    If you own an iPhone that is ineligible for warranty service but is eligible for Out-of-Warranty (OOW) Service, Apple will service your iPhone for the Out-of-Warranty Service fee listed below.
    iPhone model
    Out-of-Warranty Service
    iPhone 5s, iPhone 5c,
    iPhone 5
    $269
    iPhone 4S
    $199
    iPhone 4, iPhone 3GS,
    iPhone 3G, Original iPhone
    $149

  • My idvd wont play sound in some parts of my i movie project, even though i can hear the sound in imovie. dont get it??? and at the end of my i movie i added pictures with music. it appears as tough there is some kind of ripple effect when i play in idvd??

    my idvd wont play sound in some parts of my i movie project, even though i can hear the sound in imovie. dont get it??? and at the end of my i movie i added pictures with music. it appears as tough there is some kind of ripple effect when i play in idvd??? i dont know why, i did not add anty effect.

    any suggestions

  • Now my fairy tail account is get back , but cannot attack and mix the puzzle ,can help me fixed it

    Now my fairy tail account is get back , but cannot attack and mix the puzzle ,can help me fixed it

    Hello, Alan. 
    Thank you for visiting Apple Support Communities.
    Try forcing all applications to close and power cycle the device.  Once this is done test to see if you can access and manage this game.
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/ht1430
    If the issue persists, try the steps in the article below.  You may have to reach out to the developer of the application to report an issue. 
    iOS: An app you installed unexpectedly quits, stops responding, or won’t open
    http://support.apple.com/kb/ts1702
    Cheers,
    Jason H

  • I keep getting prompted to instal Reader and sign the agreement.  But it is already installed.

    When I try to use Reader in one application I keep getting prompted to install Reader and sign the agreement, even though it is already installed.

    Have you accepted the EULA? How this is done depends on your platform, which we don't know.

  • Error executing the Query after deploying and executing the application in WLS 6.1 SP3

    Hi,
    We are trying to run a application by deploying a war file on Web Logic Server
    6.1 SP3. After deploying and at the time of execution of the application, the
    server console displays this error message
    java.sql.SQLException: ORA-00600: internal error code, arguments: [ttcgcshnd-1],
    [0], [], [], [], [], [], []
    While debugging thru the application we found that this error comes at the time
    of execution of the query thru the Statement.executeQuery method of java.sql.Statement
    class.
    This same application when deployed on Web Logic Server 8.1 runs perfectly, without
    any hitches.
    Please, provide me the solution to this asap.

    Look for sometime around November. No exact date.
    Eric
    "Dominic Tulley" <[email protected]> wrote in message
    news:[email protected]..
    Thanks Eric,
    you know what I'm going to ask next right?
    Any ideas when SP4 comes out?
    Cheers,
    -Dominic
    "Eric Gross" <[email protected]> wrote in message
    news:[email protected]..
    The next version of Apache that we will support will be 2.0.42/2.0.43
    and
    the module for that will be included in the next Service Pack for6.1(SP4)
    and 7.0(SP2).
    The problem with Apache 2 is that when a new release comes out a newmodule
    needs to be compiled. Most of the time. For 2.0.42/2.0.43 this is notthe
    case.
    Regards,
    Eric
    "Dominic Tulley" <[email protected]> wrote in
    message
    news:3da3f246$[email protected]..
    I'm trying to set this up (initially just apache in front of a single
    WLS
    server but ultimately I want to put it in front of a cluster).
    I've installed Apache 2.0.40.
    I've copied the mod_wl_20.so file into the apache modules folder.
    I've edited the httpd.conf file and added the line:
    LoadModule weblogic_module modules/mod_wl_20.so
    When I run apache -t to check the configuration I get the following:
    C:\Program Files\Apache Group\Apache2\bin>apache -t
    Syntax error on line 173 of C:/Program Files/Apache
    Group/Apache2/conf/httpd.conf:
    Cannot load C:/Program Files/Apache Group/Apache2/modules/mod_wl_20.sointo
    server: The specified procedure could not be found.
    So what's going on here?
    Looking at previous postings it sounds like there's an issue with
    versions
    of apache after 2.0.39 but I can't find a download for that version.Also,
    it sounded like the issues were for WLS 7, not 6.1. Can this work
    with
    2.0.40 or am I wasting my time?
    If I get the mod_wl_20.so from dev2dev I get the "incompatible plugin"
    message that has been mentioned in this group already.
    Any suggestions appreciated,
    -Dominic

  • Inserting a node in XML and retaining the doc type

    Hi All,
    I want to insert one new node in an XML. Using the following code I can do that. But the problem is if the XML has doc type declaration then its giving me problem. After inserting the node the transformer is removing my doc type declaration from the XML. I have to retain the doc type definition (including entity declaration) as it is in the original XML file.
    The following is the code that I'm using.
    Document vDoc = null;
    try {
    // Contruct the DOM document
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    vDoc = builder.newDocument();
    Node vFormNode = vDoc.createElement("Form");
    vDoc.appendChild(vFormNode);
    // Convert into a String the DOM document
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    DOMSource source = new DOMSource(vDoc);
    StringWriter sw = new StringWriter();
    StreamResult result = new StreamResult(sw);
    transformer.transform(source, result);
    catch (Exception e) {
    System.out.println("Error: " + e.getMessage());
    }The doc type def. in the original file is some thing like this.
    <!DOCTYPE article SYSTEM "someurl/TFJA.dtd"[
    <!ENTITY T0001 SYSTEM ".\BTN_A_000112809_O_XML_IMAGES\BTN_A_000112809_O_T0001.gif" NDATA GIF>
    <!ENTITY F0001 SYSTEM ".\BTN_A_000112809_O_XML_IMAGES\BTN_A_000112809_O_F0001g.gif" NDATA GIF>
    <!ENTITY F0002 SYSTEM ".\BTN_A_000112809_O_XML_IMAGES\BTN_A_000112809_O_F0002g.jpg" NDATA JPEG>
    ]>I know that I can set up the doc type definition in the new XML using the following properties of the transformer.
    transformer.setOutputProperty( OutputKeys.DOCTYPE_SYSTEM,"article" );
    transformer.setOutputProperty( OutputKeys.DOCTYPE_PUBLIC,"my DTD def");
    I cannot hard code the DTD def. as it can vary from one XML to another. Using doc.getDocType() I can get the doctype of the original XML. But is it is not returning the complete def. including entities declaration. Its giving me "someurl/TFJA.dtd".
    Is there any way to retain the complete doc type in the original XML file? I don't have much experience in XML and this issue is eating my head.. Also do I have to modify the DTD to accommodate the new tags added in order to make it a valid XML?
    Any help and sample code would be highly appreciated.

    Hi,
    I also had similar requirement and when searching i came across this post. Later i found the solution for this. Instead of hardcoding the doctype you can get it from Document as follows..Snippet from the code i used..
    DocumentType doctype = document.getDoctype();
    if(doctype != null) {
                   String id = doctype.getSystemId();
                   if(id == null || id.length() == 0)
                        return;
                   transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, id);
                   id = doctype.getPublicId();
                   if(id == null || id.length() == 0)
                        return;
                   transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, id);
    Hope this helps.
    Regards,
    Deepak

  • Best way to write objects in an xml and send the file?

    hello all
    i am making some objects, which i conver to xml using the XStream and then i am saving them to a file, call a function to send the file to a servant (basically i do this by sending bytes and this may be the problem). In the servant i take the data i write them to a file and then i read them again to make them objects...
    i have the following code in the client
            XStream xstream = new XStream(new DomDriver());     
            xstream.alias("Jobb", WorkflowFramework.Jobb.class);
         String xml = xstream.toXML(translation);
               FileWriter fw = new FileWriter("translation.xml");
               ObjectOutputStream out = xstream.createObjectOutputStream(fw);
               out.writeObject(new Jobb("ougk2", "Walnes",null));
               out.close();
               File file=new File("translation.xml");
               byte buffer[]=new byte[(int)file.length()];
               try {
                    BufferedInputStream input=new BufferedInputStream(new FileInputStream("translation.xml"));
                    input.read(buffer,0,buffer.length);
                    input.close();
               } catch(Exception e) {
                      System.out.println("Error: "+e.getMessage());
                       e.printStackTrace();
               theRemoteObjRef.translationService(theCallbackObjectRef, buffer);i write the file and then i read it so as to have a buffer of bytes (there should be a better ways..)
    the last line sends an objectRef (we dont care about that) and the file in bytes to a server (to be specific to a servant of a server)..
    in the servant i do the following
    public void translationService(TheCallbackInterface objRef, byte data[]){
              try{
                        File file = new File("translation2.xml");
                    BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream("translation2.xml"));
                  output.write(data, 0, data.length);
                  output.flush();
                  output.close();
              } catch(Exception e) {
                        System.out.println("Error: " + e.getMessage());
                        e.printStackTrace();
               XStream xstream = new XStream(new DomDriver());
               try { // If an error occurs, go to the "catch" block
                    FileReader fr2 = new FileReader("translation2.xml");
                    ObjectInputStream in = xstream.createObjectInputStream(fr2);
                    Jobb newJob = (Jobb)in.readObject();
                   System.out.println(newJob.getObjServerRef());
                   System.out.println(newJob.getForTranslation());
                   System.out.println(newJob.getTranslated());
                    }catch (Exception e) {  
                         System.err.println("File input error"+e);
                    Jobb testJob=new Jobb("ougka","mpougka","falalala");
                    System.out.println(testJob.getObjServerRef());
                       System.out.println(testJob.getForTranslation());
                    System.out.println(testJob.getTranslated());
    the problem is that in the first group of System.out.println i get the error File input errorcom.thoughtworks.xstream.mapper.CannotResolveClassException: Jobb : Jobb
    but the second group of printlns, prints the correct results...
    do you know what is the problem? Why can i read the content of the file and get the objects from there?
    do you have any suggestions of writing and reading the file in an another way or to send it by NOT using a bytes array?
    do you have an alternative way of making the xml file?
    many thanks!

    Hi,
    I would suggest to reconsider building of your document so that it doesn't contain duplicates if you don't need them. And it doesn't have much to do with DB XML then.
    Also you could insert your document with duplicates and use XQuery Update facilities to delete undesirable nodes.
    Vyacheslav

  • Convert this query to ABAP and display the results

    Hi Everyone,
    I have a sql query in native sql (oracle). I want execute it in ABAP editor and display the results.
    I need to get this to an internal table and display the results. How do i write the script any help will be great use to me.
    Here is the query:
    <i> select (select decode(extent_management,'LOCAL','*',' ') ||
                   decode(segment_space_management,'AUTO','a ','m ')
              from dba_tablespaces where tablespace_name = b.tablespace_name) || nvl(b.tablespace_name,
                 nvl(a.tablespace_name,'UNKOWN')) name,
           kbytes_alloc kbytes,
           kbytes_alloc-nvl(kbytes_free,0) used,
           nvl(kbytes_free,0) free,
           ((kbytes_alloc-nvl(kbytes_free,0))/
                              kbytes_alloc)*100 pct_used,
           nvl(largest,0) largest,
           nvl(kbytes_max,kbytes_alloc) Max_Size,
           decode( kbytes_max, 0, 0, (kbytes_alloc/kbytes_max)*100) pct_max_used from ( select sum(bytes)/1024 Kbytes_free,
                  max(bytes)/1024 largest,
                  tablespace_name
           from  sys.dba_free_space
           group by tablespace_name ) a,
         ( select sum(bytes)/1024 Kbytes_alloc,
                  sum(maxbytes)/1024 Kbytes_max,
                  tablespace_name
           from sys.dba_data_files
           group by tablespace_name
           union all
          select sum(bytes)/1024 Kbytes_alloc,
                  sum(maxbytes)/1024 Kbytes_max,
                  tablespace_name
           from sys.dba_temp_files
           group by tablespace_name )b
    where a.tablespace_name = b.tablespace_name order by 1;
    </i>
    Thanks,
    Prashant.

    Hi Prashant,
    Native SQL commands in ABAP are placed between EXEC SQL and ENDEXEC. You can place all your statements in between these EXEC SQL and ENDEXEC in a report.
    EXEC SQL [PERFORMING <form>].
      <Native SQL statement>
    ENDEXEC.
    Check this link to know about Native SQL
    http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/frameset.htm
    Thanks,
    Vinay

  • Loop through xml and update the value

    I have the following xml table. I need to update the Field which name="data"
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Root name="xyz">
    <Row id="1">
    <Field name="data">456</Field>
    <Field name="time">2005-02-08 10:43:51</Field>
    </Row>
    <Row id="2">
    <Field name="data">123</Field>
    <Field name="time">2005-02-08 10:43:16</Field>
    </Row>
    </Root>
    After update, the table should look like this
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Root name="xyz">
    <Row id="1">
    <Field name="data">abc</Field>
    <Field name="time">2005-02-08 10:43:51</Field>
    </Row>
    <Row id="2">
    <Field name="data">edf</Field>
    <Field name="time">2005-02-08 10:43:16</Field>
    </Row>
    </Root>
    How do I update the value through java program? I do not want to load the data to database to update the value. The constrain is that i must have the value updated in java application before I loaded it to the database.
    Please any advise?
    Thank you!

    Use a DOM parser to parse the xml document...you will get a Document object, which you can use XPath or traverse the DOM tree and perform the updating.

Maybe you are looking for

  • I am unable to connect to AD through the Metadirectory's AD connector

    I am trying to configure IPlanet Metadirectory's AD connector(MD 5.0sp1) to AD. I keep getting the following error: Failed to get rootDSE , giving up 8007203A Has anyone seen this before ? What am I doing wrong ? Thanks, Aparna

  • Monitoring resource utilization in WLS 8.1

    Dear All, We have an application being developed WLS 8.1. We intend to opt for an external HTTP load balancer to load balance about 8 instances of the WLS instances we plan to deploy in production on 8 different linux servers (Itanium based). I am lo

  • System Font Size Too Small

    I just received a new 15 inch powerbook today (Dec. 2005). It has increased screen resolution with respect to the previous model, but I think the default font size (i.e. top menu bar, safari window bar font size) is noticeably smaller than the older

  • Issue during install of Photoshop CS5 - files do not completely extract.

    "A problem occurred while extracting some files. Check available space on your computer and the write privileges on the destination folder" - trying to install Photoshop CS5 after hard drive crashed.  New install of Windows 7 64bit.  Downloaded insta

  • Vcf export only send one contact

    trying to get contact into Outlook. I go to iCloud; contacts; select all; export vcf; save . . . . seems simple. But, when I open the vcf file, there is only 1 contact there!!!!! What's up with that?