Convert  Objects into an XML Document? Possible?

Hello,
Is there a way to convert different objects into an XML File/Document
If I create 10 objects and then I want to create an XML Document
of these objects,is it possible to do this?
Ajay

Hello,
Is there a way to convert different objects into an
XML File/Document
If I create 10 objects and then I want to create an
XML Document
of these objects,is it possible to do this?
Ajayjust override the .toString() method...

Similar Messages

  • How to create and instance of Java Object from an XML Document.

    Hi,
    How can we use a XML Document to create an instance of Java Object and do vice versa ie from the Java Object creating the XML Document.
    XML Document is available in the form of a String Object.
    Are there helper class available to achieve this.
    I need to do this in a Servlet.
    Regards
    Pramod.

    JAXB is part of JavaSE while Xmlbeans claims full schema support and full infoset fidelity.
    If the standard APIs do all that you need well then use them.

  • Inserting an element into an XML document

    I am simply looking insert a new element into an existing XML Document using JDOM. Here is my code so far:
    public class UserDocumentWriter {
         private SAXBuilder builder;
         private Document document;
         private File file = new File("/path/to/file/users.xml");
         private Element rootElement;
         public UserDocumentWriter() {
              builder = new SAXBuilder();
              try {
                   document = builder.build(file);
                   rootElement = document.getRootElement();
              } catch (IOException ioe) {
                   System.err.println("ERROR: Could not build the XML file.");
              } catch (JDOMException jde) {
                   System.err.println("ERROR: " + file.toString() + " is not well-formed.");
         public void addContact(String address, String contact) {
              List contactList = null;
              Element contactListElement;
              Element newContactElement = new Element("contact");
              newContactElement.setText(contact);
              List rootsChildren = rootElement.getChildren();
              Iterator iterator = rootsChildren.iterator();
              while (iterator.hasNext()) {
                   Element e = (Element) iterator.next();
                   if (e.getAttributeValue("address").equals(address)) {
                        contactListElement = e.getChild("contactlist");
                        contactListElement.addContent(newContactElement);
                        writeDocument(document);
         public void writeDocument(Document doc) {
              try {
                   XMLOutputter output = new XMLOutputter();
                   OutputStream out = new FileOutputStream(file);
                   output.output(doc, out);
              } catch (FileNotFoundException ntfe) {
                   System.err.println("ERROR: Output file not found.");
              } catch (IOException ioe) {
                   System.err.println("Could not output document changes.");
         }However, the problem is, the newly added element will always be appended to the end of the last line, resulting in the following:
    <contactlist>
                <contact>[email protected]</contact><contact>[email protected]</contact></contactlist>Is there anyway in which I can have the newly added element create it's own line for the purpose of tidy XML? Alternatively is there a better methodology to do the above entirely?

    Your question is not very clear.
    Do you want to know How to insert an element into an XML document?
    Answer: I can see you already know how to do it. You have added the element using addContent()
    or do you want to know How to display the XML in a tidy format?
    Answer: to view the XML in a properly formatted style you can you the Format class. A very basic way of viewing the XML would be:
       * Prints the Document to the specified file.
       * @param doc
       * @param filename
       * @param formatting
      public static void printDocToFile(Document doc, String strFileName,
          boolean formatting)
        XMLOutputter xmlOut = null;
        if (!formatting)
          xmlOut = new XMLOutputter();
        } else
          Format prettyFormat = Format.getPrettyFormat();
          prettyFormat.setOmitEncoding(false);
          prettyFormat.setOmitDeclaration(false);
          xmlOut = new XMLOutputter(prettyFormat);
        try
          if (doc != null)
            FileWriter writer = new java.io.FileWriter(strFileName, true);
            xmlOut.output(doc, writer);
            writer.flush();
            writer.close();
          } else
            System.out.println("Document is null.");
        catch (Exception ex)
          System.out.println(ex);
      }

  • Is there a way to edit a PDF file without converting it into a word document?

    Is there a way to edit a PDF file without converting it into a word document?

    Then you posted in the wrong forum...
    At any rate, you can use the Edit Text & Images tool (under Tools - Content Editing) to make changes to the file. You'll need to be a bit more specific about what you want to change if you want more detailed instructions.

  • I want to transform an object into a XML-String

    Hallo,
    in my BSP I want to transform an object into a xml string to set a server side cookie.
    Therefore my code is:
      DATA:
        lv_xml      TYPE string,
        lv_username TYPE string.
    model    ?= get_model( model_id = 'main' ).
      lv_username = sy-uname.
      Call TRANSFORMATION id SOURCE o = model  RESULT XML lv_xml.
      cl_bsp_server_side_cookie=>set_server_cookie(
            name                  = 'MODEL'
            application_name      = runtime->application_name
            application_namespace = runtime->application_namespace
            username              = lv_username
            session_id            = runtime->session_id
            data_value            = lv_xml
            data_name             = 'MODEL'
            expiry_time_rel       = 3600 ).
    But after the command "Call Transformation" the xml-string doesn't contain all the data of my object, only this:
    <?xml version="1.0" encoding="iso-8859-1"?>#<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><O href="#o19"/></asx:values><asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary"> <cls:ZCL_M_ESS_TRV_OVW id="o19"/
    ></asx:heap></asx:abap>
    What is wrong?
    Regards.
    Martin

    see thread nr.: Re: Call transformation with an object

  • Inserting PI into generated XML document

    Can anyone tell me how to insert processing instructions into an XML document generated using the xmlcg generated classes? I understand that I can create a PI using the Document::createProcessingInstruction() method but how do I add it as a sibling to the root element? Any insight in this regard will be really appreciated.

    Your question is not very clear.
    Do you want to know How to insert an element into an XML document?
    Answer: I can see you already know how to do it. You have added the element using addContent()
    or do you want to know How to display the XML in a tidy format?
    Answer: to view the XML in a properly formatted style you can you the Format class. A very basic way of viewing the XML would be:
       * Prints the Document to the specified file.
       * @param doc
       * @param filename
       * @param formatting
      public static void printDocToFile(Document doc, String strFileName,
          boolean formatting)
        XMLOutputter xmlOut = null;
        if (!formatting)
          xmlOut = new XMLOutputter();
        } else
          Format prettyFormat = Format.getPrettyFormat();
          prettyFormat.setOmitEncoding(false);
          prettyFormat.setOmitDeclaration(false);
          xmlOut = new XMLOutputter(prettyFormat);
        try
          if (doc != null)
            FileWriter writer = new java.io.FileWriter(strFileName, true);
            xmlOut.output(doc, writer);
            writer.flush();
            writer.close();
          } else
            System.out.println("Document is null.");
        catch (Exception ex)
          System.out.println(ex);
      }

  • Parsing the return value from a http request into a xml document?

    suppose a url "http;//abc.com/index.asp" that return a string like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <bbsend>
    <title>xml testing</title>
    - <record>
    <sender>111111</sender>
    <date>2004-01-05 04:11:44</date>
    <message>yes!</message>
    </record>
    - <record>
    <sender>22222222</sender>
    <date>2004-01-14 01:06:31</date>
    <message>A</message>
    </record>
    </bbsend>
    how can i parsing this return value into a xml document???
    i try something like this:
    URL url = new URL("http://abc.com/index.asp");
    HttpURLConnection http = (HttpURLConnection)url.openConnection();
    DataInputStream in = new DataInputStream(http.getInputStream());               
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    document = builder.parse(in);
    System.out.println(document.getNodeValue());
    But fail , can anyone help

    do u mean get the xml content??
    i am doing a project with BBSend
    [email protected]

  • Save an Image object into a XML text document

    ello:
    I have a problem with saving an image. I need to encapsulate it into two XML tags:
    <Image> xxxxxx </Image>
    The "xxxx" must be a String that represents my Image object.
    In J2ME I haven't serialization, and all the examples about "manual serialization" works with primitive types :(
    I've already read that I can do .getRGB() over my Image object, and obtain an array of int, wich represent each pixel. Ok, I can transform the array into a String, and write it in my XML text document, but later: how I obtain my array from that String?
    Thak you very much

    private Image img;
    byte rgb[] = null;
    private rgbLength; // get lenth of your string
    rgb = new byte(rgbLength);
    rgb = ... //load data from string to this array
    img = createRGBImage(rgb, int width, int height, false) ;You must know length of your string and must encapsulate in to XML width and height of this image;

  • Convert flat file to XML document and store into Oracle database

    First:
    I have a flatfile and created external table to read that file in Oracle
    Now I want to create an XML document for each row and insert into Oracle database, I think that XMLtype.
    Could you please provide me some information/steps.
    Second:
    Is there performance issues, because everyday I need to check that XML document stored in the database against the in coming file.
    Thank You.

    Oracle 11g R2 Sun Solaris
    Flat file is | (pipe delimited), so I did create an EXTERNAL Table
    row1     a|1|2|3|4
    row2     b|2|3|4|5
    row3     c|6|7|8|9
    I want to store each record as XML document. So it will be easy to compare with next day's load and make insert or update.
    The reason is:
         First day the file comes with 5 columns
         after some days, the file may carry on some additional columns more than 5
         In this case I do not want to alter table to capture those values, if I use XML than I can capture any number of columns, CORRECT!. Please make me correct If I am wrong.
         This is the only reason to try to use the XMLType (XML Document)
         On Everyday load we will be matching these XML documents and update it if there is any column's value changes
    daily average load will be 10 millions and initial setup will be 60-80 millions
         Do I have anyother option to capture the new values without altering the table.
    Please advise!.

  • How do I add (or insert) a node into an XML document with JSTL?

    Dear all,
    I am trying to use JSTL to store some data from a form into XML. However, I have read many articles in JSTL and only found that it can only be, as far as those articles are concerned, used to "read" data from XML files, but not "write" to them.
    Am I missing something in JSTL? Or, if I want to write to an XML file (e.g., insert a new node, or modify a node's data), will I have to write my own bean and then use <c:usebean />?
    Thanks very much in advance.
    Regards,
    Robert

    JSTL is not a programming language in and of itself. It is intended to help you to write scriptlet free JSPs.
    JSP pages (by one school of thought) are intended to function as the "View" in a Model-View-Controller architecture.
    Being a view, JSP pages should be able to look at things - but not touch.
    The standard pattern is to go to a servlet first, which invokes the logic, and then forwards to a JSP for rendering.
    Editing XML by adding new nodes etc etc is thus a function of the java code layer - servlet/action whatever you want to call it.
    Giving you the power to edit XML documents via JSTL (ie on a JSP page) takes away from purity of the MVC design.
    Hence why they don't provide the tags for manipulating XML, and only provide the database tags with a disclaimer that they should only be used for prototypes/trivial apps!
    JSTL is designed to replace scriptlet code on a JSP page.
    It can replace 99% of scriptlet code. The other 1% shouldn't be on the JSP in the first place :-)
    cheers,
    evnafets

  • Convert tline into pdf file document in Java

    Dear ALL,
         I built a RFC FM to convert smartform into tline which including PDF data.
    the Code:
       Converting to PDF Format
      DATA l_lines TYPE TABLE OF tline WITH HEADER LINE.
    *  DATA l_lines1 TYPE TABLE OF solix_tab WITH HEADER LINE.
      DATA l_docs TYPE TABLE OF docs.
      DATA len TYPE i.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize           = len
        TABLES
          otf                    = job_output_info-otfdata[]
          doctab_archive         = l_docs[]
          lines                  = l_lines[]                          "this inner table include pdf file data
        EXCEPTIONS
          err_conv_not_possible? = 1
          err_otf_mc_noendmarker = 2
          OTHERS                 = 3.
      *CALL METHOD cl_gui_frontend_services=>gui_download
      *  EXPORTING
      *   bin_filesize = len
      *    filename     = 'c:\pdf.pdf'
      *    filetype     = 'BIN'
      *   CHANGING
      *    data_tab     = l_lines[]"i_objbin[]
      *  EXCEPTIONS
      *    OTHERS       = 1.
    "If i want to save it in my PC ,call this FM CALL METHOD cl_gui_frontend_services=>gui_download.
    But i dont want to do it.I want to pass the parameter l_lines[] to java(web) by RFC, and convert to pdf file and show in java(web).
    thanks
    Freddy

    Hi,
    Update:
    I have tested this and here is some code:
    SAP:(I got the OTF from CALL FUNCTION 'PRINT_TEXT')
    FORM get_pdf_data
      USING
        tdname TYPE thead-tdname
      CHANGING
        it_tline TYPE text_line_tab
        bin_file TYPE xstring .
      DATA: st_thead TYPE thead .
      DATA: it_lines TYPE tline_tab .
      st_thead-tdobject = 'TEXT' .
      st_thead-tdname   = tdname .
      st_thead-tdid     = 'ST' .
      st_thead-tdspras  = 'E'  .
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          id                      = st_thead-tdid
          language                = st_thead-tdspras
          name                    = st_thead-tdname
          object                  = st_thead-tdobject
        IMPORTING
          header                  = st_thead
        TABLES
          lines                   = it_lines
        EXCEPTIONS
          id                      = 1
          language                = 2
          name                    = 3
          not_found               = 4
          object                  = 5
          reference_check         = 6
          wrong_access_to_archive = 7
          OTHERS                  = 8.
      IF sy-subrc NE 0 .
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .
      ENDIF.
      DATA: it_otfdata TYPE otf_t_itcoo .
      DATA: st_options TYPE itcpo.
      st_options-tdgetotf = abap_true .
      CALL FUNCTION 'PRINT_TEXT'
        EXPORTING
          dialog                   = abap_false
          header                   = st_thead
          OPTIONS                  = st_options
        TABLES
          lines                    = it_lines
          otfdata                  = it_otfdata
        EXCEPTIONS
          canceled                 = 1
          device                   = 2
          form                     = 3
          OPTIONS                  = 4
          unclosed                 = 5
          unknown                  = 6
          format                   = 7
          textformat               = 8
          communication            = 9
          bad_pageformat_for_print = 10
          OTHERS                   = 11.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      DATA: it_otfdata_m TYPE otf_t_itcoo .
    * "Merge pdf output demo"
      APPEND LINES OF it_otfdata TO it_otfdata_m .
    * DATA: bin_file TYPE xstring .
      DATA: it_lines_dummy TYPE tline_tab .
      DATA: bin_filesize TYPE i .
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
        IMPORTING
          bin_file              = bin_file
          bin_filesize          = bin_filesize
        TABLES
          otf                   = it_otfdata_m
          lines                 = it_lines_dummy
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          err_bad_otf           = 4
          OTHERS                = 5.
    ENDFORM.                    " GET_PDF_DATA
    Java:
    final byte[] byteArray = function.getExportParameterList().getByteArray("BIN_FILE");
    final Path path = Paths.get("My.pdf");
    Files.write(path, byteArray, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
    regards.
    Another update:
    Using in HttpServlet:
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import com.sap.conn.jco.JCoDestination;
    import com.sap.conn.jco.JCoDestinationManager;
    import com.sap.conn.jco.JCoException;
    import com.sap.conn.jco.JCoFunction;
    import com.sap.conn.jco.JCoRepository;
    import com.sap.conn.jco.ext.Environment;
    import destinations.MyDestination;
    public class MyServlet extends HttpServlet {
    @Override
    protected void doGet(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws ServletException, IOException {
      httpServletResponse.setContentType("application/pdf");
      httpServletResponse.setStatus(HttpServletResponse.SC_OK);
      final ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream();
      servletOutputStream.write(getPDF());
      servletOutputStream.flush();
      servletOutputStream.close();
    private byte[] getPDF() {
      try {
       Environment.registerDestinationDataProvider(new MyDestination());
       final JCoDestination destination = JCoDestinationManager.getDestination(destinations.Id.sapdev2.name());
       final JCoRepository repository = destination.getRepository();
       final JCoFunction function = repository.getFunction("Y_R_EITAN_TESTS_03");
       function.execute(destination);
       final byte[] byteArray = function.getExportParameterList().getByteArray("BIN_FILE");
       return byteArray;
      } catch (final JCoException exception) {
       exception.printStackTrace();
       return null;

  • Converting HTML into a Word document

    Hi all,
    I have a JSP whose content type is set so that the HTML it produces is opened up in Word. Now this works fine until images come into the equation, as these images must lie somewhere in order to be referenced from the HTML code. As this document must be 'stanalone', booting up the HTML in Word and simply changing the file extension is no good as it is still HTML under the hood.
    What I therefore would like to do it generate a Word document from this HTML that is independent in the fact that it 'holds' these images within itself and does not rely on external resources. Does anyone know how I can achieve this?
    I have looked into Jakarta POI and have written this off as an option because 1) it is still in development and 2) there is no documentation or examples of how to use what is already there. I am assuming someone has come across this problem before and knows of a solution out there that I could use.
    Many thanks in advance!

    HI,
    Thanks all for your replies! Unfortuantely it can't be PDF as the creator will need to edit it before the document is complete. I have actually looked into generating an RTF document instead, but the example I tried seemed to loose the image data. Unfortuantely I know nothing about RTF and so kind of gave up on it :(
    Here is the code I used:
    import java.io.ByteArrayOutputStream;
    import java.io.StringReader;
    import java.io.IOException;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.html.HTMLDocument;
    import javax.swing.text.StyledEditorKit;
    import javax.swing.text.rtf.RTFEditorKit;
    import javax.swing.text.html.HTMLEditorKit;
    public class FormatConverter {
         private HTMLDocument tempHTMLDoc;
         private HTMLEditorKit htmlKit;
         private RTFEditorKit rtfKit;
         public FormatConverter() {
              tempHTMLDoc = new HTMLDocument();
              htmlKit = new HTMLEditorKit();
              rtfKit = new RTFEditorKit();
         private String fudge(String strText) {
              String strResult = "";
              StringReader reader = new StringReader(strText);
              try {
                   tempHTMLDoc.remove(0,tempHTMLDoc.getLength());
                   htmlKit.read(reader,tempHTMLDoc,0);
                   ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                   rtfKit.write(byteArrayOutputStream,tempHTMLDoc,0,tempHTMLDoc.getLength());
                   strResult = byteArrayOutputStream.toString();
              catch(IOException ie){}
              catch(BadLocationException ble){}
              return strResult;
         public static void main(String args[]) {
              FormatConverter conv = new FormatConverter();
              String strRTF = conv.fudge("<P><IMG src=\"http://intratestgbr/announcements/images/1093429553065.jpg\"></P><P> </P><P>50 <STRONG>pounds</STRONG>, <FONT color=#0000ff>wow</FONT></P>");
              System.out.println("RTF: '"+strRTF+"'");
              strRTF = conv.fudge("<html><head><p class=default><span style=\"color: #000000\">Description </span><span style=\"color: #000000\"><b>with</b> </span><span style=\"color: #000000\"><i>some</i> </span><span style=\"color: #000000\"><u>formatting</u> </span><span style=\"color: #000000\"></span></p></head></html>");
              System.out.println("RTF: '"+strRTF+"'");
              System.exit(0);
    }The output I got from this was:
        \rtf1\ansi
            \fonttbl\f0\fnil Monospaced;
            \colortbl\red0\green0\blue0;\red0\green0\blue255;
        \par
        \~50 pounds, \cf1 wow\par
    }Like I said, when I open the RTF output in Word, everything is fine apart from the missing image. If one of you very nice people could point me in the right direction of a way to convert it to RTF instead while still maintaining the images this would certainly be a very acceptable solution and I would be very grateful :)
    Many thanks again!

  • Converting objects into Strings

    How would someone convert an object of say (String, int, double, String) into a readable string. I tried the toString() method but all I get is something like this
    Student@1f12c4e

    ..I'm not sure I understand "how" to override. The whole point of this project is to use quicksort on a list of students, unfortunately all I get is the address whenever I use the .toStrings() method.
    Here's what I have, any help would be greatly appreciated-so very close
    import cs1.Keyboard;
    import java.io.*;
    import java.util.*;
    public class StudentTraverse
    public static void main(String[] args)
    String newName;
    int newSocial;
    double newGPAs;
    String newMajors;
    System.out.println("How many Students would you like to add");
    Student newStudent;
    StudentList12 WORK = new StudentList12();
    int total = Keyboard.readInt();
    for(int number = total; number > 0; number--)
    System.out.println("Name?");
    newName = Keyboard.readString();
    System.out.println("Social?");
    newSocial = Keyboard.readInt();
    System.out.println("GPA?");
    newGPAs = Keyboard.readDouble();
    System.out.println("Major?");
    newMajors = Keyboard.readString();
    newStudent = new Student(newName, newSocial, newGPAs, newMajors);
    System.out.println("Inserting: "+newStudent.toString());
    WORK.add(newStudent);
    for(total = 0; total < WORK.size(); total++)
    System.out.println("top" total": "+WORK.top(total).toString());
    try
    BufferedReader in = new BufferedReader(new FileReader("LIST.out"));
    while (in.ready())
    // Print file line to scree
    System.out.println (in.readLine());
    in.close();
    catch (Exception e)
    System.err.println("File input error");
    public class StudentNode
    public Student student;
    public StudentNode next;
    public StudentNode()
    next = null;
    student = null;
    public StudentNode(Student d, StudentNode n)
    student = d;
    next = n;
    public void setNext(StudentNode n)
    next = n;
    public void setData(Student d)
    data = d;
    public StudentNode getNext()
    return next;
    public Student getData()
    return data;
    public String toString()
    return ""+data;
    public StudentNode(Student newStudent)
    METHOD NAME: StudentNode
    AUTHOR:
    DATE OF CREATION: Nov 20, 2004
    DATE OF UPDATES: Nov 28, 2004
    PURPOSE: Acts as a node for the Student list
    ALGORITHM:Acts as node for the list
    INSTANCE VARIABLES: none
    student = newStudent;
    next = null;
    public class Student
    private String name;
    private int social;
    private double GPA;
    private String Major;
    public Student(String newName, int newSocial, double newGPAs, String newMajors)
    METHOD NAME: Student
    AUTHOR:
    DATE OF CREATION: Nov 20, 2004
    DATE OF UPDATES: Nov 28, 2004
    PURPOSE: The actual Student class, determines what is allowed in the array
    ALGORITHM:Declare what variables will be needed for the program
    INSTANCE VARIABLES: String name, int social, double GPA, String Major
    name = newName;
    social = newSocial;
    GPA = newGPAs;
    Major = newMajors;
    import java.io.*;
    import cs1.Keyboard;
    import java.io.BufferedWriter;
    import java.util.*;
    public class StudentList12
    private StudentNode list;
    static int i = 0;
    public StudentList12()
    METHOD NAME: StudentList12
    AUTHOR:
    DATE OF CREATION: Nov 20, 2004
    DATE OF UPDATES: Nov 28, 2004
    PURPOSE: Declares the Node
    ALGORITHM:Declare the Node
    INSTANCE VARIABLES: none
    list = null;
    public boolean isEmpty()
    return list == null;
    public int size()
    return i;
    public void add(Student newStudent)
    METHOD NAME: add
    AUTHOR:
    DATE OF CREATION: Nov 20, 2004
    DATE OF UPDATES: Nov 28, 2004
    PURPOSE: Let's users add objects to the array of objects
    ALGORITHM:Traverses the current list and adds object to the end
    INSTANCE VARIABLES: none
    list = new StudentNode(newStudent, list);
    i++;
    current = current.next;
    current.next = node;
    public Student remove()
    if(isEmpty())
    return null;
    StudentNode tmp = list;
    list = tmp.getNext();
    i--;
    return tmp.getData();
    public void insertEnd(Student newStudent)
    if(isEmpty())
    add(newStudent);
    else
    StudentNode t = list;
    while(t.getNext() != null)
    t=t.getNext();
    StudentNode tmp = new StudentNode(newStudent, t.getNext());
    t.setNext(tmp);
    i++;
    public Student removeEnd()
    if(isEmpty())
    return null;
    if(list.getNext() == null)
    return remove();
    StudentNode t = list;
    while(t.getNext().getNext() != null)
    t = t.getNext();
    Student newStudent = t.getNext().getData();
    t.setNext(t.getNext().getNext());
    i--;
    return newStudent;
    public Student top(int n)
    StudentNode t = list;
    for(int i = 0; i <n && t != null; i++)
    t = t.getNext();
    return t.getData();
    public void writeToFile(int n)
    int z = n;
    try
    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("LIST.out")));
    for(int counter = z; counter >= 0; counter--)
    System.out.println(counter);
    out.close();
    catch(Exception e)
    System.err.println("Couldn't Write File");
    try
    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("LIST.out")));
    out.write(list.toString());
    out.close();
    catch(Exception e)
    System.err.println("Couldn't Write File");
    }

  • How to add a new node into existing XML Document

    I have a very simple question. I use XML as input argument for PL/SQL procedure that inserts data into the corresponding table. All I have to do is to add a new tag for Primary Key column and put sequence.NEXTVAL - value into it.
    <ROWSET>
    <ROW>
    -- Add <ID_table_name> value </ID_table_name> ??????
    <FIELD1>data1</FIELD1>
    <FIELD2>data1</FIELD2>
    </ROW>
    </ROWSET>
    I've parsed XML, but I couldn't find the way how to insert the new NODE.
    If you know how to use packages XMLDOM, XMLParser for this purpose, please help me!
    Oracle version 8.1.7

    DOMParser parser=new DOMParser();
    XMLDocument xmlDocument=parser.getdocument();
    Node node=xmlDocument.selectSingleNode("/ROWSET/ROW");
    Element element=xmlDocument.createElement(String tagName)
    node.appendChild(element);

  • Can I import an object into a pages document

    Am using pages for the first time and need a quick answer, can I import objects and use in a pages document
    KL

    http://help.apple.com/pages/ipad/1.6/#tan72488430

Maybe you are looking for