int count; try { count = input.readInto(this); if (count > 0) { return true; input.close(); } catch (IOException ioe) { throw constructFromIOE(ioe); WstxInputSource parent = input.getParent(); if (parent == null) { // sanity check! throwNullParent(input); if (mCurrDepth != input.getScopeId()) { handleIncompleteEntityProblem(input); input.restoreContext(this); mInputTopDepth = input.getScopeId(); mNormalizeLFs = !input.fromInternalEntity();
protected void closeAllInput(boolean force) throws XMLStreamException { WstxInputSource input = mInput; while (true) { try { if (force) { input.closeCompletely(); } else { input.close(); } } catch (IOException ie) { throw constructFromIOE(ie); } if (input == mRootInput) { break; } WstxInputSource parent = input.getParent(); if (parent == null) { // sanity check! throwNullParent(input); } mInput = input = parent; } }
if (mInput.isOrIsExpandedFrom(id)) { throwRecursionError(id); oldInput.saveContext(this); (oldInput, id, null, null, resolver, mConfig, xmlVersion); if (mCfgTreatCharRefsAsEntities) { return new IntEntity(WstxInputLocation.getEmptyLocation(), newInput.getEntityId(), newInput.getSource(), new char[]{}, WstxInputLocation.getEmptyLocation());
public String toString() { StringBuffer sb = new StringBuffer(80); sb.append("<WstxInputSource [class "); sb.append(getClass().toString()); sb.append("]; systemId: "); sb.append(getSystemId()); sb.append(", source: "); try { URL url = getSource(); sb.append(url.toString()); } catch (IOException e) { sb.append("[ERROR: "+e.getMessage()+"]"); } sb.append('>'); return sb.toString(); } }
/** * Method that returns location of the last character returned by this * reader; that is, location "one less" than the currently pointed to * location. */ protected WstxInputLocation getLastCharLocation() { return mInput.getLocation(mCurrInputProcessed + mInputPtr - 1, mCurrInputRow, mInputPtr - mCurrInputRowStart); }
private String entityDesc(WstxInputSource input) { return "Entity &"+input.getEntityId()+";"; }
/** * Constructor used for reading external subset. */ private FullDTDReader(WstxInputSource input, ReaderConfig cfg, DTDSubset intSubset, boolean constructFully, int xmlVersion) { this(input, cfg, true, intSubset, constructFully, xmlVersion); // Let's make sure line/col offsets are correct... input.initInputLocation(this, mCurrDepth, 0); }
protected URL getSource() throws IOException { return mInput.getSource(); }
protected String getSystemId() { return mInput.getSystemId(); }
/** * Handling of PE matching problems is actually intricate; one type * will be a WFC ("PE Between Declarations", which refers to PEs that * start from outside declarations), and another just a VC * ("Proper Declaration/PE Nesting", when PE is contained within * declaration) */ protected void handleIncompleteEntityProblem(WstxInputSource closing) throws XMLStreamException { // Did it start outside of declaration? if (closing.getScopeId() == 0) { // yup // and being WFC, need not be validating _reportWFCViolation(entityDesc(closing) + ": " +"Incomplete PE: has to fully contain a declaration (as per xml 1.0.3, section 2.8, WFC 'PE Between Declarations')"); } else { // whereas the other one is only sent in validating mode.. if (mCfgFullyValidating) { _reportVCViolation(entityDesc(closing) + ": " +"Incomplete PE: has to be fully contained in a declaration (as per xml 1.0.3, section 2.8, VC 'Proper Declaration/PE Nesting')"); } } }
int entityDepth = mInput.getEntityDepth() + 1; verifyLimit("Maximum entity expansion depth", mConfig.getMaxEntityDepth(), entityDepth); mInput = newInput; mInput.initInputLocation(this, mCurrDepth, entityDepth);
public String toString() { StringBuffer sb = new StringBuffer(80); sb.append("<WstxInputSource [class "); sb.append(getClass().toString()); sb.append("]; systemId: "); sb.append(getSystemId()); sb.append(", source: "); sb.append(getSource()); sb.append('>'); return sb.toString(); } }
public XMLStreamLocation2 getStartLocation() { // note: +1 is used as columns are 1-based... return mInput.getLocation(mTokenInputTotal, mTokenInputRow, mTokenInputCol + 1); }
protected void handleIncompleteEntityProblem(WstxInputSource closing) throws XMLStreamException { String top = mElementStack.isEmpty() ? "[ROOT]" : mElementStack.getTopElementDesc(); throwParseError("Unexpected end of entity expansion for entity &{0}; was expecting a close tag for element <{1}>", closing.getEntityId(), top); }
/** * Constructor used for reading external subset. */ private FullDTDReader(WstxInputSource input, ReaderConfig cfg, DTDSubset intSubset, boolean constructFully, int xmlVersion) { this(input, cfg, true, intSubset, constructFully, xmlVersion); // Let's make sure line/col offsets are correct... input.initInputLocation(this, mCurrDepth); }
public Object getProperty(String name) { /* 18-Nov-2008, TSa: As per [WSTX-50], should report the * actual Base URL. It can be overridden by matching * setProperty, but if not, is set to actual source * of content being parsed. */ if (WstxInputProperties.P_BASE_URL.equals(name)) { try { return mInput.getSource(); } catch (IOException e) { // not optimal but... throw new IllegalStateException(e); } } /* 23-Apr-2008, TSa: Let's NOT throw IllegalArgumentException * for unknown property; JavaDocs do not suggest it needs * to be done (different from that of XMLInputFactory * and XMLStreamWriter specification) */ return mConfig.safeGetProperty(name); }
protected String getSystemId() { return mInput.getSystemId(); }
if (mInput.getScopeId() > 0) { handleGreedyEntityProblem(mInput);
int entityDepth = mInput.getEntityDepth() + 1; verifyLimit("Maximum entity expansion depth", mConfig.getMaxEntityDepth(), entityDepth); mInput = newInput; mInput.initInputLocation(this, mCurrDepth, entityDepth);
mCurrInputRowStart -= mInputEnd; try { int count = input.readInto(this); if (count > 0) { if (mFlattenWriter != null) { input.close(); } catch (IOException ioe) { throw constructFromIOE(ioe); return false; WstxInputSource parent = input.getParent(); if (parent == null) { // sanity check! throwNullParent(input); if (mCurrDepth != input.getScopeId()) { handleIncompleteEntityProblem(input); input.restoreContext(this); if (mFlattenWriter != null) { mFlattenWriter.setFlattenStart(mInputPtr); mInputTopDepth = input.getScopeId(); mNormalizeLFs = !input.fromInternalEntity();