Reading from XML file using DOM parser.

Hi,
I have written the following java code to read the XML file and print the values. It reads the XML file. It gets the node NAME and prints it. But it returns null when trying to get the node VALUE. I am unable to figure out why.
Can anyone please help me with this.
Thanks and Regards,
Shweta
import java.io.*;
import java.net.*;
import java.util.*;
import oracle.xml.parser.v2.*;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
public class ReadNodes
private static XMLDocument mDoc;
public ReadNodes () {
     try {
DOMParser lParser = new DOMParser();
URL lUrl = createURL("mot.xml");
System.out.println("after creating the URL object ");
lParser.setErrorStream(System.out);
lParser.showWarnings(true);
lParser.parse(lUrl);
mDoc = lParser.getDocument();
     System.out.println("after creating the URL object "+mDoc);
lParser.reset();
} catch (Exception e) {
e.printStackTrace();
} // end catch block
} // End of constructor
public void read() throws DOMException {
try {
     NodeList lTrans = this.mDoc.getElementsByTagName("TRANSLATION");
     for(int i=0;i<lTrans.getLength();i++) {
          NodeList lTrans1 = lTrans.item(i).getChildNodes();
          System.out.println("lTrans1.item(0).getNodeName : " + lTrans1.item(0).getNodeName());
          System.out.println("lTrans1.item(0).getNodeValue : " + lTrans1.item(0).getNodeValue());
          System.out.println("lTrans1.item(1).getNodeName : " + lTrans1.item(1).getNodeName());
          System.out.println("lTrans1.item(1).getNodeValue : " + lTrans1.item(1).getNodeValue());
     } catch (Exception e) {
     System.out.println("Exception "+e);
     e.printStackTrace();
     } catch (Throwable t) {
          System.out.println("Exception "+t);
public static URL createURL(String pFileName) throws MalformedURLException {
URL url = null;
try {
url = new URL(pFileName);
} catch (MalformedURLException ex) {
File f = new File(pFileName);
String path = f.getAbsolutePath();
String fs = System.getProperty("file.separator");
System.out.println(" path of file : "+path +"separator " +fs);
if (fs.length() == 1) {
char sep = fs.charAt(0);
if (sep != '/')
path = path.replace(sep, '/');
if (path.charAt(0) != '/')
path = '/' + path;
path = "file://" + path;
System.out.println("path is : "+path);
// Try again, if this throws an exception we just raise it up
url = new URL(path);
} // End catch block
return url;
} // end method create URL
public static void main (String args[]) {
     ReadNodes mXML = new ReadNodes();
     mXML.read();
The XML file that I am using is
<?xml version = "1.0"?>
<DOCUMENT>
<LANGUAGE_TRANS>
<TRANSLATION>
<CODE>3</CODE>
<VALUE>Please select a number</VALUE>
</TRANSLATION>
<TRANSLATION>
<CODE>5</CODE>
<VALUE>Patni</VALUE>
</TRANSLATION>
<TRANSLATION>
<CODE>6</CODE>
<VALUE>Status Messages</VALUE>
</TRANSLATION>
<TRANSLATION>
<CODE>7</CODE>
<VALUE>Progress</VALUE>
</TRANSLATION>
<TRANSLATION>
<CODE>8</CODE>
<VALUE>Create Data Files...</VALUE>
</TRANSLATION>
<TRANSLATION>
<CODE>9</CODE>
<VALUE>OK</VALUE>
</TRANSLATION>
</LANGUAGE_TRANS>
</DOCUMENT>

because what you want is not the node value of CODE but the node value of the text nodes into it!
assuming only one text node into it, try this:
System.out.println("lTrans1.item(0).getNodeName : " + lTrans1.item(0).getFirstChild().getNodeValue());

Similar Messages

  • Updating XML file using DOM parser

    Hi,
    Can someone help me, how to update following XML file using DOM parser.
    The following is my XML file.
    <students>
         <student>
              <id>1</id>
              <name>abc</name>
         </student>
         <student>
              <id>2</id>
              <name>xyz</name>
         </student>
         <student>
              <id>3</id>
              <name/>
         </student>
         <student>
              <id>4</id>
              <name>ijk</name>
         </student>
         <student>
              <id>5</id>
              <name></name>
         </student>
    </students>Consider, I will input 2 fields, ie., id & name. For the matching Id, the name has to be updated.
    Though, I have achieved this, but I am unable to update the value for 3rd record, & 5th record ie., id=3 & id=5. Since, these are blank.
    Thanks.

    Some <name> elements have a child node which is a text node. From what you say it appears you know how to change those text nodes.
    The other <name> elements don't have any child nodes. But you want one. This suggests to me that you need code that creates a text node and adds it to the <name> element as its child.

  • Delete elements from XML file using DOM and java

    Hi
    I want now is to remove element from my XML file
    for example
    i have following xml
    <?xml version="1.0" encoding="UTF-8"?>
    <printing>
    <firstLineTexts>
              <firstLineText />
              <firstLineText>|line11</firstLineText>
              <firstLineText>|line12</firstLineText>
    </firstLineTexts>
    </printing>how do i remove all elements fireLineText
    my final output should be
    <?xml version="1.0" encoding="UTF-8"?>
    <printing>
    <firstLineTexts>
    </firstLineTexts>
    </printing>How do i do it using DOM,
    I can create instance of DOM and write it using TransformerFactory
    Ashish

    Hi
    I am trying the following code,
    but it is not working
                    NodeList nScene = doc.getElementsByTagName("firstLineTexts");
              NodeList nScene1 = nScene.item(0).getChildNodes();
              for (int i = 0; i < nScene1.getLength(); i++)
                   Node n = nScene1.item(i);
                        nScene.item(0).removeChild(n);
              }

  • Where can I find an example of a vi which reads a xml file using the Labview schema (LVXMLSchema.xsd)?

    Where can I find an example of a vi which reads a xml file using the Labview schema (LVXMLSchema.xsd)?
    �Unflatten From XML� is of little use in parsing because it requires the data type. So it seems that the user has to parse each data value, and then �Unflatten From XML� can help a little.
    I would like to see NI provide a VI for parsing it�s own schema.

    LabVIEW's XML functions are another way of saving data from controls and indicators that is in a more standardized format. If you look at the Unflatten From XML shipping example, it shows taking the data that you would normally send to a Digital Wveform Graph and converting it to XML instead. This data is then unflattend from XML and wired to the graph. Since you know what you wrote to the file, this is an easy thing to do. If what you are looking for is a way to look at any data in any LabVIEW XML file, then you are right, there is not a VI for that. However, I do not believe that that was the intention of the XML functions in the first place.
    By wiriting data in XML, this allows other applications outside of LabVIEW to parse and recognize the dat
    a. In LabVIEW, you would already know the types and can place a generic item of that type. The issue of knowing the type is that you need to know the type of the wire that comes out of the Unflatten function so that the VI will compile correctly. You could always choose a variant value to unflatten and then do some parsing to take the variant a part. Maybe this will help you out.
    See this example for using the Microsoft parser for XML. (http://venus.ni.com/stage/we/niepd_web_display.DISPLAY_EPD4?p_guid=B123AE0CB9FE111EE034080020E74861&p_node=DZ52050&p_submitted=N&p_rank=&p_answer=)
    Randy Hoskin
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • Cannot close an XML file used for parsing

    Hi All,
    I appears to have difficulty closing (possibly flushing it first) an XML file that was subsequently being parsed without success. The error generated is:
    org.jdom.input.JDOMParseException: Error on line 23: The element type "form" must be terminated by the matching end-tag "</form>".
    Below is the code snippets of readData() to retrieve (HTML) data from a website, save it to a file, then convert to XML format before returning the new filename:
    public String readData() {
        try {
              URL url  = new URL("http://www.abc.com");
              URLConnection connection = url.openConnection();      
              InputStream isInHtml = url.openStream();   // throws an IOException    
              disInHtml = new DataInputStream(new BufferedInputStream(isInHtml));         
              System.out.flush();
              FileOutputStream fosOutHtml = null;
              fosOutHtml = new FileOutputStream("C:\\Temp\\ABC.html");
              int oneChar, count=0;
              while ((oneChar=disInHtml.read()) != -1)
                  fosOutHtml.write(oneChar);
              isInHtml.close();
              disInHtml.close();
              fosOutHtml.flush();    // optional
              fosOutHtml.close();
        try {
              File fileInHtml = new File("C:\\Temp\\ABC.html");
              FileReader frInHtml = new FileReader(fileInHtml);
              BufferedReader brInHtml = new BufferedReader(frInHtml);
              String string = "";
              while (brInHtml.ready())
                  string += brInHtml.readLine() + "\n";
              fwOutXml  = new FileWriter("C:\\Temp\\ABC.xml");
              pwOutXml  = new PrintWriter(fwOutXml);
              light_html2xml html2xml = new light_html2xml();
              pwOutXml.print(html2xml.Html2Xml(string));
              system.out.flush()     // optional
              fwOutXml.flush();      // optional
              fwOutXml.close();
              pwOutXml.flush();      // optional
              pwOutXml.close();
              return fileInHtml.getAbsolutePath();
    // parseData reads the XML file using the name returned by readData()
    public void parseData(String XMLFilename)
        try
            FileReader frInXml = new FileReader(FileName);
            BufferedReader brInXml = new BufferedReader(frInXml);
            SAXBuilder saxBuilder = new SAXBuilder("org.apache.xerces.parsers.SAXParser"); // JDOMParseException generated.
    }These codes would worked when they were in a single method but I have since placed some structure around them using a number methods.
    This issue has risen in th past where I have been able to close the XML file prior to reading them again. However, I don't have a solution for it this time round.
    I am running JDK 1.6.0_10, Netbeans 6.1, JDOM 1.1 on Windows XP platform.
    Any assistance would be appreciated.
    Many thanks,
    Jack

    Hi Alain,
    I have added the additional I/O statements in the finally clause as follows but the problem still persisted:
    readData()
    // reading data (html) from the webpage and save it in html format.
    try {
    catch { …. }
    finally {
           System.out.flush();
           isInHtml.close();
           disInHtml.close();
           fosOutHtml.flush();
           fosOutHtml.getFD().sync();
           fosOutHtml.close();
    // convert the html webpage format to xml format
    try {
    catch { …. }
    finally {
           System.out.flush();
           fwOutXml.flush();
           fwOutXml.close();
           pwOutXml.flush();
           pwOutXml.close();
    Below is a short listing of the new XML file:
      <?xml version="1.0" encoding="iso-8859-1" ?>
    - <html>
    - <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <meta name="keywords" content="California, cities, towns, villages, list, zipcodes, postal codes, united states, ca" />
      <meta name="description" content="Cities, towns and suburbs in California, United States (CA) starting with A" />
      <title>Cities and Towns in California starting with A – ABC Company</title>
      <link rel="stylesheet" href="http://www.abc.com/style.css" type="text/css" media="screen" />
      </head>
    - <body>
      <a name="top" />
    - <div id="container">
    - <div id="header">
      <div id="postmark" />
    - <a href="http://www.abc.com/" class="imglink">
      <img id="logoimg" src="http://www.abc.com/images/zipcodes.gif" width="192" height="33" alt="Zipcodes America Logo" />
      </a>
      <hr />
      </div>
    - <div id="nav">
    - <ul>
    - <li>
      <a href="http://www.abc.com/" title="Home Page">Home</a>
      </li>
    - <li>
      <strong>Search</strong>
      (zipcode or suburb)
    - <div class="hide">
      <form method="post" action="http://www.abc.com/search" />        // line 23
      </div>
      <input type="text" name="q" class="searchbox" alt="Search query" />
      <br />
      <input type="submit" value="find!" class="searchbutton" alt="Perform search" />
      <div class="hide" />
      </li>
    …What I find it interesting is that it is possible to parse the above XML file with the same parseData() from another class without any problem. As a result, I have come to the following conclusion so far:
    ( i ) There is some file locking that is prevent saxBuilder from parsing the XML file at the time.
    ( ii ) The light_html2xml does not appears to have correctly converted over the orginal Html to Xml but some how it has been picked up by the parser in the same class, but not by the same parser from another class.
    ( iii ) I would like to use another conversion tool such as Tagsoup in place of light_html2xml to determine where the cause of this issue is coming from. As a result, would you or anyone be able to assist me coming up with a few lines of conversion statements using Tagsoup since I am not familiar with using this tool?
    ( iv ) light_html2xml is good as it strip out all namespace, DTD, Entity Resolver, etc and only return what I need. JTidy does correct conversion but include namespace, DTD, Entity Resolver which makes parsing difficulty.
    Many thanks again,
    Jack

  • How to get nodes and its attributes of an XML file usiong DOM parsing?

    how to get nodes and its attributes of an XML file usiong DOM parsing?
    i am new to XML parsing.......
    Thanking you........

    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;      ...
    //Setup the document
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
         Document doc = docBuilder.parse (new File("MY_XML_FILE.xml"));
    //get elemets by name
         String elementValue = doc.getElementsByTagName("MY_ELEMENT").item(0).getTextContent();
    //This method can return multiple nodes, in this instance I get item(0) , first nodeRead the api for other methods of getting data.

  • Problem writing xml file using DOM

    Hi,
    I am trying to write a xml file using DOM. I am using xalan 2.5, xerces 1.4.4, jdk 1.3.1 in JRun 3 on windows.
    The code where I get exception :
                   TransformerFactory tFactory = TransformerFactory.newInstance();
                   Transformer transformer = tFactory.newTransformer();
                   transformer.transform(new DOMSource(doc), new StreamResult("pr.xml"));
    I get the runtime error as follows:
    javax.servlet.ServletException: null
    java.lang.NoSuchMethodError
         at org.apache.xml.utils.DOM2Helper.getNamespaceOfNodeDOM2Helper.java:342)
         at org.apache.xml.utils.TreeWalker.startNode(TreeWalker.java:387)
         at org.apache.xml.utils.TreeWalker.traverse(TreeWalker.java:202)
         at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:343)
    Thinking it is because of classpath, I placed xalan 2.5, xerces 1.4.4 jar files in jrun admin lib directory and in server lib directory as well. Still getting the same error.
    Any suggestion?
    Thanks in advance

    xalan is included in JRun 4. However JRun 3 does not.
    However I tried with the same code in JRun3 in different system. The error is completely different. I understand this is because of different version of files. trying to solve ;)
    Here my new exception
    javax.servlet.ServletException: org/w3c/dom/ranges/DocumentRange
    java.lang.NoClassDefFoundError: org/w3c/dom/ranges/DocumentRange
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:493)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:493)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
         at org.apache.xerces.jaxp.DocumentBuilderImpl.(Unknown Source)
         at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
         at com.cybell.appl.deliveryorder.cmd.CreateXMLDOFile.createFile(CreateXMLDOFile.java:73)
         at com.cybell.appl.deliveryorder.cmd.CreateXMLDOFile.execute(CreateXMLDOFile.java:36)
         at com.cybell.appl.framework.cmd.BaseCommand.start(BaseCommand.java:50)
         at com.cybell.appl.framework.control.BaseController.service(BaseController.java:38)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
         at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1013)
         at allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:925)
         at allaire.jrun.servlet.JRunNamedDispatcher.forward(../servlet/JRunNamedDispatcher.java:34)
         at allaire.jrun.servlet.Invoker.service(../servlet/Invoker.java:84)
         at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1013)
         at allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:925)
         at allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDispatcher.java:88)
         at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1131)
         at allaire.jrun.servlet.JvmContext.dispatch(../servlet/JvmContext.java:330)
         at allaire.jrun.http.WebEndpoint.run(../http/WebEndpoint.java:107)
         at allaire.jrun.ThreadPool.run(../ThreadPool.java:272)
         at allaire.jrun.WorkerThread.run(../WorkerThread.java:75)

  • Exception thrown while reading an XML file using Properties

    Exception thrown while reading an XML file using Properties.
    Exception in thread "main" java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException:
    The processing instruction target matching "[xX][mM][lL]" is not allowed.
    at java.util.XMLUtils.load(Unknown Source)
    <?xml version="1.0"?>
    <Config>
         <Database>
              <Product>FX.O</Product>
              <URL>jdbc:oracle:thin:@0.0.0.0:ABC</URL>
         </Database>
    </Config>Am I missing anything?

    Thanks a lot for all yr help.I have got the basics of
    the DTD
    However,when I say thus
    <!DOCTYPE Config SYSTEM "c:/PartyConfig">
    ?xml version="1.0"?>
    <Config>
         <Database>
              <Product>FX</Product>
              <URL>jdbc:oracle:thin:@0.0.0.0:ABC</URL>
         </Database>
    </Config>I get the error
    Invalid system identifier: file:///c:/ParyConfig.dtd
    Please advise?for goodness sake, how many times do I have to tell you that you can't just expect the Properties class to accept arbitrary XML in any format? it reads XML in the format I linked to, and nothing else. Properties is not a general purpose XML binding. you can't do what you're trying to do with it. read this and in particular pay attention to the following
    The XML document must have the following DOCTYPE declaration:
    <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
    Furthermore, the document must satisfy the properties DTD described above.
    you are not reading my answers properly, are you? kindly do so

  • Output data type of Read from XML file.vi

    LV 7.1:
    How can I enforce the output data type of the polymorphic "Read from XML file.vi" to be a string instead of an array of strings?

    ahlers01 wrote:
    LV 7.1:
    How can I enforce the output data type of the polymorphic "Read from XML file.vi" to be a string instead of an array of strings?
    In reply to my own post:
    I found the answer and described it in another forum

  • SAX: How to create new XML file using SAX parser

    Hi,
    Please anybody help me to create a XML file using the Packages in the 5.0 pack of java. I have successfully created it reading the tag names and values from database using DOM but can i do this using SAX.
    I am successful to read XML using SAX, now i want to create new XML file for some tags and its values using SAX.
    How can i do this ?
    Sachin Kulkarni

    SAX is a parser, not a generator.Well,
    you can use it to create an XML file too. And it will take care of proper encoding, thus being much superior to a normal textwriter:
    See the following code snippet (out is a OutputStream):
    PrintWriter pw = new PrintWriter(out);
          StreamResult streamResult = new StreamResult(pw);
          SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance();
          //      SAX2.0 ContentHandler.
          TransformerHandler hd = tf.newTransformerHandler();
          Transformer serializer = hd.getTransformer();
          serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");//
          serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,"pdfBookmarks.xsd");
          serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,"http://schema.inplus.de/pdf/1.0");
          serializer.setOutputProperty(OutputKeys.METHOD,"xml");
          serializer.setOutputProperty(OutputKeys.INDENT, "yes");
          hd.setResult(streamResult);
          hd.startDocument();
          //Get a processing instruction
          hd.processingInstruction("xml-stylesheet","type=\"text/xsl\" href=\"mystyle.xsl\"");
          AttributesImpl atts = new AttributesImpl();
          atts.addAttribute("", "", "someattribute", "CDATA", "test");
          atts.addAttribute("", "", "moreattributes", "CDATA", "test2");
           hd.startElement("", "", "MyTag", atts);
    String curTitle = "Something inside a tag";
              hd.characters(curTitle.toCharArray(), 0, curTitle.length());
        hd.endElement("", "", "MyTag");
          hd.endDocument();
    You are responsible for proper nesting. SAX takes care of encoding.
    Hth
    ;-) stw

  • How to delete a perticular node from xml file using java code

    Hii All,
    Now i am trying to delete a perticular node from xml file.Like...
    XML file:
    <Licence>
    <SERVER>
    <was id="1">1</was>
    <was id="2">2</was>
    </SERVER>
    </LICENCE>
    I am working in messaging service using JABBER framework with whiteboard facility.
    Here Some commands i have created to add,modify,delete nodes from xml file.They Are
    1.If u want to add a new node then.
    create Licence.SERVER <ss id="3">ddd</ss> lic.xml
    (here u want to add a new node called "ss" under Licence.SERVER.
    And lic.xml is tyhe xml file name where it was saved.
    2.If u want to delete a node(Suppose <was id="1">),then the command should be
    delete Licence.SERVER.was:id='"1" lic.xml
    A problem arises that here it find two was attributes.And it delete the last was attribute,not the requested node.
    PLEASE HELP ME IN SOLVING THIS CODE..
    ------------------------------------

    Looks like you clicked on "Post" before you pasted in the code you were talking about.

  • Buiding xml file using SAX parser of JAXP

    Please send me xml building using the sax parser.This is the urgent requirement ,iam not geeting how to solve this problem.so please anybody can help with one best example

    You don't build an XML file with a parser. A parser reads an XML file and converts it to some internal representation. Try reading this tutorial:
    http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/

  • Reading from XML File to Oracle

    hello,
    I am facing an issue.
    I have an xml file which i want to read into an Oracle dB.
    for ex
    <user>
    <user1 ident="1" />
    <user2 ident="2" />
    </user>
    I would want to pick those attributes and insert them into the dB. i have been hunting high and low, but not reached anywhere.
    The reason, i am using the xml file is, that the user enters values from 3 forms and those values are stored in the xml file. Now, i want to insert these values in the database.
    Any help/suggestion are welcomed and appreciated.
    Thank You
    Sean

    Hi,
    I have been able to read the xml file and convert them into textboxes. The problem, i am facing is, how to i relate each of those values which are generated in the form of textboxes into values required by the Stored Procedure.
    has anyone come across this problem or is there a better approach.
    please advice
    thank you all

  • I need for a simple example of  reading a xml file using jdom

    Hello
    I have been looking for a simple example that uses Jdom to read am xml file and use the information for anything( ), and I just can't find one.since I'm just beggining to understand how things work, I need a good example.thanks
    here is just a simple cod for example:
    <xmlMy>
         <table>
              <item name="first" value="123" createdDate="1/1/90"/>
              <item name="second" value="456" createdDate="1/4/96"/>
         </table>
         <server>
              <property name="port" value="12345"/>
              <property name="maxClients" value="3"/>
         </server>
    </xmlMy>Dave

    Hi,
            FileInputStream fileInputStream = null;
            try {
                fileInputStream = new FileInputStream("my_xml_file.xml");
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } finally{
                if (fileInputStream == null) return;
            SAXBuilder saxBuilder = new SAXBuilder();
            saxBuilder.setEntityResolver(new EntityResolver() {
                public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                    return new InputSource(new StringReader(""));
            Document document = null;
            try {
                document = saxBuilder.build(fileInputStream);
            } catch (JDOMException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (document == null) return;
            Element element = document.getRootElement();
            System.out.println(element.getName());
            System.out.println(element.getChild("table").getName());

  • Reading from XML file is too slow

    I am trying to read some values from XML file, it takes about 1 or 2 minutes to finish reading, my xml file has about 4000 xml elements. Does anyone know this is normal or something wrong? How could make it faster?
    Thank you

    fine if it helps others... i hope NI will not be angry *fg*
    thx for your bug-report, i do not test the sub.vi until now.
    exchange the OR with an AND, solves the problem with the endless-loop, but error checking will not work (the loop only stops if no error AND no start-tag is found)
    changing the loop termination condition and putting the NOT from the error condition to the no_starttag_flag do both. correctly stops the loop when error occurs OR no further elements found.
    i attached the new sub.vi for version 7.0 and 7.1, also but some colors in the logo, for your convinience
    catweazle
    Attachments:
    xmlFile_GetElements_(Array).vi ‏76 KB
    xmlFile_GetElements_(Array).vi ‏65 KB

Maybe you are looking for

  • Help...program will freeze, then cause entire computer to freeze

    This problem used to be extremely infrequent, but lately (as in the past 2 weeks) I've had this problem at least once a day (sometimes 2 or 3 times). I did do the recent software update, so that might have something to do with it...anyways, I'll be u

  • Need Help Restore iPod

    Reset iPod Classic. Slowly boots up with the Apple Logo on screen. When I place my ear to the back of the iPod I can hear clicking sounds like a clock ticking. Tick, Tick, Tick. iTunes won't see it's connected. I get the 'ipod disk write error' from

  • Budget Cycle Approval

    Hi Everyone, i have a problem in maintaining planning unit hierarchy, (By the way am working on hyperion planning Version 11.1.2.2) here is my situation, i have 2 users who will use the same entity while budgeting there forms in budget scenario, and

  • Formatted search values

    Hello experts How can I get access to formated search form? How to return its marix values (it returns 3 values)? I can choose forms uniqal ID, but how can I get a specific row from it? Or how can I display the list of indexes after puttin "*" in the

  • Jittery top edge of movie: mask in iDVD or iMovie?

    My video camera probably had dirty heads and there is a few pixel band on the very top edge of the movies that dances. I would like to mask that out: should I do it in iMovie or IDVD? How do I do that?