
February 10th, 2002, 10:10 AM
|
|
Junior Member
|
|
Join Date: Oct 2001
Location: Upstate New York
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
DOM Parsing
I am using Java Server Pages to call a Java Bean that parses an XML document(mapDoc) , looks for an element tag(data) and replaces text in the first tag(SQL) with a new value(an SQL string). Here is a code snippet...
DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docbuilder = dbfactory.newDocumentBuilder();
mapDoc = docbuilder.parse(mapFileName);
...
}
Element root = mapDoc.getDocumentElement();
Node dataNode0 = root.getElementsByTagName("data").item(0);
Element dataElement0 = (Element)dataNode0;
dataElement0.setAttribute("sql",sql);
return mapDoc;
}
...
When I run the code in JBuilder5 which uses Tomcat 3.2, it works fine and the XML document is updated with the new text. However - when I run it outside of JBuilder in Tomcat 4.01, it gives me a null result when I print out the string output of the document mapDoc. Any ideas?
|