How do you pass a string into xml

How do we pass a string to be parsed as xml
something like
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
oc = docBuilder.parse (String s);
Thanks
Arnold

String xmlString = "<?xml version=\"1.0\"?>\n<myelement myattribute=\"myvalue\"/>\n";
InputSource inputSource = new InputSource(new StringReader(xmlString));
Document document = builder.parse(inputSource);

Similar Messages

  • How do you turn a string into an integer?

    how do you turn a string into an integer?
    for ex, if i wanted to turn the string "5" into the integer 5, how would i do that?

    String stringNumber="5";
    try{
    int number=Integer.parseInt(stringNumber);
    }catch(NumberFormatException e){
    System.out.println("The string "+stringNumber+" must be a number!");
    }

  • How do you convert this String into a double?

    Hi, in this code I want to convert String arg into a double. I'm trying to do this so that I can convert some string into a double in this calculator that I'm making. Here is the code:
    public class par {
    public static void main(String[] args) {
    String str = "351";
    double arg = new double(str); // should convert the string into a double
         System.out.println(arg);
         System.out.println(str);
    I keep getting errors in line 4, if any of you could help me out here I'll be thankful, i'm kinda new to java and my search for java's equivalent of alof() (its a function in C libraries that converts char[] into a double)lead me to this.
    Tony L.

    Use the Following:
    String num = "123.2";
    double d = Double.parseDouble(num);

  • How do you pass XML as a URL param?

    How do you pass XML as a URL param?
    Thanks!

    I don't know why I wasn't thinking about this when I made my
    last post. If they're pasting some XML into a form, that's one
    thing. But if they need to send XML to your site from their own,
    you can setup a Coldfusion Component (CFC) as a Web Service to
    accept XML through a WSDL call.
    Check out the
    Coldfusion
    Developers Center for
    articles
    on creating web services

  • How to convert Java string into XML one?

    With SAX I can parse an xml file, but I should create xml file by hands.
    Ok, it's simple, but how to encode java string into XML constant
    like "Hello & goodby" into "Hello & goodby" ?
    Is there a standard method for such special xml characters?

    If you are creating your XML "by hand" then just make sure your hands know that you have to do that. It isn't difficult to write a Java method to do it, if "by hand" means "in Java code". Otherwise your XML is not well-formed. And as far as I know there is no package that takes ill-formed XML and fixes it up.

  • Passing a string into an SQL query IN statement

    Hello,
    I need to connect to a database to pull some data to dynamically create a form based on the data I pull back. My SQL query works fine when I manually run it through a SQL client tool, but when I try to pass it through my workflow I'm having trouble with passing my string into the IN part of the statement. So if for example my SQL query is:
    SELECT Field1, Field2, Field3 FROM Table1 WHERE Field4 IN (?)
    I have a process variable that has the string I'm trying to pass into the ?, but I don't seem to be able to get the query to run. I have tried setting up my query to run as a Parameterized Query (passing my string process variable into the ?), and by setting the query up through xPath (where I am calling my process variable with an xPath declaration), but am not having any luck.
    The process variable I am trying to pass is formatted such that I'm passing 'Value1','Value2','Value3' but I can reformat this string if need be. Even with using test data I can't get the query to return anything. For test data I have tried: 'Value1','Value2','Value3' ; Value1','Value2','Value3 ; Value1,Value2,Value3 but the query never returns any data. I can't seem to see how to format the string to pass into the query. The Query will work with a single Value in the test data, but as soon as I try to pass multiple values within the string it fails. Any suggestions?

    The problem looks to be a limit on what I can pass into the SQL query component. My string is coming from data returned from another database. I take the xml output from that database call, pass it through a set variable component to remove my xml tags from the string, and then format the string in a script component (I have to do it this way because of the way the data coming out of my first database call). I've put in loggers, and can see that the string I'm passing into my query that is giving me problems, is formatted the same way as if I were to use the concat function Scott listed above. It looks like there is a limitation on what can be passed in my variable. I have tried creating my entire SQL query statement in a set variable component, and then just calling the process variable that holds that statement, but there is a character limit of 128 character for what can be passed in a variable through xpath in the SQL query component.
    The next thing I tried was changing my SQL where clause. Instead of passing my variable directly into the IN statement I set up a PATINDEX('%:'+countyname+ ':%', ?) > 0 call to check for the values in my database call. As you can see I took out the "," that I was passing as part of my string, thinking that the SQL component was getting confused by them, and placed ":" characters around my values being passed in my string variable. No matter what I try to do though I'm not able to get the query to run. The component looks like it is taking my string, and is seeing the whole thing as a string instead of passing it as individual values within a string.
    I think I'm getting close, but I keep getting a Content not allowed in prolog exception in the server logs.

  • How can I pass a value into a page fragment?

    How can I pass a value into a page fragment?
    I am implementing four search screens. And the only thing different about them will be their backing bean.
    So I’d like to do something like have four pages, each which retrieves its appropriate backing bean, sets that bean to a variable, and then includes a page fragment which contains the generic search page code (which will make use of that variable).
    The code in the four pages would be something like this:
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <c:set var="searchPageBackingBean"
    value="#{pageFlowScope.employeeSearchPageBean}"
    scope="page"/>
    <jsp:include page="./SearchPageBody.jsff"/>
    </jsp:root>
    At this point, what I’m seeing is that the fragment page, SearchPageBody.jsff, has no visibility of the searchPageBackingBean variable, either referencing it as #{pageFlowScope.searchPageBackingBean} or just #{searchPageBackingBean}

    The following will work, assuming you are needing to access a managed bean:
    Put this in the parent page:
    <c:set var="nameOfSearchPageBackingBean"
    value="employeeSearchPageBean"
    scope="request"/>
    Put this in the child, SearchPageBody.jsff:
    <c:set var="searchPageBean"
    value="#{pageFlowScope[nameOfSearchPageBackingBean]}"
    scope="page"/>

  • Convert string into XML inside BPEL

    Hello ,
    How to convert string into xml format ? And make element and define attribute inside it ??

    There are several problems with your input:
    1. Your xml is not well-formed because the attribute values should be enclosed withing double " quotes and not single ' quotes;
    2. You use a prefix (sml) for the folowing part but you dont define the namespace:
    <ids>
    <VID ID="new"/>
    <data>
    <*sml:*attr name="std">
    <sml:value></sml:value>
    </sml:attr>
    <sml:attr name="xde">
    <sml:value></sml:value>
    </sml:attr>
    </data>
    </ids>
    Complete message should be:
    <ids xmlns:sml="somenamespace">
    <VID ID="new"/>
    <data>
    <sml:attr name="std">
    <sml:value></sml:value>
    </sml:attr>
    <sml:attr name="xde">
    <sml:value></sml:value>
    </sml:attr>
    </data>
    </ids>
    3. Do you assign this expression to a variable that is based on the schema of your message you want to parse
    Regards,
    Melvin
    * TIP Answer the question as helpful or correct if it helps you , so that someone else will be knowing that this solution helped you or worked for you and also it gives points to the person who answers the question. *

  • How to download internal table data into xml file?

    Hi,
    Experts,
    I have downloaded internal table data into XLS format using GUI_DOWNLOAD Function module, But i didn't Know how to download internal table data into XML format please post some ideas/inputs on this issue.
    Thank you,
    Shabeer ahmed.

    check this
    data : gd_repid type sy-repid.
    GD_REPID = SY-REPID.
    DATA : L_DOM TYPE REF TO IF_IXML_ELEMENT,
           M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
           G_IXML TYPE REF TO IF_IXML,
           W_STRING TYPE XSTRING,
           W_SIZE TYPE I,
           W_RESULT TYPE I,
           W_LINE TYPE STRING,
           IT_XML TYPE DCXMLLINES,
           S_XML LIKE LINE OF IT_XML,
           W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
          BEGIN OF XML_TAB OCCURS 0,
          D LIKE LINE OF XML,
          END OF XML_TAB.
    data : l_element           type ref to if_ixml_element,
           xml_ns_prefix_sf     type string,
           xml_ns_uri_sf        type string.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
       NAME = 'REPAIRDATA'
       DATAOBJECT = IT_FINAL_LAST1[]
    IMPORTING
       DATA_AS_DOM = L_DOM
    CHANGING
       DOCUMENT = M_DOCUMENT
    EXCEPTIONS
       ILLEGAL_NAME = 1
       OTHERS = 2.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    *Start of code for Header
    * namespace
    t_mnr = sy-datum+4(2).
    CALL FUNCTION 'IDWT_READ_MONTH_TEXT'
      EXPORTING
        LANGU         = 'E'
        MONTH         = t_mnr
    IMPORTING
       T247          = wa_t247
    concatenate sy-datum+6(2)
                wa_t247-ktx
                sy-datum(4) into t_var1.
    concatenate sy-uzeit(2)
                sy-uzeit+2(2)
                sy-uzeit+4(2) into t_var2.
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    l_element  = m_document->get_root_element( ).
    xml_ns_prefix_sf = 'TIMESTAMP'.
    concatenate t_var1 t_var2 into xml_ns_uri_sf separated by space.
    clear : t_var1,
            t_var2,
            t_mnr,
            wa_t247.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'FILECREATOR'.
    xml_ns_uri_sf    =   'SAP'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMGROUP'.
    xml_ns_uri_sf    = '1'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMTYPES'.
    xml_ns_uri_sf    = 'W'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    *End of Code for Header
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
      DOCUMENT = M_DOCUMENT
    IMPORTING
      XML_AS_STRING = W_STRING
      SIZE = W_SIZE
    TABLES
      XML_AS_TABLE = IT_XML
    EXCEPTIONS
      NO_DOCUMENT = 1
      OTHERS = 2.
    LOOP AT IT_XML INTO XML_TAB-D.
    APPEND XML_TAB.
    ENDLOOP.
    *Start of Code for File name
    concatenate p_file
                '\R'
                '000_119481'
                sy-datum+6(2) sy-datum+4(2) sy-datum+2(2)
                sy-uzeit(2)   sy-uzeit+2(2) sy-uzeit(2) '.xml' into p_file.
    *End of Code for File name
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE = W_SIZE
      FILENAME = p_file
      FILETYPE = 'BIN'
    TABLES
      DATA_TAB = XML_TAB
    EXCEPTIONS
      OTHERS = 10.
    IF SY-SUBRC  = 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • How to convert a delimited string to XML?

    Hi there,
    Please help me to convert a pipe delimited string into XML, e.g.
    string -------SubName:abc|SuvValue:123|
    required XML:
    <ROWS>
    <ROW>
    <SubName>abc</SubName>
    <SubValue>123</SubValue>
    </ROW>
    </ROWS>
    or
    string -------abc|123|
    required XML:
    <ROWS>
    <ROW>
    <SubName>abc</SubName>
    <SubValue>123</SubValue>
    </ROW>
    </ROWS>
    -----i am trying to first parse the string into a table type and then using the DBMS_XMLGen.getXML function but unable to get values from table type...
    any prompt response is highly appriciated...
    Regards, Hassan

    Hi Hassan,
    If your version supports it (ie 10gR2 and upwards), you can use XQuery to directly parse the string and generate the XML :
    SQL> SELECT XMLQuery(
      2   '<ROWS>
      3    <ROW> {
      4     for $i in ora:tokenize($str,"\|")
      5     return
      6      if ($i) then element {substring-before($i,":")} {substring-after($i,":")}
      7      else ()
      8   } </ROW>
      9   </ROWS>'
    10   passing sys_xmlgen('SubName:abc|SubValue:123|') as "str"
    11   returning content
    12  ).getClobVal()
    13  FROM dual;
    XMLQUERY('<ROWS><ROW>{FOR$IINO
    <ROWS><ROW><SubName>abc</SubName><SubValue>123</SubValue></ROW></ROWS>
    Each element is built based on its name from the input string.

  • Convert XML string into XML

    Hi All,
    Can you please let me know for any sample code in xslt/java mapping for converting XML string into XML. We use SAP Pi 7.0
    My XML string starts like this
    <?xml version="1.0" encoding="UTF-8" ?> 
    - <ns0:MT_ReceiverFileStructure <namespace>"><Output><?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<xsl>"?><Tarih_Date Tarih="11.09.2014" Date="09/11/2014>
       Thanks,
       Pavithra

    Thanks Praveen. It worked.
    However, the xml i have is an extract from a exchange rate URL and it has the reference to a xsl in it as below
    <?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<ABC.xsl>"?>.
    So there is an error in sxmb_moni. Is it possible to remove this.

  • How i can pass the value into 1 line

    Hi expert,
    how do i pass all the value for sales document flow item in one line?
    i'm using this function
    CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
        EXPORTING
          aufbereitung  = '2'
          belegtyp      = i_del-vbtyp
          comwa         = l_comwa
          nachfolger    = ' '
          vorgaenger    = 'X'
          v_stufen      = '50'
        TABLES
          vbfa_tab      = lt_vbfa
        EXCEPTIONS
          no_vbfa       = 1
          no_vbuk_found = 2
          OTHERS        = 3.
    so now lt_vbfa already got data line by line....
    line 1 : contract : 00010 : 1000000 : 19,000.00
    line 2 : order     : 00010 : 2000000 : 10000.00
    line 3 : delivery : 00010 : 3000000 : 10000.00
    how i can pass the value into 1 line?
    for example :
    contract  | line     | amount     | Order     | line     | amount    | delivery   | line     | amount     |
    1000000 | 00010| 19,000.00 | 2000000 |00010 | 10000.00 | 3000000 | 00010 | 10000.00 |
    Edited by: anuar jusoh on Aug 17, 2009 4:02 AM

    Hi,
    What is requirement for passing the data in a single line ? Do you finally need to append the same in the internal table and pass it in the module ?
    You can create an internal table of type 1000 character and can loop the existing internal table. Then you can append the Work area in a single line and can finally append it to the table.
    DATA : ITAB type standard table of char1000.
    Loop at <existing table>.
    concatenate table work area wa_char100 into Itab_char_1000.
    endloop.
    APPEND itab_char_1000 into itab.
    Hope this helps.
    Thanks,
    Samantak.

  • How do you set an image into the background of a JPanel or JFrame?

    How do you set an image into the background of a JPanel or JFrame?

    Something like this, Ive thrown in an ImageIcon on a
    button too for good measure.
    import java.awt.*;
    import javax.swing.*;
    public class JFrameImage extends JFrame {
    public JFrameImage() {
    Container c    = getContentPane();
    JPanel panel = new JPanel(){
                 public void paintComponent(Graphics g)     {
    ImageIcon img = new
    = new ImageIcon("background.jpg");
                      g.drawImage(img.getImage(), 0, 0, null);
                      super.paintComponent(g);
            panel.setOpaque(false);
    ImageIcon icon = new ImageIcon("onButton.jpg");
    JButton button = new JButton(icon);
    panel.add(button);
    c.add(panel);
    public static void main(String[] args) {
    JFrameImage frame = new JFrameImage();
    frame.setSize(200,200);
    frame.setVisible(true);
    Going totally fancy pants
    ImageIcon bigImage = new ImageIcon(bgImage.getImage().getScaledInstance(getWidth(), getHeight(),Image.SCALE_REPLICATE));
    g.drawImage(bigImage.getImage(), 0, 0, this); Will scale the image to the size of the panel
    whereas
    for (int y = 0; y  < getHeight(); y = y + image.getHeight(null))
    for (int x = 0; x< getWidth(); x = x + image.getWidth(null))
    g.drawImage(image, x, y, this); Will give a tiled effect
    Try tiling with an animated gif and bring your processor to a standstill.

  • How can i write a string into a specified pos of a file?

    How can i write a string into a specified pos of a file without read all file into ram and write the whole file again?
    for example:
    the content of file is:
    name=123
    state=456
    i want to modify the value of name with 789
    (write to file without read all file into ram)
    How can i do it? thank you

    take this as an idea. it actually does what i decribed above. you sure need to make some modifications so it works for your special need. If you use it and add any valuable code to it or find any bugs, please let me know.
    import java.io.*;
    import java.util.*;
    * Copyright (c) 2002 Frank Fischer <[email protected]>
    * All rights reserved. See the LICENSE for usage conditions
    * ObjectProperties.java
    * version 1.0, 2002-09-12
    * author Frank Fischer <[email protected]>
    public class ObjectProperties
         // the seperator between the param-name and the value in the prooperties file
         private static final String separator = "=";
         // the vector where we put the arrays in
         private Vector PropertiesSet;
         // the array where we put the param/value pairs in
         private String propvaluepair[][];
         // the name of the object the properties file is for
         public String ObjectPropertiesFileName;
         // the path to the object'a properties file
         public String ObjectPropertiesDir;
         // reference to the properties file
         public File PropertiesFile;
         // sign for linebreak - depends on platforms
         public static final String newline = System.getProperty("line.separator");
         public ObjectProperties(String ObjectPropertiesFileName, String ObjectPropertiesDir, ObjectPropertiesManager ObjectPropertiesManager)
         //     System.out.println("Properties Objekt wird erzeugt: "+ObjectPropertiesFileName);
              this.ObjectPropertiesFileName = ObjectPropertiesFileName;
              this.ObjectPropertiesDir = ObjectPropertiesDir;
              // reference to the properties file
              PropertiesFile = new File(ObjectPropertiesDir+ObjectPropertiesFileName);
              // vector to put the param/value pair-array in
              PropertiesSet = new Vector();
         //     System.out.println("Properties File Backup wird erzeugt: "+name);
              backup();
         //     System.out.println("Properties File wird eingelesen: "+PropertiesFile);
              try
                   //opening stream to file for read operations
                   FileInputStream FileInput = new FileInputStream(PropertiesFile);
                   DataInputStream DataInput = new DataInputStream(FileInput);
                   String line = "";
                   //reading line after line of the properties file
                   while ((line = DataInput.readLine()) != null)
                        //just making sure there are no whitespaces at the beginng or end of the line
                        line = cutSpaces(line);
                        if (line.length() > 0)
                             //$ indicates a param-name
                             if (line.startsWith("$"))
                                  // array to store a param/value pair in
                                  propvaluepair = new String[1][2];
                                  //get the param-name
                                  String parameter = line.substring(1, line.indexOf(separator)-1);
                                  //just making sure there are no whitespaces at the beginng or end of the variable
                                  parameter = cutSpaces(parameter);
                                  //get the value
                                  String value = line.substring(line.indexOf(separator)+1, line.length());
                                  //just making sure there are no whitespaces at the beginng or end of the variable
                                  value = cutSpaces(value);
                                  //put the param-name and the value into an array
                                  propvaluepair[0][0] = parameter;
                                  propvaluepair[0][1] = value;
                             //     System.out.println("["+ObjectPropertiesFileName+"] key/value gefunden:"+parameter+";"+value);
                                  //and finaly put the array into the vector
                                  PropertiesSet.addElement(propvaluepair);
              // error handlig
              catch (IOException e)
                   System.out.println("ERROR occured while reading property file for: "+ObjectPropertiesFileName);
                   System.out.println("ERROR CODE: "+e);
                   // System.out.println("in ObjectProperties");
         // function to be called to get the value of a specific paramater 'param'
         // if the specific paramater is not found '-1' is returned to indicate that case
         public String getParam(String param)
              // the return value indicating that the param we are searching for is not found
              String v = "-1";
              // looking up the whole Vector
              for (int i=0; i<PropertiesSet.size(); i++)
                   //the String i want to read the values in again
                   String s[][] = new String[1][2];
                   // trying to get out the array from the vector again
                   s = (String[][]) PropertiesSet.elementAt(i);
                   // comparing the param-name we're looking for with the param-name in the array we took out the vector at position i
                   if (s[0][0].equals(param) == true)
                        //if the param-names are the same, we look up the value and write it in the return variable
                        v = s[0][1];
                        // making sure the for loop ends
                        i = PropertiesSet.size();
              // giving the value back to the calling procedure
              return v;
         // function to be called to set the value of a specific paramater 'param'
         public void setParam(String param, String value)
              // looking up the whole Vector for the specific param if existing or not
              for (int i=0; i<PropertiesSet.size(); i++)
                   //the String i want to read the values in again
                   String s[][] = (String[][]) PropertiesSet.elementAt(i);
                   // comparing the param-name we're looking for with the param-name in the array we took out the vector at position i
                   if (s[0][0].equals(param) == true)
                        //if the param-names are the same, we remove the param/value pair so we can add the new pair later in
                        PropertiesSet.removeElementAt(i);
                        // making sure the for loop ends
                        i = PropertiesSet.size();
              // if we land here, there is no such param in the Vector, either there was none form the beginng
              // or there was one but we took it out.
              // create a string array to place the param/value pair in
              String n[][] = new String[1][2];
              // add the param/value par
              n[0][0] = param;
              n[0][1] = value;
              // add the string array to the vector
              PropertiesSet.addElement(n);
         // function to save all data in the Vector to the properties file
         // must be done because properties might be changing while runtime
         // and changes are just hold in memory while runntime
         public void store()
              backup();
              String outtofile = "# file created/modified on "+createDate("-")+" "+createTime("-")+newline+newline;
              try
                   //opening stream to file for write operations
                   FileOutputStream PropertiesFileOuput = new FileOutputStream(PropertiesFile);
                   DataOutputStream PropertiesDataOutput = new DataOutputStream(PropertiesFileOuput);
                   // looping over all param/value pairs in the vector
                   for (int i=0; i<PropertiesSet.size(); i++)
                        //the String i want to read the values in
                        String s[][] = new String[1][2];
                        // trying to get out the array from the vector again
                        s = (String[][]) PropertiesSet.elementAt(i);
                        String param = "$"+s[0][0];
                        String value = s[0][1];
                        outtofile += param+" = "+value+newline;
                   outtofile += newline+"#end of file"+newline;
                   try
                        PropertiesDataOutput.writeBytes(outtofile);
                   catch (IOException e)
                        System.out.println("ERROR while writing to Properties File: "+e);
              catch (IOException e)
                   System.out.println("ERROR occured while writing to the property file for: "+ObjectPropertiesFileName);
                   System.out.println("ERROR CODE: "+e);
         // sometimes before overwritting old value it's a good idea to backup old values
         public void backup()
              try
                   // reference to the original properties file
                   File OriginalFile = new File(ObjectPropertiesDir+ObjectPropertiesFileName);
                   File BackupFile = new File(ObjectPropertiesDir+"/backup/"+ObjectPropertiesFileName+".backup");
                   //opening stream to original file for read operations
                   FileInputStream OriginalFileInput = new FileInputStream(OriginalFile);
                   DataInputStream OriginalFileDataInput = new DataInputStream(OriginalFileInput);
                   //opening stream to backup file for write operations
                   FileOutputStream BackupFileOutput = new FileOutputStream(BackupFile);
                   DataOutputStream BackupFileDataOutput = new DataOutputStream(BackupFileOutput);
              //     String content = "";
                   String line = "";
                   // do till end of file
                   while ((line = OriginalFileDataInput.readLine()) != null)
                        BackupFileDataOutput.writeBytes(line+newline);
              // error handlig
              catch (IOException e)
                   System.out.println("ERROR occured while back up for property file: "+ObjectPropertiesFileName);
                   System.out.println("ERROR CODE: "+e);
                   System.out.println("this is a serious error - the server must be stopped");
         private String cutSpaces(String s)
              while (s.startsWith(" "))
                   s = s.substring(1, s.length());
              while (s.endsWith(" "))
                   s = s.substring(0, s.length()-1);
              return s;
         public String createDate(String seperator)
              Date datum = new Date();
              String currentdatum = new String();
              int year, month, date;
              year = datum.getYear()+1900;
              month = datum.getMonth()+1;
              date = datum.getDate();
              currentdatum = ""+year+seperator;
              if (month < 10)
                   currentdatum = currentdatum+"0"+month+seperator;
              else
                   currentdatum = currentdatum+month+seperator;
              if (date < 10)
                   currentdatum = currentdatum+"0"+date;
              else
                   currentdatum = currentdatum+date;
              return currentdatum;
         public String createTime(String seperator)
              Date time = new Date();
              String currenttime = new String();
              int hours, minutes, seconds;
              hours = time.getHours();
              minutes = time.getMinutes();
              seconds = time.getSeconds();
              if (hours < 10)
                   currenttime = currenttime+"0"+hours+seperator;
              else
                   currenttime = currenttime+hours+seperator;
              if (minutes < 10)
                   currenttime = currenttime+"0"+minutes+seperator;
              else
                   currenttime = currenttime+minutes+seperator;
              if (seconds < 10)
                   currenttime = currenttime+"0"+seconds;
              else
                   currenttime = currenttime+seconds;
              return currenttime;

  • (264361962) Q ADVC-27 How do you pass the security info to access the EJB?

    Q<ADVC-27> How do you pass the security info to access the EJB?
    A<ADVC-27> Authentication for web service users must occur at the web layer. This
    means providing appropriate web resource definitions and restrictions in the web.xml
    file for your project. The most common and useful form of security for application
    interaction is via client-side certificates. Then the client identity is transmitted
    to the EJB is the same way as in regular J2EE environments. There is a complete description
    on security on e-docs:
    http://edocs.bea.com/workshop/docs70/help/guide/security/ovwSecurity.html
    Adam

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (119093)

Maybe you are looking for

  • Getting filename in FTP Adapter in BPEL

    How to retrieve the filename read by the FTP adapter in ora-bpel?

  • Applet or web-start? How can I package a memory intensive app?

    Dear All, I'm new here - I'm learning about Java with a particular project in mind, and looking for advice from people with more experience before I start coding! Your opinions would be very useful. I would like to write a small scientific applicatio

  • Fade effect with DataGrid. Header text are visible ... :(

    Hi, the problem with DataGrid. If I specify the Fade effect for showing DataGrid, all lines are showing correct, so the fade works, but the headers text and the data texts are showing immediately (like without Fade). Is it possible to avoid this effe

  • JDBC Driver for MySQL database which should support JDBC2.0 function

    Hi, Guys, I'm using JDK1.3 and mm.mysql-2.0.4-bin.jar in Windows NT. When I run following program, I got the error: java.sql.SQLException: ResultSet not updatable. (the function rs.last() is working). Based on the documentation, mm.mysql-2.0.4-bin.ja

  • Code for consuming web services in ABAP

    *& Report  ZVM_GET_CITY_TIME REPORT  zvm_get_city_time. PARAMETERS:   p_city TYPE zget_city_time_soap_in-city. DATA:   cl_proxy TYPE REF TO zco_time_service_soap,   input    TYPE zget_city_time_soap_in,   output   TYPE zget_city_time_soap_out,   syst