{
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 :
NamedNodeMap atts = ((Element) node).getAttributes();
int nAttrs = atts.getLength();
// System.out.println("TreeWalker#startNode: "+node.getNodeName());
for (int i = 0; i < nAttrs; i++)
{
Node attr = atts.item(i);
String attrName = attr.getNodeName();
// System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue());
if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
{
// System.out.println("TreeWalker#startNode: attr["+i+"] = "+attrName+", "+attr.getNodeValue());
int index;
// Use "" instead of null, as Xerces likes "" for the
// name of the default namespace. Fix attributed
// to "Steven Murray" <smurray@ebt.com>.
String prefix = (index = attrName.indexOf(":")) < 0
? "" : attrName.substring(index + 1);
this.m_contentHandler.startPrefixMapping(prefix,
attr.getNodeValue());
}
}
// System.out.println("m_dh.getNamespaceOfNode(node): "+m_dh.getNamespaceOfNode(node));
// System.out.println("m_dh.getLocalNameOfNode(node): "+m_dh.getLocalNameOfNode(node));
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 :