| | |
adding values to xml
![]() |
•
•
Join Date: Nov 2007
Posts: 84
Reputation:
Solved Threads: 0
hi there,
how can I change string to xml and vise verse in java, in addition how can I add values to xml according to element name ,
I can imagine something like "setValue(elementName, the value) ; as we are using in java,
any suggestions any help , please!
thanks in advance
how can I change string to xml and vise verse in java, in addition how can I add values to xml according to element name ,
I can imagine something like "setValue(elementName, the value) ; as we are using in java,
any suggestions any help , please!
thanks in advance
there's always something to learn
You might want to look into the Java XML API, W3C DOM API and its implementations like Xerces. The Xerces XML parsing library comes bundled with your Java runtime. A simple Xerces program: BTW, if all you need to do is manipulate your XML files in memory, go for a Java specific solution like JDOM.
Java Syntax (Toggle Plain Text)
public class Test { public static void main(final String[] args) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); System.out.println(factory + "\n" + builder); InputSource in = new InputSource(new StringReader( "<?xml version='1.0'?><root><child value='1'/></root>")); // The doc now contains the entire XML hierarchy Document doc = builder.parse(in); } }
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- How to get the values of an XML file in C#? (C#)
- Adding values from XML file to combo box (HTML and CSS)
- Adding values read from input file? (C)
- Adding Attributes to all XML Nodes (RSS, Web Services and SOAP)
- XML Serialization (C#)
- adding innertext to an xml node (C#)
- Pass XML file contents to a hash table. (Java)
Other Threads in the Java Forum
- Previous Thread: How to open a text file to view using java
- Next Thread: StockTrackerDB login error
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary blackberry block bluetooth character chat class client code component consumer csv database desktop developmenthelp eclipse error fractal ftp game givemetehcodez graphics gui html ide image integer j2me j2seprojects japplet java javaarraylist javac javaee javaprojects jni jpanel julia lego linked linux list loops mac map method methods mobile netbeans newbie number objects online oriented panel printf problem program programming project projects properties recursion replaydirector reporting researchinmotion rotatetext rsa scanner se server set singleton sms sort sql string swing test textfields threads time title tree tutorial-sample ubuntu update windows working






