XML Server Getting Started
}
sw.write("?>");
break;
}
}
if ( type == Node.ELEMENT_NODE ) {
sw.write("");
sw.write(node.getNodeName());
sw.write( > );
}
sw.flush();
} // print(Node)
public static void getNodeText(Node node, StringWriter sw) {
// is there anything to do?
if ( node == null ) {
return;
}
int type = node.getNodeType();
switch ( type ) {
// print document
case Node.DOCUMENT_NODE: {
getNodeText( ((Document)node).getDocumentElement(), sw);
sw.flush();
break;
}
// print element with attributes
case Node.ELEMENT_NODE: {
NodeList children = node.getChildNodes();
if ( children != null ) {
int len = children.getLength();
for ( int i = 0; i < len; i++ ) {
getNodeText(children.item(i), sw);
}
}
break;
}
// print cdata sections
case Node.CDATA_SECTION_NODE: {
sw.write(node.getNodeValue());
break;
}
2000 2002 Computer Technology Inc. All rights reserved.
Page 63
J2EE Web Hosting Tundra XML Server Pages J2EE Hosting
|
|
|
|
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved. |