protected XMLOutputFactory createOutputFactory() { return new WstxOutputFactory(); }
protected XMLInputFactory createInputFactory() { final XMLInputFactory instance = new WstxInputFactory(); instance.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE); return instance; }
/** * Stax parser for a given stream handler and iso control chars set awarness to on. * The iso control chars in the xml file will be replaced by simple spaces, usefull for * potentially bogus XML files to parse, this has a small perfs overhead so use it only when necessary * * @param streamHandler the xml stream handler * @param isoControlCharsAwareParser true or false */ public StaxParser(XmlStreamHandler streamHandler, boolean isoControlCharsAwareParser) { this.streamHandler = streamHandler; XMLInputFactory xmlFactory = XMLInputFactory.newInstance(); if (xmlFactory instanceof WstxInputFactory) { WstxInputFactory wstxInputfactory = (WstxInputFactory) xmlFactory; wstxInputfactory.configureForLowMemUsage(); wstxInputfactory.getConfig().setUndeclaredEntityResolver(new UndeclaredEntitiesXMLResolver()); } xmlFactory.setProperty(XMLInputFactory.IS_VALIDATING, false); xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false); xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, false); this.isoControlCharsAwareParser = isoControlCharsAwareParser; inf = new SMInputFactory(xmlFactory); }
private XMLStreamReader parse(InputStream is, String systemIdStr, boolean restricted) throws IOException, XMLStreamException { if (!quietmode) { LOG.debug("parsing input stream " + is); } if (is == null) { return null; } SystemId systemId = SystemId.construct(systemIdStr); ReaderConfig readerConfig = XML_INPUT_FACTORY.createPrivateConfig(); if (restricted) { readerConfig.setProperty(XMLInputFactory.SUPPORT_DTD, false); } return XML_INPUT_FACTORY.createSR(readerConfig, systemId, StreamBootstrapper.getInstance(null, systemId, is), false, true); }
public XMLStreamReader createXMLStreamReader(InputStream in, String enc) throws XMLStreamException { // false for auto-close, since caller has access to the input stream return createSR(null, in, enc, false, false); }
public XMLEventReader createXMLEventReader(Reader r) throws XMLStreamException { // false for auto-close, since caller has access to the input stream return new WstxEventReader(createEventAllocator(), createSR(null, r, true, false)); }
public XMLStreamWriter createXMLStreamWriter(OutputStream out) throws XMLStreamException { return createXMLStreamWriter(out, null); }
public XMLStreamWriter createXMLStreamWriter(javax.xml.transform.Result result) throws XMLStreamException { return createSW(result); }
public XMLEventWriter createXMLEventWriter(OutputStream out) throws XMLStreamException { return createXMLEventWriter(out, null); }
private XMLStreamReader2 createSR(ReaderConfig cfg, SystemId systemId, InputStream in, boolean forER, boolean autoCloseInput) throws XMLStreamException { return doCreateSR(cfg, systemId, StreamBootstrapper.getInstance(null, systemId, in), forER, autoCloseInput); }
public WstxSAXParser() { this(new WstxInputFactory(), FEAT_DEFAULT_NS_PREFIXES); }
public XMLStreamReader2 createXMLStreamReader(URL src) throws XMLStreamException { /* true for auto-close, since caller has no access to the underlying * input stream created from the URL */ return createSR(createPrivateConfig(), src, false, true); }
/** * Convenience factory method that allows for parsing a document * stored in the specified file. */ public XMLStreamReader2 createXMLStreamReader(File f) throws XMLStreamException { /* true for auto-close, since caller has no access to the underlying * input stream created from the File */ return createSR(f, false, true); }
public XMLOutputFactory2 createOutputFactory() { return new WstxOutputFactory(); }
public XMLStreamWriter2 createXMLStreamWriter(Writer w, String enc) throws XMLStreamException { return createSW(null, w, enc, false); }
public WstxSAXParserFactory() { this(new WstxInputFactory()); }
public XMLStreamReader createXMLStreamReader(Reader r) throws XMLStreamException { // false for auto-close, since caller has access to the reader return createSR(null, r, false, false); }
public XMLInputFactory2 createInputFactory() { return new WstxInputFactory(); }
public XMLStreamReader createXMLStreamReader(javax.xml.transform.Source src) throws XMLStreamException { // false -> not for event. No definition for auto-close; called method will decide return createSR(src, false); }
public XMLStreamReader createXMLStreamReader(String systemId, Reader r) throws XMLStreamException { // false for auto-close, since caller has access to the Reader return createSR(SystemId.construct(systemId), r, false, false); }