/** * Factory method for constructing readers. * * @param owner "Owner" of this reader, factory that created the reader; * needed for returning updated symbol table information after parsing. * @param input Input source used to read the XML document. * @param cfg Object that contains reader configuration info. * @param bs Bootstrapper to use, for reading xml declaration etc. * @param forER True if this reader is to be (configured to be) used by * an event reader. Will cause some changes to default settings, as * required by contracts Woodstox XMLEventReader implementation has * (with respect to lazy parsing, short text segments etc) */ public static ValidatingStreamReader createValidatingStreamReader (BranchingReaderSource input, ReaderCreator owner, ReaderConfig cfg, InputBootstrapper bs, boolean forER) throws XMLStreamException { ValidatingStreamReader sr = new ValidatingStreamReader (bs, input, owner, cfg, createElementStack(cfg), forER); return sr; }
throws XMLStreamException boolean cache = hasConfigFlags(CFG_CACHE_DTDS); DTDId dtdId; try { dtdId = constructDtdId(pubId, sysId); } catch (IOException ioe) { throw constructFromIOE(ioe); DTDSubset extSubset = findCachedSubset(dtdId, intSubset); if (extSubset != null) { return extSubset; throwParseError("Can not resolve DTD with public id \"{0}\"; missing system identifier", mDtdPublicId, null); throwParseError("(was {0}) {1}", fex.getClass().getName(), fex.getMessage()); } catch (IOException ioe) { throwFromIOE(ioe); hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion);
throws XMLStreamException if (!hasConfigFlags(CFG_SUPPORT_DTD)) { super.finishDTD(copyContents); return; char c = getNextChar(SUFFIX_IN_DTD); DTDSubset intSubset = null; hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion); } finally { c = getNextCharAfterWS(SUFFIX_IN_DTD_INTERNAL); throwUnexpectedChar(c, "; expected '>' to finish DOCTYPE declaration."); extSubset = findDtdExtSubset(mDtdPublicId, mDtdSystemId, intSubset); _reportProblem(mConfig.getXMLReporter(), ErrorConsts.WT_DT_DECL, "Value to set for feature "+FEATURE_DTD_OVERRIDE+" not a native Woodstox DTD implementation (but "+mDTD.getClass()+"): can not access full entity or notation information", null);
/** * Method called right before handling the root element, by the base * class. This allows for some initialization and checks to be done * (not including ones that need access to actual element name) */ protected void initValidation() throws XMLStreamException { if (hasConfigFlags(CFG_VALIDATE_AGAINST_DTD) && !mDtdValidatorSet) { /* It's ok to miss it, but it may not be what caller wants. Either * way, let's pass the info and continue */ reportProblem(null, ErrorConsts.WT_DT_DECL, ErrorConsts.W_MISSING_DTD, null, null); } }
throws IOException, XMLStreamException if (!hasConfigFlags(CFG_SUPPORT_DTD)) { super.finishDTD(copyContents); return; char c = getNextChar(SUFFIX_IN_DTD); DTDSubset intSubset = null; hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion); } finally { c = getNextCharAfterWS(SUFFIX_IN_DTD_INTERNAL); throwUnexpectedChar(c, "; expected '>' to finish DOCTYPE declaration."); extSubset = findDtdExtSubset(mDtdPublicId, mDtdSystemId, intSubset); doReportProblem(mConfig.getXMLReporter(), ErrorConsts.WT_DT_DECL, "Value to set for feature "+FEATURE_DTD_OVERRIDE+" not a native Woodstox DTD implementation (but "+mDTD.getClass()+"): can not access full entity or notation information", null);
throws IOException, XMLStreamException boolean cache = hasConfigFlags(CFG_CACHE_DTDS); DTDId dtdId = constructDtdId(pubId, sysId); DTDSubset extSubset = findCachedSubset(dtdId, intSubset); if (extSubset != null) { return extSubset; throwParseError("Can not resolve DTD with public id '" +mDtdPublicId+"'; missing system identifier."); throwParseError("(was "+fex.getClass().getName()+") "+fex.getMessage()); hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion);
(cfg, bs, null, systemId, r, autoCloseInput); return ValidatingStreamReader.createValidatingStreamReader(input, this, cfg, bs, forER);
throws IOException, XMLStreamException if (!hasConfigFlags(CFG_SUPPORT_DTD)) { super.finishDTD(copyContents); return; char c = getNextChar(SUFFIX_IN_DTD); DTDSubset intSubset = null; hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion); } finally { c = getNextCharAfterWS(SUFFIX_IN_DTD_INTERNAL); throwUnexpectedChar(c, "; expected '>' to finish DOCTYPE declaration."); extSubset = findDtdExtSubset(mDtdPublicId, mDtdSystemId, intSubset); doReportProblem(mConfig.getXMLReporter(), ErrorConsts.WT_DT_DECL, "Value to set for feature "+FEATURE_DTD_OVERRIDE+" not a native Woodstox DTD implementation (but "+mDTD.getClass()+"): can not access full entity or notation information", null);
throws IOException, XMLStreamException boolean cache = hasConfigFlags(CFG_CACHE_DTDS); DTDId dtdId = constructDtdId(pubId, sysId); DTDSubset extSubset = findCachedSubset(dtdId, intSubset); if (extSubset != null) { return extSubset; throwParseError("Can not resolve DTD with public id '" +mDtdPublicId+"'; missing system identifier."); throwParseError("(was "+fex.getClass().getName()+") "+fex.getMessage()); hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion);
/** * Method called right before handling the root element, by the base * class. This allows for some initialization and checks to be done * (not including ones that need access to actual element name) */ @Override protected void initValidation() throws XMLStreamException { if (hasConfigFlags(CFG_VALIDATE_AGAINST_DTD) && !mDtdValidatorSet) { /* It's ok to miss it, but it may not be what caller wants. Either * way, let's pass the info and continue */ reportProblem(null, ErrorConsts.WT_DT_DECL, ErrorConsts.W_MISSING_DTD, null, null); } }
(cfg, bs, null, systemId, r, autoCloseInput); return ValidatingStreamReader.createValidatingStreamReader(input, this, cfg, bs, forER);
throws XMLStreamException if (!hasConfigFlags(CFG_SUPPORT_DTD)) { super.finishDTD(copyContents); return; char c = getNextChar(SUFFIX_IN_DTD); DTDSubset intSubset = null; hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion); } finally { c = getNextCharAfterWS(SUFFIX_IN_DTD_INTERNAL); throwUnexpectedChar(c, "; expected '>' to finish DOCTYPE declaration."); extSubset = findDtdExtSubset(mDtdPublicId, mDtdSystemId, intSubset); _reportProblem(mConfig.getXMLReporter(), ErrorConsts.WT_DT_DECL, "Value to set for property '"+XMLInputFactory2.P_DTD_OVERRIDE +"' not a native Woodstox DTD implementation (but "+mDTD.getClass()+"): can not access full entity or notation information", null);
throws XMLStreamException boolean cache = hasConfigFlags(CFG_CACHE_DTDS); DTDId dtdId; try { dtdId = constructDtdId(pubId, sysId); } catch (IOException ioe) { throw constructFromIOE(ioe); DTDSubset extSubset = findCachedSubset(dtdId, intSubset); if (extSubset != null) { return extSubset; throwParseError("Can not resolve DTD with public id \"{0}\"; missing system identifier", mDtdPublicId, null); throwParseError("(was {0}) {1}", fex.getClass().getName(), fex.getMessage()); } catch (IOException ioe) { throwFromIOE(ioe); hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion);
throws IOException, XMLStreamException if (!hasConfigFlags(CFG_SUPPORT_DTD)) { super.finishDTD(copyContents); return; char c = getNextChar(SUFFIX_IN_DTD); DTDSubset intSubset = null; hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion); } finally { c = getNextCharAfterWS(SUFFIX_IN_DTD_INTERNAL); throwUnexpectedChar(c, "; expected '>' to finish DOCTYPE declaration."); extSubset = findDtdExtSubset(mDtdPublicId, mDtdSystemId, intSubset); doReportProblem(mConfig.getXMLReporter(), ErrorConsts.WT_DT_DECL, "Value to set for feature "+FEATURE_DTD_OVERRIDE+" not a native Woodstox DTD implementation (but "+mDTD.getClass()+"): can not access full entity or notation information", null);
throws IOException, XMLStreamException boolean cache = hasConfigFlags(CFG_CACHE_DTDS); DTDId dtdId = constructDtdId(pubId, sysId); DTDSubset extSubset = findCachedSubset(dtdId, intSubset); if (extSubset != null) { return extSubset; throwParseError("Can not resolve DTD with public id '" +mDtdPublicId+"'; missing system identifier."); throwParseError("(was "+fex.getClass().getName()+") "+fex.getMessage()); hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion);
/** * Method called right before handling the root element, by the base * class. This allows for some initialization and checks to be done * (not including ones that need access to actual element name) */ protected void initValidation() throws XMLStreamException { if (hasConfigFlags(CFG_VALIDATE_AGAINST_DTD) && !mDtdValidatorSet) { /* It's ok to miss it, but it may not be what caller wants. Either * way, let's pass the info and continue */ reportProblem(ErrorConsts.WT_DT_DECL, ErrorConsts.W_MISSING_DTD); } }
/** * Factory method for constructing readers. * * @param owner "Owner" of this reader, factory that created the reader; * needed for returning updated symbol table information after parsing. * @param input Input source used to read the XML document. * @param cfg Object that contains reader configuration info. * @param bs Bootstrapper to use, for reading xml declaration etc. * @param forER True if this reader is to be (configured to be) used by * an event reader. Will cause some changes to default settings, as * required by contracts Woodstox XMLEventReader implementation has * (with respect to lazy parsing, short text segments etc) */ public static ValidatingStreamReader createValidatingStreamReader (BranchingReaderSource input, ReaderCreator owner, ReaderConfig cfg, InputBootstrapper bs, boolean forER) throws IOException, XMLStreamException { ValidatingStreamReader sr = new ValidatingStreamReader (bs, input, owner, cfg, createElementStack(cfg), forER); return sr; }
(cfg, bs, null, systemId, r, autoCloseInput); return ValidatingStreamReader.createValidatingStreamReader(input, this, cfg, bs, forER);
throws XMLStreamException if (!hasConfigFlags(CFG_SUPPORT_DTD)) { super.finishDTD(copyContents); return; char c = getNextChar(SUFFIX_IN_DTD); DTDSubset intSubset = null; hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion); } finally { c = getNextCharAfterWS(SUFFIX_IN_DTD_INTERNAL); throwUnexpectedChar(c, "; expected '>' to finish DOCTYPE declaration."); extSubset = findDtdExtSubset(mDtdPublicId, mDtdSystemId, intSubset); _reportProblem(mConfig.getXMLReporter(), ErrorConsts.WT_DT_DECL, "Value to set for property '"+XMLInputFactory2.P_DTD_OVERRIDE +"' not a native Woodstox DTD implementation (but "+mDTD.getClass()+"): can not access full entity or notation information", null);
throws XMLStreamException boolean cache = hasConfigFlags(CFG_CACHE_DTDS); DTDId dtdId; try { dtdId = constructDtdId(pubId, sysId); } catch (IOException ioe) { throw constructFromIOE(ioe); DTDSubset extSubset = findCachedSubset(dtdId, intSubset); if (extSubset != null) { return extSubset; throwParseError("Can not resolve DTD with public id \"{0}\"; missing system identifier", mDtdPublicId, null); throwParseError("(was {0}) {1}", fex.getClass().getName(), fex.getMessage()); } catch (IOException ioe) { throwFromIOE(ioe); hasConfigFlags(CFG_VALIDATE_AGAINST_DTD), mDocXmlVersion);