ResultImpl() {
try {
DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI
s2d = new SAX2DOMEx(factory);
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible
}
XMLFilterImpl f = new XMLFilterImpl() {
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
location = new LocatorImpl(locator);
}
};
f.setContentHandler(s2d);
setHandler(f);
}
java类org.xml.sax.helpers.XMLFilterImpl的实例源码
DomHandlerEx.java 文件源码
项目:OpenJSharp
阅读 39
收藏 0
点赞 0
评论 0
DOMForest.java 文件源码
项目:OpenJSharp
阅读 29
收藏 0
点赞 0
评论 0
/**
* Returns a {@link ContentHandler} to feed SAX events into.
*
* <p>
* The client of this class can feed SAX events into the handler
* to parse a document into this DOM forest.
*
* This version requires that the DOM object to be created and registered
* to the map beforehand.
*/
private ContentHandler getParserHandler( Document dom ) {
ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings);
handler = new WhitespaceStripper(handler,errorReceiver,entityResolver);
handler = new VersionChecker(handler,errorReceiver,entityResolver);
// insert the reference finder so that
// included/imported schemas will be also parsed
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
f.setContentHandler(handler);
if(errorReceiver!=null)
f.setErrorHandler(errorReceiver);
if(entityResolver!=null)
f.setEntityResolver(entityResolver);
return f;
}
JAXBSource.java 文件源码
项目:OpenJSharp
阅读 38
收藏 0
点赞 0
评论 0
public void parse() throws SAXException {
// parses a content object by using the given marshaller
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
marshaller.marshal( contentObject, (XMLFilterImpl)repeater );
} catch( JAXBException e ) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException( e.getMessage(),
null, null, -1, -1, e );
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if(errorHandler!=null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
DomHandlerEx.java 文件源码
项目:openjdk-jdk10
阅读 32
收藏 0
点赞 0
评论 0
ResultImpl() {
try {
DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI
s2d = new SAX2DOMEx(factory);
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible
}
XMLFilterImpl f = new XMLFilterImpl() {
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
location = new LocatorImpl(locator);
}
};
f.setContentHandler(s2d);
setHandler(f);
}
DOMForest.java 文件源码
项目:openjdk-jdk10
阅读 42
收藏 0
点赞 0
评论 0
/**
* Returns a {@link ContentHandler} to feed SAX events into.
*
* <p>
* The client of this class can feed SAX events into the handler
* to parse a document into this DOM forest.
*
* This version requires that the DOM object to be created and registered
* to the map beforehand.
*/
private ContentHandler getParserHandler( Document dom ) {
ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings);
handler = new WhitespaceStripper(handler,errorReceiver,entityResolver);
handler = new VersionChecker(handler,errorReceiver,entityResolver);
// insert the reference finder so that
// included/imported schemas will be also parsed
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
f.setContentHandler(handler);
if(errorReceiver!=null)
f.setErrorHandler(errorReceiver);
if(entityResolver!=null)
f.setEntityResolver(entityResolver);
return f;
}
JAXBSource.java 文件源码
项目:openjdk-jdk10
阅读 29
收藏 0
点赞 0
评论 0
public void parse() throws SAXException {
// parses a content object by using the given marshaller
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
marshaller.marshal( contentObject, (XMLFilterImpl)repeater );
} catch( JAXBException e ) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException( e.getMessage(),
null, null, -1, -1, e );
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if(errorHandler!=null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
XMLFilterTest.java 文件源码
项目:openjdk-jdk10
阅读 41
收藏 0
点赞 0
评论 0
/**
* Set namespaces feature to a value to XMLFilter. it's expected same when
* obtain it again.
*
* @throws Exception If any errors occur.
*/
@Test
public void setFeature01() throws Exception {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
XMLFilterImpl xmlFilter = new XMLFilterImpl();
xmlFilter.setParent(spf.newSAXParser().getXMLReader());
xmlFilter.setFeature(NAMESPACES, false);
assertFalse(xmlFilter.getFeature(NAMESPACES));
xmlFilter.setFeature(NAMESPACES, true);
assertTrue(xmlFilter.getFeature(NAMESPACES));
}
DomHandlerEx.java 文件源码
项目:openjdk9
阅读 52
收藏 0
点赞 0
评论 0
ResultImpl() {
try {
DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI
s2d = new SAX2DOMEx(factory);
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible
}
XMLFilterImpl f = new XMLFilterImpl() {
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
location = new LocatorImpl(locator);
}
};
f.setContentHandler(s2d);
setHandler(f);
}
DOMForest.java 文件源码
项目:openjdk9
阅读 38
收藏 0
点赞 0
评论 0
/**
* Returns a {@link ContentHandler} to feed SAX events into.
*
* <p>
* The client of this class can feed SAX events into the handler
* to parse a document into this DOM forest.
*
* This version requires that the DOM object to be created and registered
* to the map beforehand.
*/
private ContentHandler getParserHandler( Document dom ) {
ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings);
handler = new WhitespaceStripper(handler,errorReceiver,entityResolver);
handler = new VersionChecker(handler,errorReceiver,entityResolver);
// insert the reference finder so that
// included/imported schemas will be also parsed
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
f.setContentHandler(handler);
if(errorReceiver!=null)
f.setErrorHandler(errorReceiver);
if(entityResolver!=null)
f.setEntityResolver(entityResolver);
return f;
}
JAXBSource.java 文件源码
项目:openjdk9
阅读 33
收藏 0
点赞 0
评论 0
public void parse() throws SAXException {
// parses a content object by using the given marshaller
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
marshaller.marshal( contentObject, (XMLFilterImpl)repeater );
} catch( JAXBException e ) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException( e.getMessage(),
null, null, -1, -1, e );
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if(errorHandler!=null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
JAXBSource.java 文件源码
项目:Java8CN
阅读 28
收藏 0
点赞 0
评论 0
public void parse() throws SAXException {
// parses a content object by using the given marshaller
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
marshaller.marshal( contentObject, (XMLFilterImpl)repeater );
} catch( JAXBException e ) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException( e.getMessage(),
null, null, -1, -1, e );
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if(errorHandler!=null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
DomHandlerEx.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 32
收藏 0
点赞 0
评论 0
ResultImpl() {
try {
DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI
s2d = new SAX2DOMEx(factory);
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible
}
XMLFilterImpl f = new XMLFilterImpl() {
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
location = new LocatorImpl(locator);
}
};
f.setContentHandler(s2d);
setHandler(f);
}
DOMForest.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 27
收藏 0
点赞 0
评论 0
/**
* Returns a {@link ContentHandler} to feed SAX events into.
*
* <p>
* The client of this class can feed SAX events into the handler
* to parse a document into this DOM forest.
*
* This version requires that the DOM object to be created and registered
* to the map beforehand.
*/
private ContentHandler getParserHandler( Document dom ) {
ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings);
handler = new WhitespaceStripper(handler,errorReceiver,entityResolver);
handler = new VersionChecker(handler,errorReceiver,entityResolver);
// insert the reference finder so that
// included/imported schemas will be also parsed
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
f.setContentHandler(handler);
if(errorReceiver!=null)
f.setErrorHandler(errorReceiver);
if(entityResolver!=null)
f.setEntityResolver(entityResolver);
return f;
}
JAXBSource.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 41
收藏 0
点赞 0
评论 0
public void parse() throws SAXException {
// parses a content object by using the given marshaller
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
marshaller.marshal( contentObject, (XMLFilterImpl)repeater );
} catch( JAXBException e ) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException( e.getMessage(),
null, null, -1, -1, e );
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if(errorHandler!=null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
DomHandlerEx.java 文件源码
项目:infobip-open-jdk-8
阅读 30
收藏 0
点赞 0
评论 0
ResultImpl() {
try {
DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI
s2d = new SAX2DOMEx(factory);
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible
}
XMLFilterImpl f = new XMLFilterImpl() {
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
location = new LocatorImpl(locator);
}
};
f.setContentHandler(s2d);
setHandler(f);
}
DOMForest.java 文件源码
项目:infobip-open-jdk-8
阅读 36
收藏 0
点赞 0
评论 0
/**
* Returns a {@link ContentHandler} to feed SAX events into.
*
* <p>
* The client of this class can feed SAX events into the handler
* to parse a document into this DOM forest.
*
* This version requires that the DOM object to be created and registered
* to the map beforehand.
*/
private ContentHandler getParserHandler( Document dom ) {
ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings);
handler = new WhitespaceStripper(handler,errorReceiver,entityResolver);
handler = new VersionChecker(handler,errorReceiver,entityResolver);
// insert the reference finder so that
// included/imported schemas will be also parsed
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
f.setContentHandler(handler);
if(errorReceiver!=null)
f.setErrorHandler(errorReceiver);
if(entityResolver!=null)
f.setEntityResolver(entityResolver);
return f;
}
JAXBSource.java 文件源码
项目:infobip-open-jdk-8
阅读 46
收藏 0
点赞 0
评论 0
public void parse() throws SAXException {
// parses a content object by using the given marshaller
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
marshaller.marshal( contentObject, (XMLFilterImpl)repeater );
} catch( JAXBException e ) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException( e.getMessage(),
null, null, -1, -1, e );
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if(errorHandler!=null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
DomHandlerEx.java 文件源码
项目:OLD-OpenJDK8
阅读 41
收藏 0
点赞 0
评论 0
ResultImpl() {
try {
DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI
s2d = new SAX2DOMEx(factory);
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible
}
XMLFilterImpl f = new XMLFilterImpl() {
@Override
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
location = new LocatorImpl(locator);
}
};
f.setContentHandler(s2d);
setHandler(f);
}
DOMForest.java 文件源码
项目:OLD-OpenJDK8
阅读 34
收藏 0
点赞 0
评论 0
/**
* Returns a {@link ContentHandler} to feed SAX events into.
*
* <p>
* The client of this class can feed SAX events into the handler
* to parse a document into this DOM forest.
*
* This version requires that the DOM object to be created and registered
* to the map beforehand.
*/
private ContentHandler getParserHandler( Document dom ) {
ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings);
handler = new WhitespaceStripper(handler,errorReceiver,entityResolver);
handler = new VersionChecker(handler,errorReceiver,entityResolver);
// insert the reference finder so that
// included/imported schemas will be also parsed
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
f.setContentHandler(handler);
if(errorReceiver!=null)
f.setErrorHandler(errorReceiver);
if(entityResolver!=null)
f.setEntityResolver(entityResolver);
return f;
}
JAXBSource.java 文件源码
项目:OLD-OpenJDK8
阅读 30
收藏 0
点赞 0
评论 0
public void parse() throws SAXException {
// parses a content object by using the given marshaller
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
marshaller.marshal( contentObject, (XMLFilterImpl)repeater );
} catch( JAXBException e ) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException( e.getMessage(),
null, null, -1, -1, e );
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if(errorHandler!=null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
XmlCopyUtils.java 文件源码
项目:yarg
阅读 22
收藏 0
点赞 0
评论 0
public void parse() throws SAXException {
// parses a content object by using the given marshaller
// SAX events will be sent to the repeater, and the repeater
// will further forward it to an appropriate component.
try {
marshaller.marshal(contentObject, (XMLFilterImpl) repeater);
} catch (JAXBException e) {
// wrap it to a SAXException
SAXParseException se =
new SAXParseException(e.getMessage(),
null, null, -1, -1, e);
// if the consumer sets an error handler, it is our responsibility
// to notify it.
if (errorHandler != null)
errorHandler.fatalError(se);
// this is a fatal error. Even if the error handler
// returns, we will abort anyway.
throw se;
}
}
DomHandlerEx.java 文件源码
项目:openjdk-icedtea7
阅读 46
收藏 0
点赞 0
评论 0
ResultImpl() {
try {
s2d = new SAX2DOMEx();
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible
}
XMLFilterImpl f = new XMLFilterImpl() {
public void setDocumentLocator(Locator locator) {
super.setDocumentLocator(locator);
location = new LocatorImpl(locator);
}
};
f.setContentHandler(s2d);
setHandler(f);
}
DOMForest.java 文件源码
项目:openjdk-icedtea7
阅读 32
收藏 0
点赞 0
评论 0
/**
* Returns a {@link ContentHandler} to feed SAX events into.
*
* <p>
* The client of this class can feed SAX events into the handler
* to parse a document into this DOM forest.
*
* This version requires that the DOM object to be created and registered
* to the map beforehand.
*/
private ContentHandler getParserHandler( Document dom ) {
ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings);
handler = new WhitespaceStripper(handler,errorReceiver,entityResolver);
handler = new VersionChecker(handler,errorReceiver,entityResolver);
// insert the reference finder so that
// included/imported schemas will be also parsed
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
f.setContentHandler(handler);
if(errorReceiver!=null)
f.setErrorHandler(errorReceiver);
if(entityResolver!=null)
f.setEntityResolver(entityResolver);
return f;
}
AbstractXmlValidator.java 文件源码
项目:iaf
阅读 29
收藏 0
点赞 0
评论 0
public String validate(Object input, IPipeLineSession session, String logPrefix, XMLReader parser, XMLFilterImpl filter, ValidationContext context) throws XmlValidatorException, PipeRunException, ConfigurationException {
if (filter!=null) {
filter.setContentHandler(context.getContentHandler());
filter.setErrorHandler(context.getErrorHandler());
} else {
parser.setContentHandler(context.getContentHandler());
parser.setErrorHandler(context.getErrorHandler());
}
InputSource is = getInputSource(input);
try {
parser.parse(is);
} catch (Exception e) {
return finalizeValidation(context, session, e);
}
return finalizeValidation(context, session, null);
}
DOMForest.java 文件源码
项目:OpenJSharp
阅读 48
收藏 0
点赞 0
评论 0
/**
* Returns a {@link org.xml.sax.XMLReader} to parse a document into this DOM forest.
* <p/>
* This version requires that the DOM object to be created and registered
* to the map beforehand.
*/
private XMLReader createReader(Document dom) throws SAXException, ParserConfigurationException {
XMLReader reader = parserFactory.newSAXParser().getXMLReader();
DOMBuilder dombuilder = new DOMBuilder(dom, locatorTable, outerMostBindings);
try {
reader.setProperty("http://xml.org/sax/properties/lexical-handler", dombuilder);
} catch(SAXException e) {
errorReceiver.debug(e.getMessage());
}
ContentHandler handler = new WhitespaceStripper(dombuilder, errorReceiver, entityResolver);
handler = new VersionChecker(handler, errorReceiver, entityResolver);
// insert the reference finder so that
// included/imported schemas will be also parsed
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
f.setContentHandler(handler);
if (errorReceiver != null)
f.setErrorHandler(errorReceiver);
f.setEntityResolver(entityResolver);
reader.setContentHandler(f);
if (errorReceiver != null)
reader.setErrorHandler(errorReceiver);
reader.setEntityResolver(entityResolver);
return reader;
}
ModelLoader.java 文件源码
项目:OpenJSharp
阅读 33
收藏 0
点赞 0
评论 0
/**
* Parses a RELAX NG grammar into an annotated grammar.
*/
private Model loadRELAXNG() throws SAXException {
// build DOM forest
final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() );
// use JAXP masquerading to validate the input document.
// DOMForest -> ExtensionBindingChecker -> RNGOM
XMLReaderCreator xrc = new XMLReaderCreator() {
public XMLReader createXMLReader() {
// foreset parser cannot change the receivers while it's working,
// so we need to have one XMLFilter that works as a buffer
XMLFilter buffer = new XMLFilterImpl() {
@Override
public void parse(InputSource source) throws IOException, SAXException {
forest.createParser().parse( source, this, this, this );
}
};
XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver);
f.setParent(buffer);
f.setEntityResolver(opt.entityResolver);
return f;
}
};
Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc );
return loadRELAXNG(p);
}
DOMForest.java 文件源码
项目:openjdk-jdk10
阅读 34
收藏 0
点赞 0
评论 0
/**
* Returns a {@link org.xml.sax.XMLReader} to parse a document into this DOM forest.
* <p/>
* This version requires that the DOM object to be created and registered
* to the map beforehand.
*/
private XMLReader createReader(Document dom) throws SAXException, ParserConfigurationException {
XMLReader reader = parserFactory.newSAXParser().getXMLReader();
DOMBuilder dombuilder = new DOMBuilder(dom, locatorTable, outerMostBindings);
try {
reader.setProperty("http://xml.org/sax/properties/lexical-handler", dombuilder);
} catch(SAXException e) {
errorReceiver.debug(e.getMessage());
}
ContentHandler handler = new WhitespaceStripper(dombuilder, errorReceiver, entityResolver);
handler = new VersionChecker(handler, errorReceiver, entityResolver);
// insert the reference finder so that
// included/imported schemas will be also parsed
XMLFilterImpl f = logic.createExternalReferenceFinder(this);
f.setContentHandler(handler);
if (errorReceiver != null)
f.setErrorHandler(errorReceiver);
f.setEntityResolver(entityResolver);
reader.setContentHandler(f);
if (errorReceiver != null)
reader.setErrorHandler(errorReceiver);
reader.setEntityResolver(entityResolver);
return reader;
}
XMLFilterTest.java 文件源码
项目:openjdk-jdk10
阅读 37
收藏 0
点赞 0
评论 0
/**
* No exception expected when set a correct content handler.
*/
@Test
public void contentHandler01() {
XMLFilterImpl xmlFilter = new XMLFilterImpl();
xmlFilter.setContentHandler(xmlFilter);
assertNotNull(xmlFilter.getContentHandler());
}
XMLFilterTest.java 文件源码
项目:openjdk-jdk10
阅读 44
收藏 0
点赞 0
评论 0
/**
* No exception expected when set a correct entity solver.
*/
@Test
public void entity01() {
XMLFilterImpl xmlFilter = new XMLFilterImpl();
xmlFilter.setEntityResolver(xmlFilter);
assertNotNull(xmlFilter.getEntityResolver());
}
XMLFilterTest.java 文件源码
项目:openjdk-jdk10
阅读 32
收藏 0
点赞 0
评论 0
/**
* No exception expected when set a correct DTD handler.
*/
@Test
public void dtdHandler01() {
XMLFilterImpl xmlFilter = new XMLFilterImpl();
xmlFilter.setDTDHandler(xmlFilter);
assertNotNull(xmlFilter.getDTDHandler());
}