本文整理了Java中javax.xml.parsers.SAXParser.reset()
方法的一些代码示例,展示了SAXParser.reset()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SAXParser.reset()
方法的具体详情如下:
包路径:javax.xml.parsers.SAXParser
类名称:SAXParser
方法名:reset
[英]Reset this SAXParser
to its original configuration.
SAXParser
is reset to the same state as when it was created with SAXParserFactory#newSAXParser(). reset()
is designed to allow the reuse of existing SAXParser
s thus saving resources associated with the creation of new SAXParser
s.
The reset SAXParser
is not guaranteed to have the same SchemaObject
, e.g. Object#equals(Object obj). It is guaranteed to have a functionally equal Schema
.
[中]将此SAXParser
重置为其原始配置。SAXParser
重置为与使用SAXParserFactory#newSAXParser()创建时相同的状态。reset()
旨在允许重用现有SAXParser
s,从而节省与创建新SAXParser
s相关的资源。
重置SAXParser
不保证具有相同的模式Object
,例如Object#equals(Object obj)。它保证有一个功能上相等的Schema
。
代码示例来源:origin: jersey/jersey
@Override
public void reset() {
sp.reset();
}
代码示例来源:origin: pentaho/pentaho-kettle
public void endElement( String uri, String localName, String qName ) throws SAXException {
if ( add ) {
XMLHandler.closeTag( xml, qName );
}
if ( STRING_TRANSFORMATION.equals( qName ) ) {
if ( !repositoryElementReadListener.transformationElementRead( xml.toString(), feedback ) ) {
saxParser.reset();
}
} else if ( STRING_JOB.equals( qName ) ) {
if ( !repositoryElementReadListener.jobElementRead( xml.toString(), feedback ) ) {
saxParser.reset();
}
}
}
代码示例来源:origin: apache/tika
@Override
void reset() {
saxParser.reset();
try {
XMLReader reader = saxParser.getXMLReader();
clearReader(reader);
} catch (SAXException e) {
}
}
}
代码示例来源:origin: apache/tika
@Override
void reset() {
try {
saxParser.reset();
} catch (UnsupportedOperationException e) {
}
try {
XMLReader reader = saxParser.getXMLReader();
clearReader(reader);
} catch (SAXException e) {
}
trySetXercesSecurityManager(saxParser);
}
}
代码示例来源:origin: apache/tika
/**
* Return parser to the pool for reuse
*
* @param parser parser to return
*/
private static void releaseParser(SAXParser parser) {
try {
parser.reset();
} catch (UnsupportedOperationException e) {
//ignore
}
try {
READ_WRITE_LOCK.readLock().lock();
//if there are extra parsers (e.g. after a reset of the pool to a smaller size),
// this parser will not be added and will then be gc'd
SAX_PARSERS.offer(parser);
} finally {
READ_WRITE_LOCK.readLock().unlock();
}
}
代码示例来源:origin: apache/tika
@Override
void reset() {
try {
Object object = saxParser.getProperty(XERCES_SECURITY_MANAGER_PROPERTY);
saxParser.reset();
saxParser.setProperty(XERCES_SECURITY_MANAGER_PROPERTY, object);
} catch (SAXException e) {
LOG.log(Level.WARNING, "problem resetting sax parser", e);
}
try {
XMLReader reader = saxParser.getXMLReader();
clearReader(reader);
} catch (SAXException e) {
}
}
}
代码示例来源:origin: apache/tika
private static PoolSAXParser buildPoolParser(int generation, SAXParser parser) {
boolean canReset = false;
try {
parser.reset();
canReset = true;
} catch (UnsupportedOperationException e) {
代码示例来源:origin: com.sun.jersey/jersey-bundle
@Override
public void reset() {
sp.reset();
}
代码示例来源:origin: org.glassfish.jersey.media/jersey-media-jaxb
@Override
public void reset() {
sp.reset();
}
代码示例来源:origin: com.atlassian.security/atlassian-secure-xml
@Override
public void reset()
{
delegate.reset();
}
代码示例来源:origin: org.apache.tika/tika-core
@Override
void reset() {
saxParser.reset();
}
}
代码示例来源:origin: org.apache.tika/tika-core
@Override
void reset() {
try {
saxParser.reset();
} catch (UnsupportedOperationException e) {
}
trySetXercesSecurityManager(saxParser);
}
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
@Override
public void reset() {
sp.reset();
}
代码示例来源:origin: com.tcdng.unify/unify-core
@Override
protected void onGetObject(SAXParser saxParser, Object... params) throws Exception {
saxParser.reset();
}
代码示例来源:origin: fcrepo3/fcrepo
@Override
public void activateObject(SAXParser object) throws Exception {
object.reset();
}
代码示例来源:origin: jersey/jersey-1.x
@Override
public void reset() {
sp.reset();
}
代码示例来源:origin: org.fcrepo/fcrepo-common
@Override
public void activateObject(SAXParser object) throws Exception {
object.reset();
}
代码示例来源:origin: com.microsoft.azure/azure-storage
/**
* Returns a namespace aware <code>SAXParser</code>.
*
* @return A <code>SAXParser</code> instance which is namespace aware
*
* @throws ParserConfigurationException
* @throws SAXException
*/
public static SAXParser getSAXParser() throws ParserConfigurationException, SAXException {
SAXParser parser = saxParserThreadLocal.get();
parser.reset(); //reset to original config
return parser;
}
代码示例来源:origin: apache/servicemix-bundles
public void returnParser(SAXParser saxParser) {
saxParser.reset();
put(saxParser);
}
代码示例来源:origin: org.apache.tika/tika-core
@Override
void reset() {
try {
Object object = saxParser.getProperty(XERCES_SECURITY_MANAGER);
saxParser.reset();
saxParser.setProperty(XERCES_SECURITY_MANAGER, object);
} catch (SAXException e) {
}
}
}
内容来源于网络,如有侵权,请联系作者删除!