get the value from another class

get the value from another class

View Answers

November 18, 2008 at 11:23 PM

Hi friend,


import java.io.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

public class xmlRead{
static public void main(String[] arg) {
try{
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Please enter XML file name: ");
String xmlFile = buff.readLine();
File file = new File(xmlFile);
if (file.exists()){
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(xmlFile);
Transformer tf = TransformerFactory.newInstance().newTransformer();
tf.setOutputProperty(OutputKeys.METHOD, "text");
Source source = new DOMSource(doc);
Result result = new StreamResult(System.out);
tf.transform(source, result);
Node node = doc.getDocumentElement();
String root = node.getNodeName();
System.out.println("Root Node: " + root);
}
else{
System.out.println("File not found!");
}
}
catch (Exception e){
System.err.println(e);
System.exit(0);
}
}
}

---------------------------------------------

I am sending you a link. Visit for more information with running example. I hope that, this link will help you.

http://www.roseindia.net/xml/index.shtml

Thanks.









Related Tutorials/Questions & Answers:
get the value from another class - Java Beginners
get the value from another class  Hello to all, I have stupid question. I have main.java and ConfigXML.java(read my config xml file). Code from...().trim(); [/code] How I can get String alsl = ((Node)flnameTEXT.item(0
Get JTextField value from another class
Get JTextField value from another class   ... value from other class. For this, we have created two classes ClassA.java and ClassB.java. In ClassA, we have defined a textbox 'text1' that will get the value from
Advertisements
Use varibles from another class
Use varibles from another class  **I have two classes. class 1:** public class askfigures extends JFrame { method from class1: public void... in another class. (adsbygoogle = window.adsbygoogle || []).push
how to pass a string from one class to another
string from one class to another. import java.util.*; class A{ static String... String from class A: "+b); } }   Here is another example of passing string from one class to another. import java.io.*; class Class1 { public
How to call the run method from another class?
How to call the run method from another class?  Sorry... run() { new FereastraPrincipala().setVisible(true); from the class... want to call this from AdaugaComanda.java, so that changes can be seen
How to pass variable from one class to another in java
How to pass variable from one class to another in java  How to pass variable from one class to another in java?   Example: public class...); System.out.println("Another Class variables value:" + class1.getIdNo
get value from multiple textbox in jsp
get value from multiple textbox in jsp  how to get multiple textbox value in another jsp? If i using the following code <%for(int i=0;i<3;i++) {%> <td>name<input type="text" class="name" id="name">
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>">...);%> since url print a common.jsp?param=Arts but attr return a null value
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>">...);%> since url print a common.jsp?param=Arts but attr return a null value
navigating the value of JTextField from one JFrame to another - Swing AWT
navigating the value of JTextField from one JFrame to another  hello I m doing one project where I m retriving the data from databse in JTextField... button all the details of an item of JTextField will be displayed in another
Populate listbox according to selection value from another selectbox
Populate listbox according to selection value from another selectbox  ... listbox from database but campus list box will removes selected value.. please help... for campus and another for course. When i select campus i want to populate
navigating the value of JTextField from one JFrame to another - Swing AWT
navigating the value of JTextField from one JFrame to another  Hello... to retrive the new records from database using the the value of JForm1... the records from database using up and down keys of keyboard? And also I wanted
How to save and get value from JSP
How to save and get value from JSP  Employee Name Time... 324 2012-12-12 save i want to save dis value jsp to action ...how can i get all value ..and store..how can its values goes
Assigning a value to JSP variable from a bean class. - JSP-Servlet
Assigning a value to JSP variable from a bean class.  Hi, I want to know how we can assign value to a JSP variable from a Java Bean. I am using Struts, JSTL. Which tags should I use to assign the value. e.g Kindly
Problem to get connection from DAO class to JDBC
Problem to get connection from DAO class to JDBC  package controller; import java.sql.Connection; import java.sql.DriverManager; public class ConnectionProvider { private static Connection con=null; //static Connection
Unable to get data from class - Development process
Unable to get data from class  I get this code from the internet which read from comm port of the computer & modify is as below:- package COM... the getWeight() function from this ComControl class when i click the Jbutton2
Java swing: get selected value from combobox
Java swing: get selected value from combobox In this tutorial, you will learn how to get selected value from combobox. The combobox provides the list... imposed an actionlistener on the combobox in order to get the selected value from
how to pass class variable to another class
how to pass class variable to another class  i need to access a variable from a class to another class currently running at the same time. using Classname.variable i got the value. But when i change the value second time i got
PHP Array get key from value
In php array one can get the key from value by the use of array_search function Array_search function searches the key for the given values in the array. Example of PHP Array Get Key from Value <?php $product=array
Java call method from another class
Java call method from another class   ...; methods of another class. For this we have created two java files..., multiply, division and modulus have been created inside the class CallingMethod
ArrayList as an argument to another class
ArrayList as an argument to another class  how do you pass arraylists as arguments to another class, and how does the method/class accept this arraylist for use
How to get more than one value from ajax
How to get more than one value from ajax  I have multiple select list box in php. i filled the value using ajax. how to get different value to fill the same list box Ex. option value as id (adsbygoogle
passing textbox value from one page to another page using html n javascript
passing textbox value from one page to another page using html n javascript  on button onclick event pass text box value and i want to pass value...; <form type=get action="page2.html"> <table> <tr> <td>
how to get a numeric value from a message - JSP-Servlet
how to get a numeric value from a message  dear sir, I have to get a numeric value from a following message matter i.e Dear [1...(); strMatter = massMailDetails.getMatter(); now i have to get only values
unable to get value returned from javascript variable in page
unable to get value returned from javascript variable in page  Hi, I have 3 pages....i wrote a js function to get the value of radio button from one jsp page..what i want is to store the value returned from the js function
how to use string of one class into another Class
how to use string of one class into another Class  I created... i.e t1.getText() is to be used in different(another Class say in ClassB. How can I get it in ClassB
How to get specific index value from int buffer.
How to get specific index value from int buffer. In this tutorial, we will discuss how  to get specific index value from int buffer. IntBuffer...; int get(int index) The get() method reads int value
How to get given index value from FloatBuffer in java.
How to get given index value from FloatBuffer in java.  In this tutorial, we will discuss how to get given index value from FloatBuffer in java. FloatBuffer API: The java.nio.FloatBuffer class extends java.nio.Buffer class
How to get specific index value from ByteBuffer in java.
How to get specific index value from ByteBuffer in java.    ... will discuss how to get value of a given index from buffer. The ByteBuffer class is a container for handling data. The get(int index) method of ByteBuffer
How to get specific index value from long buffer.
How to get specific index value from long buffer. In this tutorial, we will discuss how  to get specific index value from long buffer. LongBuffer....  long get(int index) The get() method read long value
How to get specific index value from short buffer.
How to get specific index value from short buffer. In this tutorial, we will discuss how  to get specific index value from short buffer. ShortBuffer... reads is short value at given index from short buffer
how to get multiple hyperlink values from a table column to another jsp file?
how to get multiple hyperlink values from a table column to another jsp file... file named "dbtable" will get the parameter from "index" and search... show the specific details from that hyperlink which was clicked. there are 3
Pls provide me jsp code to get values in drop down list from another table's field....
Pls provide me jsp code to get values in drop down list from another table's field....  my project has customer registration and company registration pages..... when i insert data in company registration .. it ll have company id
Pass value of rasio button from jsp page to action class(not conventional problem)
Pass value of rasio button from jsp page to action class(not conventional...;table border="1"> <tbody> <s:iterator value...; <td><s:property value="#id.startTime" /></td>
returning a value from Threads
returning a value from Threads  Hello I have worker pattern that uses... when returning a value using Future.I have code snippet below: ExecutorService... and i as job and jobNumber to JobImpl class: public class JobImpl implements
Reading Value From console
Reading Value From console  In case of String data Type readLine method of DataInputStream class read complete line of the given string but the next method of Scanner class doesn't read the complete line of String. why
Reading Value From console
Reading Value From console  In case of String data Type readLine method of DataInputStream class read complete line of the given string but the next method of Scanner class doesn't read the complete line of String. why
Java get decimal value
Java get decimal value       We can also get the decimal value in the specified format as we wish by calling DecimalFormat class. It will format a long value to the specified
Show a hidden frame previously from another from
Show a hidden frame previously from another from  How can i show a hidden frame previously by this code: jframe_name.hide(); and make it visible from another frame i'm waiting for the answer, and i'll be thankfull
Return Value from One Form
Return Value from One Form  I have two buttons in main form client... is there.when i click dedupe button another form will open. i want to get a field value of dedupe form and use in bank form..how to do
Read the value from XML in java
Read the value from XML in java  Hi, i have an XML with the following code. I need to get the path("D... the permissions on that file.So how can i read that value. This is little urgent
passing data from one jframe to another
passing data from one jframe to another  I have two JFrame,built by using the GUI Editor netbeans 6.9.i have to pass a data from a Jtextfield in the first Jframe to another JLabel in the other JFrame.Can you please help me,how
Get session value in javascript
Get session value in javascript   How to iterate session value onebyone in JavaScript
how to get radio value
how to get radio value    how to retrive the option value and insert the next table pls give example
Run a .exe from a class
Run a .exe from a class  how to lauch a .exe file from a class in Java and to check the success ful execution of the same
how to get the image of a selected JRadioButton to another panel?
how to get the image of a selected JRadioButton to another panel?  how to get the image of a selected JRadioButton to another panel
calling one jsp from another jsp page
calling one jsp from another jsp page  need coding for calling one jsp from another jsp including the xml file.Its urgent
what is set value or get value mathod?
what is set value or get value mathod?  i create a JTable in this table it containt 3 column or 10 rows. i want to get two value from access file db1 and i want to set third value in third column and set it in again db1? pls tell
get textfield value in javascript
get textfield value in javascript  How to get and the set value of text field in JavaScript?   Get the text field value in JavaScript <..."> <input type="button" value="Convert" onclick="convertText()">
Get GMT from IP
Get GMT from IP  How do I get GMT value from IP address?? Thanx in Adv

Ads