Hi Brett,
I believe you are missing:
Element root = doc.getDocumentElement();
-then- call:
NodeList nodes = root.getElementsByTagName("JavaXML:hostname");
if (nodes.getLength() > 0) {
hostname = nodes.item(0).getNodeValue();
}
nodes = root.getElementsByTagName("JavaXML:port");
if (nodes.getLength() > 0) {
portNumber = (Integer.parseInt(nodes.item(0).getNodeValue());
}
Chris
and then from there, call
> Brett McLaughlin wrote:
>
> I must be getting stupid as the night wears on... can someone point me in
> the direction in what error I am making?
>
> For the following XML document:
>
> <?xml version="1.0"?>
>
> <JavaXML:xmlrpc-config xmlns:JavaXML="http://myUrl.com">
> <JavaXML:hostname>localhost</JavaXML:hostname>
> <JavaXML:port type="unprotected">85</JavaXML:port>
> </JavaXML:xmlrpc-config>
>
> and this code snippet:
>
> try {
> DOMParser parser = new (org.apache.xerces.parsers.)DOMParser();
> parser.parse(uri); // Parse supplied document
> Document doc = parser.getDocument();
>
> NodeList nodes = doc.getElementsByTagName("JavaXML:hostname");
> if (nodes.getLength() > 0) {
> hostname = nodes.item(0).getNodeValue();
> }
>
> nodes = doc.getElementsByTagName("JavaXML:port");
> if (nodes.getLength() > 0) {
> portNumber = (Integer.parseInt(nodes.item(0).getNodeValue());
> }
> } // exception handling
>
> this never pulls any data out for me. However,
>
> NodeList nodes = doc.getElementsByTagName("*");
> and then printing each node's getNodeName() result gives me:
>
> JavaXML:xmlrpc-config
> JavaXML:hostname
> JavaXML:port
>
> What am I missing?
>
> Thanks,
> Brett
--
Christopher D. Gokey, Raytheon ITSS, NASA/GCMD
18 Martin Road, Shelburne Falls, MA 01370
Phone: Voice (413) 625-8129 / FAX 208-248-9055
[EMAIL PROTECTED] / http://gcmd.nasa.gov