本文整理匯總了Java中org.xml.sax.ext.LexicalHandler.endEntity方法的典型用法代碼示例。如果您正苦於以下問題:Java LexicalHandler.endEntity方法的具體用法?Java LexicalHandler.endEntity怎麽用?Java LexicalHandler.endEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.xml.sax.ext.LexicalHandler
的用法示例。
在下文中一共展示了LexicalHandler.endEntity方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: endNode
import org.xml.sax.ext.LexicalHandler; //導入方法依賴的package包/類
/**
* End processing of given node
*
*
* @param node Node we just finished processing
*
* @throws org.xml.sax.SAXException
*/
protected void endNode(Node node) throws org.xml.sax.SAXException
{
switch (node.getNodeType())
{
case Node.DOCUMENT_NODE :
break;
case Node.ELEMENT_NODE :
String ns = m_dh.getNamespaceOfNode(node);
if(null == ns)
ns = "";
this.m_contentHandler.endElement(ns,
m_dh.getLocalNameOfNode(node),
node.getNodeName());
NamedNodeMap atts = ((Element) node).getAttributes();
int nAttrs = atts.getLength();
for (int i = 0; i < nAttrs; i++)
{
Node attr = atts.item(i);
String attrName = attr.getNodeName();
if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
{
int index;
// Use "" instead of null, as Xerces likes "" for the
// name of the default namespace. Fix attributed
// to "Steven Murray" <[email protected]>.
String prefix = (index = attrName.indexOf(":")) < 0
? "" : attrName.substring(index + 1);
this.m_contentHandler.endPrefixMapping(prefix);
}
}
break;
case Node.CDATA_SECTION_NODE :
break;
case Node.ENTITY_REFERENCE_NODE :
{
EntityReference eref = (EntityReference) node;
if (m_contentHandler instanceof LexicalHandler)
{
LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);
lh.endEntity(eref.getNodeName());
}
}
break;
default :
}
}
示例2: endNode
import org.xml.sax.ext.LexicalHandler; //導入方法依賴的package包/類
/**
* End processing of given node
*
*
* @param node Node we just finished processing
*
* @throws org.xml.sax.SAXException
*/
protected void endNode(int node) throws org.xml.sax.SAXException
{
switch (m_dtm.getNodeType(node))
{
case DTM.DOCUMENT_NODE :
this.m_contentHandler.endDocument();
break;
case DTM.ELEMENT_NODE :
String ns = m_dtm.getNamespaceURI(node);
if(null == ns)
ns = "";
this.m_contentHandler.endElement(ns,
m_dtm.getLocalName(node),
m_dtm.getNodeName(node));
for (int nsn = m_dtm.getFirstNamespaceNode(node, true); DTM.NULL != nsn;
nsn = m_dtm.getNextNamespaceNode(node, nsn, true))
{
// String prefix = m_dtm.getPrefix(nsn);
String prefix = m_dtm.getNodeNameX(nsn);
this.m_contentHandler.endPrefixMapping(prefix);
}
break;
case DTM.CDATA_SECTION_NODE :
break;
case DTM.ENTITY_REFERENCE_NODE :
{
if (m_contentHandler instanceof LexicalHandler)
{
LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);
lh.endEntity(m_dtm.getNodeName(node));
}
}
break;
default :
}
}
示例3: endNode
import org.xml.sax.ext.LexicalHandler; //導入方法依賴的package包/類
/**
* End processing of given node
*
*
* @param node Node we just finished processing
*
* @throws org.xml.sax.SAXException
*/
protected void endNode(Node node) throws org.xml.sax.SAXException
{
switch (node.getNodeType())
{
case Node.DOCUMENT_NODE :
break;
case Node.ELEMENT_NODE :
String ns = DOM2Helper.getNamespaceOfNode(node);
if(null == ns)
ns = "";
this.m_contentHandler.endElement(ns,
DOM2Helper.getLocalNameOfNode(node),
node.getNodeName());
NamedNodeMap atts = ((Element) node).getAttributes();
int nAttrs = atts.getLength();
for (int i = 0; i < nAttrs; i++)
{
Node attr = atts.item(i);
String attrName = attr.getNodeName();
if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
{
int index;
// Use "" instead of null, as Xerces likes "" for the
// name of the default namespace. Fix attributed
// to "Steven Murray" <[email protected]>.
String prefix = (index = attrName.indexOf(":")) < 0
? "" : attrName.substring(index + 1);
this.m_contentHandler.endPrefixMapping(prefix);
}
}
break;
case Node.CDATA_SECTION_NODE :
break;
case Node.ENTITY_REFERENCE_NODE :
{
EntityReference eref = (EntityReference) node;
if (m_contentHandler instanceof LexicalHandler)
{
LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);
lh.endEntity(eref.getNodeName());
}
}
break;
default :
}
}