本文整理汇总了Java中org.xml.sax.ContentHandler.endPrefixMapping方法的典型用法代码示例。如果您正苦于以下问题:Java ContentHandler.endPrefixMapping方法的具体用法?Java ContentHandler.endPrefixMapping怎么用?Java ContentHandler.endPrefixMapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xml.sax.ContentHandler
的用法示例。
在下文中一共展示了ContentHandler.endPrefixMapping方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endPrefixMapping
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
private void endPrefixMapping(ContentHandler contentHandler, NamedNodeMap attrs, String excludePrefix) throws SAXException {
if(attrs == null)
return;
for(int i=0; i < attrs.getLength();i++) {
Attr a = (Attr)attrs.item(i);
//check if attr is ns declaration
if("xmlns".equals(a.getPrefix()) || "xmlns".equals(a.getLocalName())) {
if(!fixNull(a.getPrefix()).equals(excludePrefix)) {
contentHandler.endPrefixMapping(fixNull(a.getPrefix()));
}
}
}
}
示例2: writeEnd
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
/**
* Writes the end element event.
*/
public void writeEnd(ContentHandler contentHandler) throws SAXException{
contentHandler.endElement(fixNull(nsUri),localName,getQName());
for( int i=ns.length-2; i>=0; i-=2 ) {
contentHandler.endPrefixMapping(fixNull(ns[i]));
}
}
示例3: popNamespaces
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
/**
* Pop, or undeclare all namespace definitions that are currently
* declared at the given element depth, or deepter.
* @param elemDepth the element depth for which mappings declared at this
* depth or deeper will no longer be valid
* @param saxHandler The ContentHandler to notify of any endPrefixMapping()
* calls. This parameter can be null.
*/
void popNamespaces(int elemDepth, ContentHandler saxHandler)
{
while (true)
{
if (m_nodeStack.isEmpty())
return;
MappingRecord map = (MappingRecord)(m_nodeStack.peek());
int depth = map.m_declarationDepth;
if (depth < elemDepth)
return;
/* the depth of the declared mapping is elemDepth or deeper
* so get rid of it
*/
map = (MappingRecord) m_nodeStack.pop();
final String prefix = map.m_prefix;
popNamespace(prefix);
if (saxHandler != null)
{
try
{
saxHandler.endPrefixMapping(prefix);
}
catch (SAXException e)
{
// not much we can do if they aren't willing to listen
}
}
}
}
示例4: generate
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
@Override
public void generate(CacheXmlGenerator cacheXmlGenerator) throws SAXException {
final ContentHandler handler = cacheXmlGenerator.getContentHandler();
try {
handler.startPrefixMapping(PREFIX, NAMESPACE);
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, ATTRIBUTE_VALUE, extension.getValue());
emptyElement(handler, PREFIX, ELEMENT_CACHE, atts);
} finally {
handler.endPrefixMapping("mock");
}
}
示例5: generate
import org.xml.sax.ContentHandler; //导入方法依赖的package包/类
@Override
public void generate(CacheXmlGenerator cacheXmlGenerator) throws SAXException {
final ContentHandler handler = cacheXmlGenerator.getContentHandler();
try {
handler.startPrefixMapping(PREFIX, NAMESPACE);
final AttributesImpl atts = new AttributesImpl();
addAttribute(atts, ATTRIBUTE_VALUE, extension.getValue());
emptyElement(handler, PREFIX, ELEMENT_REGION, atts);
} finally {
handler.endPrefixMapping(PREFIX);
}
}