Processing
XML document using the Java code is simple if you know the logic and
the classes and the methods that are used in it. A document object is
created to load the XML file that you want to process. The following
code sample would do that,
_______________________________________________
_______________________________________________
import
org.w3c.dom.Document;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
DocumentBuilderFactory
dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse (new File("ur_xml_file.xml"));
. . .
. . .
doc.getDocumentElement().getNodeName());
NodeList nl = doc.getElementsByTagName("element_name");
. . .
. . .
The above
code could be understood if you see how the document object is created
and the XML file you want to process is loaded into that document object.
Once the XML document is loaded you can use the getDocumentElement().getNodeName()
to get the name of the root element.
You can
create a NodeList object and get all the nodes by Tagname using the
method getElementsByTagName(). This method takes the name of the element
that you want as the argument in the form of string. You can loop through
the NodeList object using a 'for' loop and work with the elements.
ScriptMaster Allows Java Code Use- Without Expertise (SYS-CON Media)
360Works, a FileMaker product developer, will be releasing a new version of its ScriptMaster tool later this month. A completely free, modular plugin for FileMaker, ScriptMaster allows developers to use Java code even without Java expertise. Version 2.0 includes modules for file manipulation, URL downloads, XML Web Services, encoding/encryption, FileMaker script triggering, shell scripting, ...
Recent Original Stories (OS News)
"One of the things my team has been working to enable has been the ability for .NET developers to download and browse the source code of the .NET Framework libraries, and to easily enable debugging support in them.