{
String data = ((Comment) node).getData();
if (m_contentHandler instanceof LexicalHandler)
{
LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);
lh.comment(data.toCharArray(), 0, data.length());
}
}
break;
case Node.DOCUMENT_FRAGMENT_NODE :
// ??;
break;
case Node.DOCUMENT_NODE :
break;
case Node.ELEMENT_NODE :
Element elem_node = (Element) node;
{
// Make sure the namespace node
// for the element itself is declared
// to the ContentHandler
String uri = elem_node.getNamespaceURI();
if (uri != null) {
String prefix = elem_node.getPrefix();
if (prefix==null)
prefix="";
this.m_contentHandler.startPrefixMapping(prefix,uri);
}
}
NamedNodeMap atts = elem_node.getAttributes();
int nAttrs = atts.getLength();
// System.out.println("TreeWalker#startNode: "+node.getNodeName());
// Make sure the namespace node of
// each attribute is declared to the ContentHandler
for (int i = 0; i < nAttrs; i++)
{
final Node attr = atts.item(i);
final String attrName = attr.getNodeName();
final int colon = attrName.indexOf(':');
final String prefix;
// System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue());
if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
{
// Use "" instead of null, as Xerces likes "" for the
// name of the default namespace. Fix attributed
// to "Steven Murray" <smurray@ebt.com>.
if (colon < 0)
prefix = "";
else
prefix = attrName.substring(colon + 1);
this.m_contentHandler.startPrefixMapping(prefix,
attr.getNodeValue());
}
else if (colon > 0) {
prefix = attrName.substring(0,colon);
String uri = attr.getNamespaceURI();
if (uri != null)
this.m_contentHandler.startPrefixMapping(prefix,uri);
}
}
String ns = m_dh.getNamespaceOfNode(node);
if(null == ns)
ns = "";
this.m_contentHandler.startElement(ns,
m_dh.getLocalNameOfNode(node),
node.getNodeName(),
new AttList(atts, m_dh));
break;
case Node.PROCESSING_INSTRUCTION_NODE :
{
ProcessingInstruction pi = (ProcessingInstruction) node;
String name = pi.getNodeName();
// String data = pi.getData();
if (name.equals("xslt-next-is-raw"))
{
nextIsRaw = true;
}
else
{
this.m_contentHandler.processingInstruction(pi.getNodeName(),
pi.getData());
}
}
break;
case Node.CDATA_SECTION_NODE :
{
boolean isLexH = (m_contentHandler instanceof LexicalHandler);
LexicalHandler lh = isLexH
? ((LexicalHandler) this.m_contentHandler) : null;
if (isLexH)
{
lh.startCDATA();
}
dispatachChars(node);
{
if (isLexH)
{
lh.endCDATA();
}
}
}
break;
case Node.TEXT_NODE :