>>>>> "Matt" == Matt Raible <[EMAIL PROTECTED]> writes:
Matt> I've completed this task - however, it would've been MUCH easier to just use
a
Matt> properties file. Of course, it could just be my experience with XML parsing
-
Matt> because I had to write a lot of code to grab 4 simple varaibles.
Matt> // Get the XML Document
Matt> DocumentBuilderFactory builderFactory =
Matt> DocumentBuilderFactory.newInstance();
Matt> DocumentBuilder builder = builderFactory.newDocumentBuilder();
Matt> Document doc = builder.parse(is);
Matt> // close the input stream
Matt> is.close();
Matt> // get the repository root
Matt> NodeList rep = doc.getElementsByTagName("root");
Matt> Node node = rep.item(0);
Matt> Text rootDir = (Text) node.getFirstChild();
Matt> config.setRepositoryRootDir(rootDir.getNodeValue());
Matt> // get the assets directory
Matt> rep = doc.getElementsByTagName("assets");
Matt> node = rep.item(0);
Matt> Text assetDir = (Text) node.getFirstChild();
Matt> config.setAssetDir(assetDir.getNodeValue());
You might take a look at JDOM. It's a bit easier to use than the straight DOM
api. The web site (<http://www.jdom.org/>) has links to several articles and
example code.
--
===================================================================
David M. Karr ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>