-
1. Re: Getting <env-entry> values from web.xml with dom
jfclere May 11, 2010 2:28 AM (in response to mschwery)Guessing.... in Servlet? - You need a JNDI lookup for the entry-name you created -
-
2. Re: Getting <env-entry> values from web.xml with dom
mschwery May 11, 2010 10:12 AM (in response to jfclere)I'm trying to read the env-entry values in the web.xml with a jython script.
So far I've got the following working .
from org.w3c.dom import *
from javax.xml.parsers import *
def jndiSearch(file):
factory = DocumentBuilderFactory.newInstances()
builder = factory.newDocumentBuilder()
doc = builder.parse(file)
serverResults = doc.getElementsByTagName('env-entry')
for iw in range(serverResults.getLength()):
print "found"
serverResults1 = serverResults.item(iw).getChildNodes()
for iy in range(serverResults1.getLength()):
elem = serverResults1.item(iy)
test = elem.getNodeValue()
print test
It is reading the file segment
<env-entry>
<env-entry-name>a</env-entry-name>
<env-entry-type>string</env-entry-type>
<env-entry-value>1</env-entry-value>
</env-entry>
My output is
found
None
It shoulde be
found
a
string
1
I'm stuck as to how to get the text for the children of <env-entry>.