XML Server Getting Started
NodeList nodeList = _doc.getElementsByTagName("Detail");
if (nodeList.getLength() > 0) {
Node detailNode = nodeList.item(0);
org.w3c.dom.Node parm;
org.w3c.dom.Node parmText;
NodeList pnl = _doc.getElementsByTagName(name); // Well, I know there s only one of each
if (pnl.getLength()==0) {
// New parameter
parm = _doc.createElement(name);
parmText = _doc.createText Node(value);
parm.appendChild(parmText);
detailNode.appendChild(parm);
} else {
// Parameter exists
parm = pnl.item(0);
if (parm.getChildNodes().getLength()==0) {
parmText = _doc.createTextNode(value);
parm.appendChild(parmText);
}
parmText = parm.getChildNodes().item(0);
parmText.setNodeValue(value);
}
}
}
private static String getParameter(Document doc, String name)
{
String value = "";
NodeList nodeList = doc.getElementsByTagName(name);
if (nodeList.getLength() > 0) {
if (nodeList.item(0).getChildNodes().getLength() <= 0)
return "";
else
value = nodeList.item(0).getChildNodes().item(0).getNodeValue();
}
return value;
}
private static String getParameter(HttpServletRequest req, String psName)
{
String value = req.getParameter(psName);
if (value == null)
value = "";
if (value.equals("undefined") || value.equals("empty"))
value = "";
return value;
}
2000 2002 Computer Technology Inc. All rights reserved.
Page 60
J2EE Web Hosting Tundra XML Server Pages J2EE Hosting
|
|
|
|
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved. |