Changes to XML file

Hello,
I have a XML file and I need to apply chnges to an attribute and save the xml file (using JDom).
How do I do it? , I've looked all over for an example for this simple problem but did not find it ( I've wrote the part of reading from the Xml and now I'm stuck on the writing).
Thanks for you're help folks !

Here is an example of using XMLwriter and DataWriter.
I use the "crimson" XML implementation wich you can download at http://xml.apache.org/dist/crimson/ :
download the file "crimson-1.1.3-bin.zip"
and extract the file "crimson.jar" to "C:\Program Files\Java\jdk1.5.0_01\jre\lib\ext" or to where is your "..\jre\lib".
My example consists of three files :
1. TestXML is the main class
2. ConfigHandler is an interface
3. HandleConfig processes the XML file (a simple configuration file)
* TestXML.java
* Created on 14 f�vrier 2005, 02:05
import java.io.File;
import java.util.HashMap;
import javax.swing.*;
* @author Andr� Uhres
public class TestXML extends javax.swing.JFrame implements ConfigHandler{
    /** Creates a new instance of TestXML */
    public TestXML() {
        initComponents();
        getConfig();
        jButton2.getRootPane().setDefaultButton(jButton2);
        path.setText(pathUser);
    private void initComponents() {       
        setTitle("Test XML");
        jPanel1 = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        jButton2 = new javax.swing.JButton();
        path = new JTextField(pathUser);
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jPanel1.setLayout(null);
        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
        jButton2.setText("Update");
        jButton2.setMaximumSize(new java.awt.Dimension(60, 20));
        jButton2.setPreferredSize(new java.awt.Dimension(60, 20));
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
        jToolBar1.add(jButton2);
        jToolBar1.add(path);
        getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH);
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-400)/2, (screenSize.height-300)/2, 400, 300);
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        pathUser = path.getText();
        updateConfig();
    /** Sets the configuration values
     * @param keyWord identifies the configuration value
     * @param keyValue gives the new configuration value
    public void setConfigValues(String keyWord, String keyValue){
        if(keyWord.equalsIgnoreCase("PathUser"))pathUser=keyValue;
    public HashMap getConfigValues(){
        HashMap configValues = new HashMap();
        configValues.put("PathUser", pathUser);
        return configValues;
    public HashMap getDefaultConfigValues() {
        HashMap configValues = new HashMap();
        configValues.put("PathUser", "\\\\prdfs2\\data\\WGRP\\AFSOUT\\");
        return configValues;
    public synchronized void getConfig(){
        File balag = new File("c:\\balageeConf");
        if(!balag.exists())
            balag.mkdir();
        argv2=new String[]{
            "C:\\balageeConf\\balagee_config.xml"
        new HandleConfig(argv2, this, null);
    public synchronized void updateConfig(){
        new HandleConfig(argv2, this, getConfigValues());    //update file
    public static void main(String args[]) {
        new TestXML().setVisible(true);
    private String pathUser;
    private String[] argv2;
    private javax.swing.JButton jButton2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JTextField path;
* ConfigHandler .java
* Created on 17 juillet 2004, 07:34
import java.util.*;
* @author  andreuhres
public interface ConfigHandler {
    /** <B>
     * Use: at program initialisation !<br>Example:</B>
     * <br><CODE>public void synchronized getConfig(){
     * <br>        File balag = new File("c:\\balageeConf");
     * <br>        if(!balag.exists())
     * <br>            balag.mkdir();
     * <br>        argv2=new String[]{
     * <br>            "C:\\balageeConf\\balagee_config.xml"
     * <br>        };
     * <br>        new HandleConfig(argv2, this, null);
     * <br>    }
     * </CODE>
    void getConfig();
    /** <B>
     * Use: internal in HandleConfig() !<br>Example:
     * </B><br><CODE>public void setConfigValues(String keyWord, String keyValue){
     * <br>        if(keyWord.equalsIgnoreCase("PathUser"))pathUser=keyValue;
     * <br>        if(keyWord.equalsIgnoreCase("SelectedFile")){
     * <br>            keyValue=keyValue.toLowerCase().replaceFirst(".csv", ".bag");
     * <br>            defaultFournisseur=keyValue;
     * <br>            lastFournisseur=keyValue;
     * <br>        }
     * <br>        if(keyWord.equalsIgnoreCase("optionShift")){
     * <br>            optionShift=Boolean.valueOf(keyValue).booleanValue();
     * <br>        }
     * <br>        if(keyWord.equalsIgnoreCase("nePlusAfficher")){
     * <br>            nePlusAfficher=Boolean.valueOf(keyValue).booleanValue();
     * <br>        }
     * <br>        if(keyWord.equalsIgnoreCase("nePlusAfficher2")){
     * <br>            nePlusAfficher2=Boolean.valueOf(keyValue).booleanValue();
     * <br>        }
     * <br>        if(keyWord.equalsIgnoreCase("nePlusAfficher3")){
     * <br>            nePlusAfficher3=Boolean.valueOf(keyValue).booleanValue();
     * <br>        }
     * <br>
     * <br>        if(keyWord.equalsIgnoreCase("initChooser")){
     * <br>            initChooser=Boolean.valueOf(keyValue).booleanValue();
     * <br>        }
     * <br>    }
     * </CODE>
    void setConfigValues(String keyWord, String keyValue);
    /** <B>
     * Use: in updateConfig() !<br>Example:
     * </B><br><CODE>
     *     public HashMap getConfigValues(){
     * <br>         HashMap configValues = new HashMap();
     * <br>         configValues.put("PathUser", pathUser);
     * <br>         configValues.put("SelectedFile", lastFournisseur);
     * <br>         configValues.put("optionShift", ""+optionShift);
     * <br>         configValues.put("nePlusAfficher", ""+nePlusAfficher);
     * <br>         configValues.put("nePlusAfficher2", ""+nePlusAfficher2);
     * <br>         configValues.put("nePlusAfficher3", ""+nePlusAfficher3);
     * <br>         configValues.put("initChooser", ""+initChooser);
     * <br>         return configValues;
     * <br>     }
     * </CODE>
    HashMap getConfigValues();
    /** <B>
     * Use: internal in HandleConfig() !<br>Example:
     * </B>
     * <br><CODE>public HashMap getDefaultConfigValues() {
     * <br>        HashMap configValues = new HashMap();
     * <br>        configValues.put("PathUser", "W:\\WGRP\\AFSOUT\\");
     * <br>        if(System.getProperty("user.name").toUpperCase().equals("ANDREUHRES"))
     * <br>            configValues.put("PathUser", "C:\\balag\\balageeData\\");
     * <br>        configValues.put("SelectedFile", "bc090404.bag");
     * <br>        configValues.put("optionShift", "false");
     * <br>        configValues.put("nePlusAfficher", "false");
     * <br>        configValues.put("nePlusAfficher2", "false");
     * <br>        configValues.put("nePlusAfficher3", "false");
     * <br>        configValues.put("initChooser", "false");
     * <br>        return configValues;
     * <br>    }
     * </CODE>
    HashMap getDefaultConfigValues();
    /** <B>
     * Use: at program exit !<br>Example:
     * </B>
     * <br><CODE>public void synchronized updateConfig(){
     * <br>        new HandleConfig(argv2, this, getConfigValues());    //update file
     * <br>    }
     * </CODE>
    void updateConfig();
import java.io.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import javax.swing.JFrame;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.crimson.jaxp.DocumentBuilderFactoryImpl;
import org.apache.crimson.tree.XmlDocument;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.helpers.AttributesImpl;
/* Usage:
        argv2=new String[]{
            "C:\\balageeConf\\balagee_config.xml"
        new HandleConfig(argv2, this, null);    //process file
        new HandleConfig(argv2, this, getConfigValues());    //update file
public class HandleConfig {
    /** Number of elements in document before modification. */
    protected int m_elements;
    /** Number of whitespace content segments deleted from document. */
    protected int m_deletes;
    /** Number of elements added wrapping content. */
    protected int m_adds;
    final ConfigHandler ConfigHandler;
    String[]argv2;
    HashMap configValues;
    HashMap confValues;
     * @param argv file name (full path) defined as the only element of the String array
     * @param parent reference to the calling object (= this)
     * @param configValues null (for initialisation) or reference to a hashmap containing keyword-value pairs (for update)
    public HandleConfig(String[] argv, JFrame parent, HashMap configValues){
        this.ConfigHandler=(ConfigHandler)parent;
        this.configValues=configValues;
        argv2=argv;
        File config02 = new File(argv2[0]);
        String confTest ="";
        try{
            BufferedReader readerConf = new BufferedReader(new FileReader(config02));
            confTest = readerConf.readLine();
            readerConf.close();
            if (confTest==null){
                config02.delete();
        }catch(Exception ex){
            ex.printStackTrace();
        runIt(argv2);
     * Read contents of file into byte array.
     * @param path file path
     * @return array of bytes containing all data from file
     * @throws IOException on file access error
    private static byte[] getFileBytes(String path) throws IOException {
        File file = new File(path);
        int length = (int)file.length();
        byte[]data = new byte[length];
        FileInputStream in = new FileInputStream(file);
        int offset = 0;
        do {
            offset += in.read(data, offset, length-offset);
        } while (offset < data.length);
        return data;
     * Driver, reads the input files and executes the processing
     * code.
     * @param argv command line arguments
    protected void runIt(String[] argv) {
        // handle list of files to be used
        if (argv.length > 0) {
            // make sure we have a non-empty file name
            String path = argv[0].trim();
            if (path.length() > 0) {
                // read file data into byte array
                byte[] data = null;
                try {
                    data = getFileBytes(path);
                } catch (IOException ex) {
                    // file does not exist: create file
                    try{
                        confValues = ConfigHandler.getDefaultConfigValues();
                        Iterator it = confValues.entrySet().iterator();
                        while(it.hasNext()){
                            Entry entry = (Entry)(it.next());
                            String key = (String)entry.getKey();
                            String value = (String)entry.getValue();
                            ConfigHandler.setConfigValues(key, value);
                        createConfig(path);
                        return;
                    }catch(Exception ex1){
                        System.err.println("Error reading file " + path + ':');
                        ex.printStackTrace(System.err);
                        return;
                // process file data
                try {
                    ByteArrayInputStream  in  = new ByteArrayInputStream(data);
                    //                    ByteArrayOutputStream out = new ByteArrayOutputStream(data.length);
                    FileOutputStream out = new FileOutputStream(path);
                    m_elements = 0;
                    m_deletes = 0;
                    m_adds = 0;
                    newElement=false;
                    processFile(in, out);
                    System.out.println(' ' + path + ": " + m_elements +" elements ");
                    confValues = ConfigHandler.getConfigValues();
                    if( m_elements <= confValues.size() ) {
                        createConfig(path);
                    //                    FileOutputStream fos = new FileOutputStream(path);
                    //                    fos.write(out.toByteArray());
                    //                    fos.close();
                } catch (Exception ex) {
                    ex.printStackTrace(System.err);
                    return;
        } else {
            System.err.println("No document files specified");
    boolean newElement=false;
    protected void createConfig(String path) {
        try{
            DataWriter w = new DataWriter();
            FileWriter writer = new FileWriter(path);
            AttributesImpl attrList=new AttributesImpl();
            w.setOutput(writer);
            w.setIndentStep(3);
            w.startDocument();
            w.startElement("config");
            confValues = ConfigHandler.getConfigValues();
            Iterator it = confValues.entrySet().iterator();
            boolean first=true;
            while(it.hasNext()){
                Entry entry = (Entry)(it.next());
                String key = (String)entry.getKey();
                String value = (String)entry.getValue();
                if(first){
                    first=false;
                    attrList.addAttribute("","key","","", key);
                }else{
                    attrList.setAttribute(0,"","key","","", key);
                w.dataElement("", "configItem", "", attrList, value);
            w.endElement("config");
            w.endDocument();
            System.out.println("File created: "+path);
        }catch(Exception ex){
            ex.printStackTrace();
    protected void processElement(Element element) {
        // loop through child nodes
        Node child;
        Node next = (Node)element.getFirstChild();
        if(!newElement){
            while ((child = next) != null) {
                // set next before we change anything
                next = child.getNextSibling();
                // handle child by node type
                if (child.getNodeType() == Node.TEXT_NODE) {
                    // trim whitespace from content text
                    String trimmed = child.getNodeValue().trim();
                    if (trimmed.length() == 0) {
                        // delete child if nothing but whitespace
                        element.removeChild(child);
                }else if (child.getNodeType() == Node.ELEMENT_NODE) {
                    // handle child elements with recursive call
                    if(child.getNodeName().equalsIgnoreCase("configItem")){
                        if(configValues==null){
                            ConfigHandler.setConfigValues(((Element)child).getAttribute("key"),
                            child.getFirstChild().getNodeValue());
                        }else{
                            String key = ((Element)child).getAttribute("key");
                            String valueOld = child.getFirstChild().getNodeValue();
                            String valueNew = (String)configValues.get(key);
                            //                        System.out.println("key: "+key+" valueOld: "+valueOld+"  valueNew: "+valueNew);
                            if( !valueNew.equals(valueOld) ){
                                try{
                                    child.getFirstChild().setNodeValue(valueNew);
                                }catch(Exception ex){
                                    ex.printStackTrace();
                    processElement((Element)child);
                    m_elements++;
        }else{
            if ( (child = next)!=null && configValues!=null ) {
                next = child.getNextSibling();
                element.appendChild(next.cloneNode(false));
    protected void processFile(InputStream in, OutputStream out)
    throws Exception {
        // parse the document from input stream
        System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
        "org.apache.crimson.jaxp.DocumentBuilderFactoryImpl");
        DocumentBuilderFactory dbf = DocumentBuilderFactoryImpl.newInstance();
        dbf.setNamespaceAware(true);
        DocumentBuilder builder = dbf.newDocumentBuilder();
        Document doc=null;
        doc = builder.parse(in);
        // recursively walk and process document
        m_elements++;
        processElement(doc.getDocumentElement());
        // write the document to output stream
        Writer  writer = new OutputStreamWriter(out, "ISO-8859-1");
        ((XmlDocument)doc).write(writer, "ISO-8859-1");
        /* See also: --> FileOutputStream fos in method runIt(argv)               */
    File tboConnOut = null;
}

Similar Messages

  • DOM inserting new elements (no changes in xml file)

    I add the new element and it's nodes like that:
        public static int InsertZapis(String s)
            File dat = new File("nepremicnine.xml");
            try
                String nepr[]=s.split(":");
                DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document doc = builder.parse(dat);
                Element nepremicninaNode = doc.createElement("nepremicnina");
                doc.appendChild(nepremicninaNode);
                Element tipNode = doc.createElement("tip");
                Text tipTextNode = doc.createTextNode(nepr[0]);
                tipNode.appendChild(tipTextNode);
                nepremicninaNode.appendChild(tipNode);
                Element lokacijaNode = doc.createElement("lokacija");
                nepremicninaNode.appendChild(tipNode);
                Text lokacijaTextNode = doc.createTextNode(nepr[1]);
                lokacijaNode.appendChild(lokacijaTextNode);
                Element stSobNode = doc.createElement("stSob");
                nepremicninaNode.appendChild(tipNode);
                Text stSobTextNode = doc.createTextNode(nepr[2]);
                stSobNode.appendChild(stSobTextNode);
                Element velikostNode = doc.createElement("velikost");
                nepremicninaNode.appendChild(tipNode);
                Text velikostTextNode = doc.createTextNode(nepr[3]);
                velikostNode.appendChild(velikostTextNode);
                Element letoNode = doc.createElement("leto");
                nepremicninaNode.appendChild(tipNode);
                Text letoTextNode = doc.createTextNode(nepr[4]);
                letoNode.appendChild(letoTextNode);
                Element telStNode = doc.createElement("telSt");
                nepremicninaNode.appendChild(tipNode);
                Text telStTextNode = doc.createTextNode(nepr[5]);
                telStNode.appendChild(telStTextNode);
                Element dodalNode = doc.createElement("dodal");
                nepremicninaNode.appendChild(tipNode);
                Text dodalTextNode = doc.createTextNode(nepr[6]);
                dodalNode.appendChild(dodalTextNode);
                return 0;
            catch (Exception e)
                e.printStackTrace();
                return -1;
        }But I don't see changes in my xml file.
    XML file looks like this:
    <?xml version="1.0" encoding="utf-8"?>
    <seznam_nepremicnin>
      <nepremicnina>
        <tip>Apartma</tip>
        <lokacija>Novalja 162d, Pag</lokacija>
        <stSob>4</stSob>
        <velikost>25</velikost>
        <leto>1980</leto>
        <telSt>051231521</telSt>
        <dodal>uporabnik2</dodal>
      </nepremicnina>
      <nepremicnina>
        <tip>Stanovanje</tip>
        <lokacija>Gosposvetska 83c, Maribor</lokacija>
        <stSob>3</stSob>
        <velikost>30</velikost>
        <leto>1975</leto>
        <telSt>041523163</telSt>
        <dodal>uporabnik1</dodal>
      </nepremicnina>
    </seznam_nepremicnin>

    Document doc = builder.parse(dat);this means a doc object with the copy of ur xml file has been created..that means..even if u modify ur doc element..it doesnt reflect in the file..
    u need to transofrm back ur document object to ur xml file to reflect the changes u have done on xml..did u get i?
    shanu

  • Can't change xml file

    I am trying to import files from an external drive. I was able to do the add file to library from the drive but whenever I reload itunes it expects the files to be on my external drive which I have removed. I tried to change the location of the files in the itunes music library xml file but everytime I bring up itunes it changes the file location back to the original file on the external hard drive. I physically copied the files from the external drive to my itunes directory but itunes refuses to let me manually change the xml file to reflect the new location. Does anyone have a clue as to how I can update the xml file to point to the itunes directory for these imported songs rather than pointing back to the external drive?

    Bart_Blommaerts wrote:
    2: I set the "&#235 ;" value myself ..The problem setting this value in your Java code is that ... &#235; cannot be used to escape anything in Java, it only can be used to escape characters in an XML file.
    This is why an XML parser will automatically translate this value for you when it parses the XML file. The dom4j Document object will never see this value and when you do a getText() the resolved value is returned.
    Instead in Java you should use either the '�' value (make sure to save your Java files as Unicode) or you could use the Java way to escape characters: \u00EB.
    I was satisfied with the "�" in my XML file ... but when I deployed the application to the webserver .. and generated an XML-file I read "��", which is definitely not what I want ..
    So on my local Tomcat5 server I get "�". On the SunWappserver I get "��".This seems to be a different problem. When you read the file, you will have to make sure to read the file with the encoding that it was saved in. This means that the editor that you use to read the file will have to be able to read files encoded using UTF-8 (Unicode).

  • How to get the number from a xml file to flash as3 Text Box "Get_Days"?

    Hi,
    I have to daily update the number of days finished from the specified days. Say, One work to be finished in 30 days. And the start day is today. So, tomorrow it will be 29 days left. and so on....
    So, instead of reducing one number everyday from the last days number using flash, it will be easy changing in xml file.
    How can I do that?
    I have a simple text box "dynamic text box" and the instance name : "Days_Left". Since I am learner, I cannot make complex projects. I am learning small things with very few lines of code which can be modified using xml files.
    So, Whatever I type in a xml file, it should appear in a text box called "Days_Left".
    Thanks.

    then you can use:
    var currentDate:Date = new Date(); 
    // this is today's date
    var projectDueDate:Date = new Date(2010,11,29); 
    // use whatever date you want for the due date.
    // months are zero-based.  (ie, jan is month 0, dec is month 11.)
    var daysToCompleteProject:Number = (projectDueDate.getTime()-currentDate.getTime())/(1000*60*60*24);
    // this is number of days between currentDate and projectDueDate.  you probably want to round or use days:hours:minutes for your display

  • Calling XML file from Flash -- Usage of wildcard characters

    Hi
    We have a Flash file, tabs.swf, (standard tab interactivity) from which we are calling the XML file using the following code:
    myXML.load("tabs.xml")
    We are using this SWF file in many learning modules created using Captivate, FrameMaker, RoboHelp, etc. by just changing the content in the XML file appropriately. The tool creates a different folder for each module.
    Now, the challenge we are having is, there will be cases where we have to use the interactivity in multiple times in the same module. In that case, content developers can change the SWF file name on their own. But they can't change the XML name without going back to media designer.
    Is there a way we can use the same SWF file to call different XML files without manually changing the XML file name every time? We have a standard naming convention for the XML files -- Tab1_<ModuleName>, Tab2_<ModuleName>, etc.
    Any help is appreciated. Thanks.
    Sreekanth

    you can edit the swf's name, and use this._url and the flash string methods to do that.

  • Problem in JAXB for processing XML files

    hello
    I have been working on a project where i need to process data in XML format. the flow goes thus
    I have 28 data elements that i need to represent as a XML so i compile the schema files and generate the class files for each of the tags and thus i can use the get and set methods to read and write to a XML file respectively(example getName and setName)......
    Now the problem is that my coding is done if i change my xml file and add say 2 more tags how do i handle it in my code.........
    1>Do i have recomplie the schema file and generate new class files every time the xml structure changes. can i avoid this recompiling process and use a one time genrated class files even if the xml structure changes.
    2>Now i have hard coded the get and set methods for processing the xml file if i add new tags to my xml i wouldnt have the get set methods for the new tags in my code(say i add a new tag as Phone then i wouldnt have the codes getPhone and setPhone called in my code and this tage was added after the coding was done)........how do i handle this situation. Is is possible that i can get and set data without using these methods and use some sort of a dynamic way of getting and setting data.............
    3>Any other approach available to meet the above requirements other than JAXB.
    Please help for the above problem
    Thank you

    hi,
    i had written a xml and schema to validate.
    my xml would be
    <output>
    <table>
    <row>
    <column></column>
    <column></column>
    </row>
    </table>
    <document>
    <properties>
    </properties>
    <contents>
    </contents>
    </document>
    <table>
    <row>
    <column></column>
    <column></column>
    </row>
    </table>
    <document>
    <properties>
    </properties>
    <contents>
    </contents>
    </document>
    <table>
    <row>
    <column></column>
    <column></column>
    </row>
    </table>
    <document>
    <properties>
    </properties>
    <contents>
    </contents>
    </document>
    </output>
    schema should validate : each table should contain atleast one row element and each row element should have atleast one column. similarly, each document should have atleast one properties and contents element.
    if any of these things occur. for ex: if there is no row element in table, i need to delete the table tag. similary if there is no properties/content or both element in document it should delete the corresponding document from the xml.
    i tried for table if there is no row element am getting the line number of the </table> tag, based on that am deleting the table element. if there is no properties tag and contents tag is there. am getting the line number for <contents>start tag, with which i could not able to delete the whole document.
    can anybody plz help me out for this requirement

  • How to Change the XML data that got stuck up in XI

    Hi,
    I am executing a scenario which sends the data from HTTP client>Xi->SAP(R/3 4.6).We are queuing the messages in XI, through QoS EOIO.Sender side we have configured the HTTP adapter and on receiver side we have configured RFC adapter.RFC at receiver side throws an exception, if I try to call rfc from XI by sending  wrong data to it from HTTP client.The message which is failed gets stuck up in the queue , whose status will be shown as System Error.So, No messages will be further processed from that queue.
    Our Requirement is, We need to manually change the xml file which is  failed while trying to post data in to SAP.Could any one help me  to find where the Failed xml file gets stored in XI and how can we change the file .
    Regards,
    Kiran kumar.

    Mario,
    This is possible from SP 19 onwards...
    Have a look @
    /people/gourav.khare2/blog/2007/02/28/sapxi--message-editing-150-responsibility-and-liability-150-sp19
    Also, the comments in the blog. Really good
    http://help.sap.com/saphelp_nw04/helpdata/en/43/4a576b5b7430f3e10000000a11466f/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/43/4a576b5b7430f3e10000000a11466f/frameset.htm
    Regards,
    Jai Shankar

  • Parse/print xml file

    I have a folder full of existing XML files (test reports). I am programmatically searching and selecting a single file based on naming citeria with no problems.
    What I can't get working is printing this file. It views properly in a browser (I have the proper XSL in the proper folder) and prints manually from the browser. I need to programmatically send this file to the printer and print with no user intervention.
    I am currently going down the path of using ActiveX or DOM but can't seem to get it all working within LV (using v.8.5). Is there a better/easier way to print this file? If I were to use the report VIs, I would need to change this XML file into an HTML report (seems cumbersome).
    Thanks in advance for any guidance and assistance,
    Brian

    You could talk directly to the printer and send it the commands directly...Its a pain, and not very "portable" since its brand or printer specific, but I had to do it a long while back with my app...
    Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
    using LV 2010 SP 1, Windows 7

  • XML File generation and watching continuously on directory present on APEX

    Hi All,
    I need advice on how can I implement following -
    I will be creating Input XML file using database procedure called from APEX, which will then go and executed the call using web services and create output XML file in one of the output directory. What I need help is -
    1. Once execute the initial call, then I need to be keep looking for file under output directory. Once the file is generated then I can show it on APEX, but I would like to know how can I implement, so continuously watch the directory for the file and as soon as file generated pick that file and present on APEX and stop watching directory for file.
    2. Also APEX will be used by many users concurrently, so how can I create and direct unique file for their own sessions, so myfile should not go to another user?
    Please advice

    Hi Keith
    11g uses the EPG so the images are stored in the database, however are also accessible as a webfolder. This is the same as (or very similar to) XE which I've previously successfully installed this on. The files have been uploaded to the images directory as I'm able to reference /i/sample.html in the iframe successfully. I've never needed to change the .xml file and run apxldimg script, a simple copy and paste has always worked. However, I will try this just to make sure.
    Hi Denes
    I've tried putting in the absolute path of the directory, which I assume you mean the full path i.e. http://localhost:8080/images/charts_library. But this makes no difference. I know there are differences with 11g, the EPG and that you have to open http://localhost:8080/images/ as a web folder rather than http://localhost:8080/i/ to access the files in the images directory. However, the database that your example application on http://htmldb.oracle.com is running on is an 11g database. It's running 11.1.0.6.0 the same as my database, so it must be possible and by the fact you didn't know this I assume you didn't need to make any changes to make it work!
    Sara

  • XML File Within XML File

    Hi everyone,
    Plz help me out.....
    Currently, I am working on flex and Remote Object Accessing.
    My problem is that, in my application I have one Servlet which
    writes .xml file in browser and I use that .xml file to display
    data in Datagrid. Everything was woking fine. But then I have to
    change my .xml file in such a way that one of it's node is a .xml
    file. like this...
    <?xml version="1.0" encoding="UTF-8" ?>
    - <root>
    - <detail>
    <server>SOA </server>
    <resp_time>250</resp_time>
    - <request>
    <?xml version="1.0" encoding="UTF-8" ?>
    - <envelope>
    <operation>addition</operation>
    </envelope>
    </request>
    </detail>
    </root>
    Here request is one of the node in .xml file. now when i am
    displaying data in this file into datagrid, datagrid show correct
    data for <server> and <resp_time> tag. But it shows
    "[object Object]" for request tag.
    Can any one tell me how can I show that request node into my
    datagrid ,so that it shows me ..
    <request>
    <?xml version="1.0" encoding="UTF-8" ?>
    - <envelope>
    <operation>addition</operation>
    </envelope>
    </request>
    instead of [object Object] ???? Please Hepl me

    Tracy had replied me that you can use labelFunction. like
    this...
    private function lfRequest(oItem:Object,
    dgc:DataGridColumn):String
    return oItem.request.toXMLString()
    I have used resultHandler like this ....
    [Bindable]
    var xmlFile:String = null;
    private function resultHandler(event:ResultEvent):void
    trace("resultHandler is called...");
    var myO:Object = new Object();
    myO = event.result;
    trace("after new XML()");
    xmlFile=myO.request.toXMLString();
    trace("after toString()");
    and i m trying to display that ' xmlFile:String' into
    datagrid, but it gives me this runtime-error:
    Error #1009: Cannot access a property or method of a null
    object reference.
    then i tryed this...
    xmlFile=myO.request.root.detail.toXMLString(); then it gives
    me this error message :
    Error #1009: Cannot access a property or method of a null
    object reference.
    plz help me...

  • Logged changes in XML format

    Hi,
          I am trying to convert the logged changes into XML file.But the contents are not coming up correctly.Please help me in solving out this issue.
    I have coded is like this :
    CALL FUNCTION 'HR_INFOTYPE_LOG_GET_LIST'
    EXPORTING
       tclas                    = 'A'
       begda                    = sy-datum
       endda                    = sy-datum
       auth_check               = 'X'
      USE_ARCHIVE              = ' '
    IMPORTING
      SUBRC                    =
      TABLES
      PERNR_TAB                =
      INFTY_TAB                =
        infty_logg_key_tab       = test
      DATUM_TAB                =
      UNAME_TAB                =
    LOOP AT test INTO wa.
      CALL FUNCTION 'HR_INFOTYPE_LOG_GET_DETAIL'
        EXPORTING
          logged_infotype        = wa
         auth_check             = 'X'
      USE_ARCHIVE            = ' '
    IMPORTING
      SUBRC                  =
        TABLES
          infty_tab_before       = test1
          infty_tab_after        = test2
         fields                 = test3
      CHECK sy-subrc = 0.
      ENDLOOP.
    And i am appending  INFTY , PERNR from TEST1 table and FNAME ,NEWDT from TEST3 table into one new internal table called struct and converting that internal table contents into xml.
    For XML conversion*********************************
    CALL TRANSFORMATION ('ID')
    SOURCE tab = struct[]
    RESULT XML xml_out1.
    CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
      EXPORTING
        text            = xml_out1
    IMPORTING
      LENGTH          = lv_length
      TABLES
        ftext_tab       = itab1.
    CHECK sy-subrc = 0.
    After downloading i am getting the xml file like this :
    <?xml version="1.0" encoding="UTF-16"?>
    -<asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml">-<asx:values>-<TAB>-<item><INFTY>0002</INFTY><PERNR>00070297</PERNR><FNAME/><NEWDT/></item>-<item><INFTY/><PERNR>00000000</PERNR><FNAME>ITXEX</FNAME><NEWDT/></item>
    But i want in this way:
    <?xml version="1.0" encoding="UTF-8"?>
    -<NewDataSet> -<PA0002> <PERNR>8000</PERNR> <TITEL>DLEM 6</TITEL> <VORNA>Raj</VORNA> <NACHN>Halli</NACHN> <NAME2>RB</NAME2> <INITS/> <RUFNM/> <SPRSL/> <GESCH/> <GBDAT/> <GBORT/> <GBLND/> <NATI0/> <GBDEP/> <NATI2/> <NATI3/> <FAMST/> <FAMDT/> <ANZKD/> <KONFE/> <BEGDA/> <AEDTM/> </PA0002>
    Regards,
    Helma

    Hi Patlolla,
    Goto SPRO : Personnel Administration -> Tools -> Revision -> Set up change document.
    There, add IT 0021 as an infotype to be logged.
    Best Regards,
    Dilek

  • Maintaining Portal Desk top URL aliases in web.xml file

    Hi All,
    I am planning to configure portal url alias i.e http://localhost:53000/irj/portal/finance
    should take me directly to finance portal desk top.
    1) Created a Desktop named finance_desktop
    2) Master rule has been set for URL Alias.
    3) I need to set URL alias name: finance in web.xml file
    4) path for the web.xml file is C:\usr\sap\SID\JCXX\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\web.xml
    5) Where exactly i have to change web.xml  file
    Infact i have seen a pdf "How to configure the J2ee engine deployment descriptor"
    Thanks in advance
    Regards,
    Murali

    Hi
    indeed one small copy/paste mistake from me ... sorry for that...
    After you copyed the large chunk of code (as i discribe in step 1 and 2) you must rename:
    <param-name>portal</param-name>
    to
    <param-name>portal/finance</param-name>
    so then that part of the web.xml will look like this:
    <init-param>
    <param-name>portal</param-name>
    <param-value>
    anonymous=0,proxy=0,low_bandwidth=0,include_in_url=1,include_application_name_in_url=1
    </param-value>
    </init-param>
    <init-param>
    <param-name>portal/finance</param-name>
    <param-value>
    anonymous=0,proxy=0,low_bandwidth=0,include_in_url=1,include_application_name_in_url=1
    </param-value>
    </init-param>
    Good luck again...
    Cheers,
    Benjamin Houttuin
    Message was edited by:
            Benjamin Houttuin

  • Tomcat doesn't pick up the changes to jsp files

    My original problem was JAR locking. I changed context.xml files both in conf\ and my application.
    jakarta-tomcat-5.5.9\conf\context.xml
    <Context  reloadable="true" antiResourceLocking="true" antiJARLocking="true">
           <WatchedResource>WEB-INF/web.xml</WatchedResource>     
    </Context>myApplication\META-INF\context.xml
    <Context  reloadable="true" antiResourceLocking="true" antiJARLocking="true">        
        <WatchedResource>WEB-INF/web.xml</WatchedResource>
    </Context>Now I can undeploy without having jarLocking problem.
    But now tomcat doesn't pick up the changes to jsp files automatically!!!
    I have to undeploy/deploy even I just change jsp files!
    What's wrong?

    You can't do anything except speak in a different accent. Apple would have to add specific support for different accents in a future iOS update.

  • XML  file and DataGrid

    Hi everyone,
    Plz help me out.....
    Currently, I am working on flex and Remote Object Accessing.
    My problem is that, in my application I have one Servlet which
    writes .xml file in browser and I use that .xml file to display
    data in Datagrid. Everything was woking fine. But then I have to
    change my .xml file in such a way that one of it's node is a .xml
    file. like this...
    <?xml version="1.0" encoding="UTF-8" ?>
    - <root>
    - <detail>
    <server>SOA </server>
    <resp_time>250</resp_time>
    - <request>
    <?xml version="1.0" encoding="UTF-8" ?>
    - <envelope>
    <operation>addition</operation>
    </envelope>
    </request>
    </detail>
    </root>
    Here request is one of the node in .xml file. now when i am
    displaying data in this file into datagrid, datagrid show correct
    data for <server> and <resp_time> tag. But it shows
    "[object Object]" for request tag.
    Can any one tell me how can I show that request node into my
    datagrid ,so that it shows me ..
    <request>
    <?xml version="1.0" encoding="UTF-8" ?>
    - <envelope>
    <operation>addition</operation>
    </envelope>
    </request>
    instead of [object Object] ???? Please Hepl me

    First, you are really posting in the wrong forum. This one is
    for Flex Builder 2, an IDE/code editor. You question is about the
    language Flex, and such questions should go in the "General
    Discussion" forum.
    Try using a labelFunction instead of dataField.
    private function lfRequest(oItem:Object,
    dgc:DataGridColumn):String
    return oItem.request.toXMLString()
    Tracy

  • Read XML file problem

    Hi all,
    I am trying to read an xml file and display the output. i get a blank display. Can anybody please help me out.
    Thanks in advance
    I cant attach the xml file. Since its not a valid extension. Please find the xml code below.
    <Company>
    <Name>Samsung</Name>
    <Location>
    <City>Busan</City>
    <Country>South Korea</Country>
    </Location>
    </Company>
    Regards,
    KM
    Solved!
    Go to Solution.
    Attachments:
    Read Data from XML File.vi ‏9 KB

    If you can change saved .xml file, you can modify it to be compatible with Labview XML shema and use Unflatten from XML like in your VI. If you cannot, you should use XML Parser library. In attachement you can find 2 exmaples for these situations.
    Attachments:
    Modified XML file.vi ‏12 KB
    XML Parsing 1.vi ‏20 KB

Maybe you are looking for

  • USB 3.0 expressCard for Lenovo G555

    Hello, is it possible to connect a usb 3.0 ExpressCard to my Lenovo G555? thank you!

  • Display year data(customer exit)

    Hi, I have the data for last 10 years. I want to display the data according to user input. for ex user wants to display the data for the year 2002. it has to display only 2002 data. how to create customer exit variable? need code for this requirement

  • Using the DBMS_XDBRESOURCE PL/SQL package

    Does anyone know how to use the functions in the DBMS_XDBRESOURCE package? I've tried to use the GETCREATIONDATE function but no luck. I usually get a "PLS-00221: 'GETCREATIONDATE' is not a procedure or is undefined" The 11g PL/SQL packages and type

  • SAP NetWeaver 7.0 SP Stack 12 --- New Features ?

    Hi All , As the SAP NetWeaver 7.0 SP Stack 12  is out , and more features are added in that .Can anybody tell what are the new features added for wd-abap?. Regards Yashpal

  • Field attributes in material master

    Hi, The field attributes maintained for material master; is showing the significant fields –‘material assignment’ (sales view) and ‘quantity structure’ (costing view) have been set as ‘optional’ at the time of updation.  Further, standard price can b