If you
have already worked with some other scripting language or programming
language in a document object then this will not be new to you.
_______________________________________________
_______________________________________________
To
work with an XML document it is easy to do so, if you have a document
object in place and the XML document loaded in it. Yes, java too has
APIs for working with an XML document. With this API, you can navigate
through the XML document, or create an XML document from the scratch.
import
org.w3c.dom.Document;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
DocumentBuilderFactory
fact = DocumentBuilderFactory.newInstance();
DocumentBuilder bd = fact.newDocumentBuilder();
doc = bd.newDocument();
Element rt = (Element) doc.createElement("rtElement");
document.appendChild(root);
rt.appendChild( doc.createTextNode("Some") );
. . .
. . .
Proper
imports are to be done to work with the classes and the methods needed
for working with an XML document. The above code sample would give you
an idea on how to go about it. Methods like createElement of the Element
object are used to create elements.
And these
elements are added to the root node using the method appendChild. Lots
of sample codes are available in the internet on this topic.
Download these IBM resources today! (Linux Today)
eKit: Web Application Security Discover how IBM Rational AppScan Standard Edition can help you detect vulnerabilities in your Web applications.
Current Newswire: (Linux Today)
"We've talked all too often about AtomBIOS and there being two different open-source drivers that support the same ATI Radeon hardware with the key architectural difference between the two just being the use of this video BIOS abstraction layer.