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

Similar Messages

  • Moving to new PC and changing path to files

    Hi! I'm moving from a Windows XP machine to a new Vista machine. My iTunes library is external on a samba share so the path in my iTunes xml library file is: /Jester/music/ etc... Well, there's some bugs in getting Windows Vista to see Samba shares so I have to view it by IP address. I've mounted that IP address as a drive, so I need to just substitute the above with "M:/". I've tried copying my old library files over. If I leave them intact, iTunes sees the library & rating but can't find the songs (I have 8000+ so I don't want to go refind each one). If I try to change the XML file, iTunes apparently reloads the library from the itl file. I also tried the hack to corrupt the itl file so it would rebuild from the xml file but apparently that doesn't work anymore in iTunes 7, it just reverts back to an empty library. Any suggestions?

    Thought that I would post back and say that I was able to create a Backup for a catalog under PSE 3, which required 4 CDs.
    Then I ran the Restore on the new PC where only PSE 4 is installed. The Restore ran using all 4 CDs and at the end I received the message that the Catalog was from a prior version and needed to be converted. I said OK to the catalog conversion, which ran and then displayed thumbnails in the Photo Browser. When I scrolled thru the photo well there were normal "first time" delays that I attribute to the building of the thumbnails.
    As of now the v4 catalog appears to be updated for the new drive and folder location on this system. The associated photo files seem generally OK, but I am still checking specifics.
    For now I will run with the photo files on the only drive, the system drive. However, eventually I will probably add a second internal or external drive.
    Colin and Chuck, I decided to try the PS Elements functions first and keep your information in reserve in case I discover a problem. However, I am still very grateful for the assistance.
    Barb O

  • How to update Elements value inside existing xml file

    Hi Gurus,
    Am somehow new to java and working on xml with java, i have a scenario where i want to update the elements of my existing xml file, i know its possible as i have posted one code on this forum which updates the values of the arrtibutes of existing xml file. Ref :
    http://forum.java.sun.com/thread.jsp?forum=34&thread=186091&start=15&range=15&hilite=false&q=
    But am not able to use the same code to update the vlaues of the attribute.
    if i have this xml file :
    <?xml version="1.0"?>
    <RootElement>
    <Transaction>
    <Task9>
    <TaskID>Task9</TaskID>
    <Description>My Test Case</Description>
    <Time>12/12/2004</Time>
    </Task9>
    </Transaction>
    <Transaction>
    <Task2>
    <TaskID>Task2</TaskID>
    <Description>Testing my xml</Description>
    <Time>12/12/2004</Time>
    </Task2>
    </Transaction>
    </RootElemen>
    Now i want to update teh </Description> and </Time> field using the code that i have given above in the link.
    If any one can help me ill really appreciate.

    The value of an element is stored in a child node of that element. For example, let's say that "e" references the node <Description> then:
    e.getFirstChild().getNodeValue() => "My Test Case"

  • SQL insert scripts generation from repository data xml file

    Hi All,
    I want to generate sql insert scripts from repository data xml file which contain <add-item>elements.
    Example: data xml file is contains
    <add-item item-descriptor="user" id="741">
    <set-property name="gender"><![CDATA[female]]></set-property>
    <set-property name="emailStatus"><![CDATA[__NULL__]]></set-property>
    <set-property name="receiveEmail"><![CDATA[__NULL__]]></set-property>
    <set-property name="email"><![CDATA[[email protected]]]></set-property>
    <set-property name="password"><![CDATA[a694cb1d6d011eddc444acb77338c1df6a22bac5de26330e2fe1d20f15f97ed6]]></set-property>
    <!-- rdonly derived <set-property name="abandonedOrderCount"><![CDATA[0]]></set-property> -->
    <set-property name="locale"><![CDATA[de_DE]]></set-property>
    <set-property name="userType"><![CDATA[1]]></set-property>
    <set-property name="autoLogin"><![CDATA[__NULL__]]></set-property>
    <set-property name="lastName"><![CDATA[Springford]]></set-property>
    <set-property name="member"><![CDATA[true]]></set-property>
    <set-property name="dateOfBirth"><![CDATA[7/18/1951 00:00:00]]></set-property>
    <!-- rdonly derived <set-property name="age"><![CDATA[61]]></set-property> -->
    <set-property name="registrationDate"><![CDATA[5/16/1996 00:00:00]]></set-property>
    <set-property name="login"><![CDATA[sally]]></set-property>
    <set-property name="lastActivity"><![CDATA[6/9/1999 00:00:00]]></set-property>
    <set-property name="homeAddress"><![CDATA[741]]></set-property>
    <set-property name="passwordSalt"><![CDATA[sally]]></set-property>
    <set-property name="generatedPassword"><![CDATA[__NULL__]]></set-property>
    <set-property name="firstName"><![CDATA[Sally]]></set-property>
    <set-property name="lastPasswordUpdate"><![CDATA[__NULL__]]></set-property>
    </add-item>
    Thanks
    Siva

    HI Rohan,
    Thanks for reply..
    I have checked the startSQLRepository script by using this we can export or import repository data from xml to repository.But in startSQLRepository there is no attribute to generate sql
    insert scripts from data xmls but there is a option to get the sql scripts(-ouputSQL).

  • How to retrieve elements from 3 different xml file in one url

    Hi all,
    Could anyone please let me how can we retrieve elements from 3 different xml file in one url?
    i just can only do it with one file only, any help would very appreciate.
    Thank in advance
    Jim

    Hi Philip
    Thanks for replying me.
    I tried on that way, In my mdx query i am using one slice attribute (i.e [Customer].[Gender].allmembers) in rows so getting error "The  Hierarchy already appears in Axis1".
    SELECT
    {[Measures].[Internet Sales Amount] } ON 0,
    NON EMPTY
    {[Customer].[Gender].allmembers } ON 1 -- Used
    FROM
    [Adventure Works]
    WHERE
    [Customer].[Gender].&[M]
    ,[Product].[Size Range].[(All)]
    ,[Customer].[Country].[All Customers]
    [Customer].[Gender].[All Customers]
    ,[Product].[Size Range].&[XL]
    ,[Customer].[Country].[All Customers]
    [Customer].[Gender].[All Customers]
    ,[Product].[Size Range].[(All)]
    ,[Customer].[Country].&[Australia]
    Can you provide alternate ways to get resolved.
    Thanks in advance

  • Insert data into oracle table from XML file

    I need to insert data into oracle table from XML file
    If anybody handled this type of scenario, Please let me know how to insert data into oracle table from XML file
    Thanks in advance

    The XML DB forum provides the best support for XML topics related to Oracle.
    Here's the FAQ on that forum:
    XML DB FAQ
    where there are plenty of examples of shredding XML into Oracle tables and such like. ;)

  • Insert new column after get then XML

    Hello,
    I use Oracle 8i and SQL Utility. I want to do a query and after that, modify or insert the values of some elements.
    xmlgen.clearBindValues;
    xmlgen.setBindValue('vCity', vCity);
    xmlSQL := 'select name, depto from emp where city = :vCity';
    xmlString := xmlgen.getXML(xmlSQL);
    Now, I want to read each line and modify
    the name or depto values before create the
    XML file. How can I do this?
    Thanks,
    Arthur Rafael

    Again, it depends.
    If you just want to fix your query
    Create Table TABLE AS
    Select column1, to_char(column2) column2, column3 from Table1
    UNION
    Select column1, column2, column3 from Table2;If you want to fix Table1
    ALTER TABLE table1
      ADD( column2_varchar2 VARCHAR2(30) );
    UPDATE table1
       SET column2_varchar2 = to_char( column2 );
    ALTER TABLE table1
      DROP( column2 );
    ALTER TABLE table1
      RENAME COLUMN column2_varchar2 TO column2Taking a step back, though, why are you creating a new table that is the result of unioning two other tables? Is this a one-time data model change? Or is this part of some ongoing process?
    Justin

  • 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;
    }

  • Dom can't parse dtd reference in xml file

    Hi all,
    I am trying to parse a xml file (hibernate mapping file *.hbm.xml) using DOM. But itis getting timeout errorwhile parsing due to the external dtd reference in the xml file.
    <!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >I understand that the program is trying to access the document and is not being able to do so. But I don't have any clue to solve this problem. I don't want to remove the reference from the xml file.
    The following method is trying to parse the xml file:
    public void parseXML(String file) {
            factory = DocumentBuilderFactory.newInstance();
            System.out.println(file);
             try {
                 builder = factory.newDocumentBuilder();
                 document = builder.parse(file);
                 Element docEle = document.getDocumentElement();
                 NodeList n1 = docEle.getElementsByTagName("class");
                for(int i = 0; i < n1.getLength(); i++) {
                       Element e1 = (Element) n1.item(i);
                       String nm = e1.getAttribute("name");
                     System.out.println(nm);
            } catch(Exception e) {
                throw new RuntimeException(e);
        }Please help me on this....I am at no end....Please let me know if there is any method so that the parser will overlook this reference and will parse the xml file....or any other sort of solution....
    Thanks in advance...
    Anir

    Can you provide a working sample?  Upload to Onedrive and share it with us.
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Possible elements in the instanceconfig.xml file for presentation services

    g'day
    Has anyone here come across a list of all the possible elements that can be put in the configuration file for a presentation service, instanceconfig.xml ?<P>
    I have found next to nothing in the documentations, about what can be configured there.<P>
    What I am specifically after is: How can I change the default listening port for the Presentation Service? The default port is 9710 and I want to move to another port.<P>
    Also, how can I move the JavaHost from the default port 9810? I can change the file <i>OracleBI/web/javahost/config/config.xml</i> to reflect the change. Once the JavaHost has been restarted it starts up on the expected port, but the Presentation Service still tries to communicate over RPC to port 9810. How do I configure the presentation service to search for the JavaHost on a non-default port?<P>
    I have boiled it down to my original question: What are the possible values I can configure in the instanceconfig.xml file?<P>
    Any comments here would be great.<P>
    Cheers,<br>
    Borkur

    So, I had a little breakthrough here.
    I found in the OBIEE deployment guide, page 142:
    To change the Presentation Services listener port
    1 Open the instanceconfig.xml file for editing.
    2 Locate the <WebConfig> element.
    3 Within the <WebConfig> tags, create the element <RPC> and assign it the RPC Listener Port
    value for the BI Presentation Services instance, as shown in the following example.
    <WebConfig>
    <ServerInstance>
    <RPC>
    <Listener port="9715" />
    </RPC>
    </ServerInstance>
    </WebConfig>
    NOTE: In the preceding example, the RPC Listener port for the BI Presentation Services instance
    has been changed to port 9715 from the default of 9710.
    4 Save changes to the file.
    This almost works. The RPC element has been deprecated, as was reported in the sawserver.out.log:
    The configuration entry 'RPC/Listener' is deprecated. Please refer to the admin guide for more information.
    What I then did was to just remove the RPC elements and leaving the Listener element straight under there ServerInstance element. This seems to have solved the problem.
    I still have to figure out how to let the Presentation Service know that I have moved the JavaHost to antoher port ...
    Cheers,
    Borkur

  • Append an element to the original xml file

    Guys,
    I have the original xml file.
    Can i add some element, i mean child node, to that file?
    if so could anyone tell me please.
    currently i'm using JDOM to process XML thing.
    Many Thanks :)
    Ty

    Im having trouble with writting to the actuall file too. I can scan xml and find nodes and attributes that I want to change, I change them, and it seems to work because if I get them with like element.getAttribute I can see the value I just set, but the file hasent changed a bit. Good luck with the solution, if you find one can you post it here, I'd be so gratefull...Cheers.

  • How to avoid inserting CheckSessionFilter in to the web.xml file?

    Mobile Server modifies the web.xml during adding a .war-file to the publication. A new entry- CheckSessionFilter will be inserted inside the web.xml after uploading to the mobile server:
    ****************** inserted part **********************
    <filter>
    <filter-name>CheckSessionFilter</filter-name>
    <filter-class>oracle.lite.web.CheckSessionFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>CheckSessionFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    ****************** inserted part **********************
    Our application has own security-concept and don’t need this additional session checking.
    How can we avoid including of CheckSessionFilter in to our web.xml?

    Don't do "add a war option" Instead, package your application using packaging wizard omitting the filter. Or, you can edit the WEB-INF/web.xml file on the mobile server after you deploy it.
    Make you update the APPLICATIONS table
    UPDATE APPLICATIONS
    SET PUBLISH_TIME = SYSDATE
    WHERE NAME = 'you application';
    You application will be uploaded to:
    STANDALONE
    ORACLE_HOME/mobile_oc4j/j2ee/application/mobileserver/applications/yourapplication/WEB-INF/web.xml
    IAS
    ORACLE_HOME/j2ee/application/mobileserver/applications/yourapplication/WEB-INF/web.xml

  • Inserting parent /child records from a xml file ...

    XML file pasted below:
    I have loaded the xml file into a table called xml_demo which has a column xml_data of type xmltype.
    The select for parent record is as follows and it works:
    INSERT INTO balit_submissions (balitdoc, documentversion, datetime_from,job_id, status,creation_datetime)
    (SELECT 'MOL'
    ,to_number(extract(x.xml_data,'/MolDocument/DocumentVersion/@v'))
    ,to_date(substr(extract(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),
    'yyyy-mm-dd"T"hh24:mi')
    ,123456
    ,'CREATED',
    NULL
    FROM xml_DEMO x WHERE
    existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1)
    Having problem creating child records. From this file I expect to create 3 records.
    insert into balit_energy_blocks
    SO_ID,
    DATETIME_FROM,
    DIRECTION,
    BLOCK_NUMBER,
    ENERGY,
    LAST_SUBMIT_DATETIME,
    PRICE_POUNDS,
    PRICE_EUROS,
    BALIT_REF,
    STATUS,
    LAST_EDIT_DATETIME,
    MOL_REASON,
    ACQUIRING_SO_AREA)
    (SELECT 'RTE'
    ,to_date(substr(extract(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),
    'yyyy-mm-dd"T"hh24:mi')
    ,DECODE(extract(x.xml_data,'/MolDocument/MolTimeSeries/Direction/@v'),'AO1','Up','Down')
    ,to_number(substr(extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v'),19))
    ,to_number(extract(x.xml_data,'/MolDocument/MolTimeSeries/Period/Interval/EnergyPrice/@v'))
    ,sysdate
    ,null -- price pounds
    ,null -- price euro
    ,extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v')
    ,'SUBMITTED'
    ,'A96'
    ,NULL -- acquiring area
    ,sysdate
    FROM xml_DEMO x WHERE
    existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1)
    For example, there are 3 ContractIdentification tags. Example of 1:
    <ContractIdentification v="RTE_20100331_1500_16"/>
    I was expecting this select to pluck the last number from this string. In this case 16.
    The select was:
    to_number(substr(extract(x.xml_data,'/MolDocument/MolTimeSeries/ContractIdentification/@v'),19))
    The result I got was:
    16RTE_20100331_1500_20NG_20100331_1500_6
    All contractident values are concatnated and returns from position 19 onwards.
    Can anyone help me to extract the last number from each ContractIdentification tag value and to create the 3 records
    Thanks
    James Sathiaraj
    <?xml version="1.0" encoding="UTF-8"?>
    <MolDocument DtdVersion="3" DtdRelease="0">
    <DocumentIdentification v="MOL_20100331_1500_1600"/>
    <DocumentVersion v="1"/>
    <DocumentType v="A43"/>
    <SenderIdentification codingScheme="A01" v="17X100Z100Z0001H"/>
    <SenderRole v="A35"/>
    <ReceiverIdentification codingScheme="A01" v="10XFR-RTE------Q"/>
    <ReceiverRole v="A04"/>
    <CreationDateTime v="2010-03-31T14:10:00Z"/>
    <ValidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Domain codingScheme="A01" v="10YDOM-1001A001A"/>
    <MolTimeSeries>
    <ContractIdentification v="RTE_20100331_1500_16"/>
    <ResourceProvider codingScheme="A01" v="10XFR-RTE------Q"/>
    <AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
    <ConnectingArea codingScheme="A01" v="10YFR-RTE------C"/>
    <AuctionIdentification v="AUCTION_20100331_1500_1600"/>
    <BusinessType v="A10"/>
    <BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <MeasureUnitQuantity v="MAW"/>
    <Currency v="EUR"/>
    <MeasureUnitPrice v="MWH"/>
    <Direction v="A02"/>
    <MinimumActivationQuantity v="50"/>
    <Status v="A06"/>
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.45"/>
    </Interval>
    </Period>
    </MolTimeSeries>
    <MolTimeSeries>
    <ContractIdentification v="RTE_20100331_1500_20"/>
    <ResourceProvider codingScheme="A01" v="10XFR-RTE------Q"/>
    <AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
    <ConnectingArea codingScheme="A01" v="10YFR-RTE------C"/>
    <AuctionIdentification v="AUCTION_20100331_1500_1600"/>
    <BusinessType v="A10"/>
    <BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <MeasureUnitQuantity v="MAW"/>
    <Currency v="EUR"/>
    <MeasureUnitPrice v="MWH"/>
    <Direction v="A02"/>
    <MinimumActivationQuantity v="50"/>
    <Status v="A06"/>
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.48"/>
    </Interval>
    </Period>
    </MolTimeSeries>
    <MolTimeSeries>
    <ContractIdentification v="NG_20100331_1500_6"/>
    <ResourceProvider codingScheme="A01" v="10X1001A1001A515"/>
    <AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
    <ConnectingArea codingScheme="A01" v="10YGB----------A"/>
    <AuctionIdentification v="AUCTION_20100331_1500_1600"/>
    <BusinessType v="A10"/>
    <BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <MeasureUnitQuantity v="MAW"/>
    <Currency v="EUR"/>
    <MeasureUnitPrice v="MWH"/>
    <Direction v="A01"/>
    <MinimumActivationQuantity v="50"/>
    <Status v="A06"/>
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="17.0"/>
    </Interval>
    </Period>
    </MolTimeSeries>
    </MolDocument>

    Hi,
    The result I got was:
    16RTE_20100331_1500_20NG_20100331_1500_6In the query you tried, you access a single record so you can't expect to get three rows "magically". The EXTRACT function just works as expected, it extracts the requested nodes, but the result is still an XML fragment (a scalar value).
    In order to achieve your goal, you have to break the MolTimeSeries sequence into relational rows.
    Two similar solutions are possible, XMLTable (10gR2 and up) or Table/XMLSequence.
    In your other post you mentioned db version 10.1, so I guess we'll go with XMLSequence :
    SELECT 'RTE'
           ,to_date(substr(extractvalue(x.xml_data,'/MolDocument/ValidTimeInterval/@v'),1,16),'yyyy-mm-dd"T"hh24:mi')
           ,decode(extractvalue(x2.column_value,'/MolTimeSeries/Direction/@v'),'A01','Up','Down')
           ,to_number(regexp_substr(extractvalue(x2.column_value,'/MolTimeSeries/ContractIdentification/@v'),'\d+$'))
           ,to_number(extractvalue(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice/@v'))
           ,sysdate
           ,null
           ,null
           ,extractvalue(x2.column_value,'/MolTimeSeries/ContractIdentification/@v')
           ,'SUBMITTED'
           ,'A96'
           ,null
           ,sysdate
    FROM xml_demo x,
         table(
           xmlsequence(
             extract(x.xml_data, '/MolDocument/MolTimeSeries')
         ) x2
    WHERE existsnode(x.xml_data,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1;Please also note the use of REGEXP_SUBSTR instead of the regular SUBSTR because it didn't work for "NG_20100331_1500_6".
    Hope that helps.
    Edited by: odie_63 on 24 juin 2010 21:18 - added regexp comment

  • FP-module don't use new *.iak when changing to iak-file on runtime

    Hi folks,
    I'm using FP1001 (RS-485) communication modules with a bank of FP-AI-110
    (8 x AI) and FP-SG-140 (8 x StrainGauge) with LabVIEW 6.1.
    Since I need to change input ranges of the modules on runtime
    (autoranging feature) and there is no vi to manage this, I created a
    couple of iak-files with the FP-explorer (V3.02, build 177), where I set
    the approbiate input ranges. My application then monitors the analog
    input data of the modules and changes the used iak-file as needed to
    prevent over- and underranging.
    When changing the iak-file the current session is closed (FP-Close) and
    the next session is opened with FP-Open and Create Tag, continuing with
    FP-read.
    My application does its' job well, since I monitor the currently used
    iak-file, range and the fact that sessions get closed before opening the
    next, but the FP-modules won't restart using the new range settings,
    after the following session is started with the other iak-file. The
    modules allways keep the previous settings.
    So whats wrong?
    Btw.
    I noticed FP-Explorer also has its problems changing module- ranges,
    after loading a new iak-file.
    So I startup the FP-Explorer with a iak-file for a low range setting
    (module input range) and increase the input voltage at the module input
    just as much that a overrange occurs. Then I load another iak-file with
    higher range-settings. FP-explorer shows the higher range in its range
    column, but when monitoring the module input values, overrange is showed
    first. After restarting monitoring, the input values are showed
    correctly.
    Heres' the problem:
    Loading the previous iak-file again, the overrange should show again,
    since the input value was left at the higher value, as set before. But
    no overrange shows! FP-Explorer monitors the higher input value which
    istn't within the input range, showed in the range column.
    So FP-explorer hasn't switched down the modules range!!!
    Restarting monitoring, or reloading the iak-file doesn't change
    anything. Restarting the FP-explorer shows overrange again when starting
    to monitor values. Restarting monitoring lets the FP-explorer continue
    to monitor the higher input value, which is above the range showed in
    the range column.
    The only thing which helps all the time, is to open the devices context
    menu, then to click on "Edit this device", and click on channel
    configuration. Then a pop-up window asks which setting to use (file or
    device). If I click on file, all the settings of the current used
    iak-file are used correctly.
    Ciao,
    Rainer

    Rainer,
    The FieldPoint IAK File is used in application programs (e.g. LabVIEW, LabWindows/CVI, OPC) for channel names, handle information and scaling information. FP Open.vi launches the FieldPoint Server with the specified IAK file, and uses the information in the specified IAK file for scaling (serial modules require scaling on the computer, ethernet modules scale the data in the network module) but does not re-configure the IO modules according to the IAK file. Likewise, opening an IAK file in FieldPoint Explorer does not reconfigure the IO modules to match the IAK file. The only times that settings are synchronized between the IAK and the modules are when a)the Find Devices command is issued (config from modules loaded), b) the Channel Configuration wi
    ndow is opened (file or module config can be choosen) or c) a Snapshot command is issued (current settings of modules are stored).
    Currently, the FieldPoint Server VI's do not allow dynamic re-configuration of ranges. If you wish to dynamically reconfigure your module ranges, you will need to use the FieldPoint Optomux VI's, which are located under the RT sub-palette of FieldPoint. They are installed by default only if you have LabVIEW RT, so you may need to re-install FieldPoint Explorer (custom install) to get them. For more information on the Optomux commands, please see the FP-1000/1001 Programmers Reference Manual.
    Regards,
    Aaron

  • Publishing with a new screen resolution changes the EXE file size quite dramatically

    Does anyone know why if you change the screen resolution and
    the re-publish a movie why the resulting EXE grows in size quite
    dramatically. Is there any way to avoid this to keep file sizes
    down?
    Thanks
    Alastair

    Yes it did help, in the respect that I felt confident that it wasn't anything to do with my project settings. The published files became corrupted when they were copied across to our intranet server. 
    thankyou
    Alison McLeavy
    Electronic Health Record Program
    Mater Health Services
    t: (07) 3163 6144    e: [email protected]
    f: (07) 3163 2685     w: www.mater.org.au

Maybe you are looking for

  • Can't hear the microphone

    Hi, I purchased a Speed Link USB microphone (http://www.play.com/PC/PCs/-/676/883/-/5983672/SPEEDLINK-SL-8709-Pure-Voice-Micr ophone-II-USB/Product.html?searchtype=genre). In the system properties, the device is recognised and when I speak into it, t

  • HFM reports giving "Access Denied" error

    Hi All, I am in a really critical situation. I am getting "Access Denied" error on accessing any of HFM reports through web or FR studio...all planning reports are working fine... I think the DCOM settings have some problem... FR is not able to commu

  • FTP/telnet issue on OL 5 64bit

    I am trying to enable FTP/Telnet on Oracle Linux server (64bit), i am still getting same error. I installed required RPM's [root@apps xinetd.d]# rpm -qa|grep telnet telnet-0.17-38.el5 [root@apps xinetd.d]# rpm -qa|grep ftp lftp-3.5.1-2.fc6 tftp-0.42-

  • Error when closing fiscal year 2010 for fixed assets

    I was performing year end close for asset management using TCode AJAB and received an error that one asset has not completed posting depreciation for 2010. When I looked at the asset that was causing the error I noticed there is still remaining "plan

  • LR guru advice needed

    Hello all I'm attempting to use LR for processing very large "technical" imagery and am running into adjustment consistency issues. I'd really appreciate some advice (including perhaps a couple of phone conversations) from an 'expert' commercial/tech