Passing string instead of node while creating a XML file in java

JPSftw

New Member
I would like to create a XML file which would have all the information about the system.To get the information, i would use \[code\]getProperty(os.name)\[/code\] and would save it in a string like this \[code\]String nameOS = "os.name"; nameOS=System.getProperty(nameOS);\[/code\]And now i would like to create an XML and would like the value of this string to be one of the element of XML file created, for which i would be doing something like this \[code\]Element Osname = doc.createElement("Osname");Osname.appendChild(doc.createTextNode("nameOS"));staff.appendChild(Osname);\[/code\]But Output xml file looks likes this \[code\]<?xml version="1.0" encoding="UTF-8" standalone="no" ?> - <HardwareInfo> <OsName>nameOS</OsName> </HardwareInfo>\[/code\]I get the name of the string in the output instead of Value of the string.Any help would be very much appreciated.
 
Back
Top