/** * @return Internal subset portion of the DOCTYPE declaration, if any; * empty String if none */ public String getDTDInternalSubset() { if (mCurrToken != DTD) { return null; } return mTextBuffer.contentsAsString(); }
public NonNsStreamWriter(XmlWriter xw, String enc, WriterConfig cfg) { super(xw, enc, cfg); mElements = new StringVector(32); }
private TextBuffer getTextBuffer() { if (mTextBuffer == null) { mTextBuffer = TextBuffer.createTemporaryBuffer(); mTextBuffer.resetInitialized(); } else { mTextBuffer.resetWithEmpty(); } return mTextBuffer; }
/** * @return Number of active prefix/namespace mappings for current scope, * including mappings from enclosing elements. */ public final int getTotalNsCount() { return mNamespaces.size() >> 1; }
public void append(char c) { if (mBuffer.length == mBufferLen) { resize(1); } mBuffer[mBufferLen++] = c; }
public static BijectiveNsMap createEmpty() { String[] strs = new String[DEFAULT_ARRAY_SIZE]; strs[0] = XMLConstants.XML_NS_PREFIX; strs[1] = XMLConstants.XML_NS_URI; strs[2] = XMLConstants.XMLNS_ATTRIBUTE; strs[3] = XMLConstants.XMLNS_ATTRIBUTE_NS_URI; /* Let's consider pre-defined ones to be 'out of scope', i.e. * conceptually be part of (missing) parent's mappings. */ return new BijectiveNsMap(4, strs); }
protected ElementIdMap getIdMap() { /* should never be called; for now let's throw an exception, if it * turns out it does get called can/should return an empty immutable * map or something */ ExceptionUtil.throwGenericInternal(); return null; // never gets here }
/** * Method called to make sure that buffer is not using shared input * buffer; if it is, it will copy such contents to private buffer. */ public void ensureNotShared() { if (mInputStart >= 0) { unshare(16); } }
/** * Internal method used by implementation */ private char[] getDTDInternalSubsetArray() { /* Note: no checks for current state, but only because it's * an internal method and callers are known to ensure it's ok * to call this */ return mTextBuffer.contentsAsArray(); }
/** * Method readers created by this factory call, if DTD caching is * enabled, to see if an external DTD (subset) has been parsed * and cached earlier. */ public synchronized DTDSubset findCachedDTD(DTDId id) { return (mDTDCache == null) ? null : (DTDSubset) mDTDCache.find(id); }
public final void validateText(TextBuffer tb, boolean lastTextSegment) throws XMLStreamException { tb.validateText(mValidator, lastTextSegment); }
protected boolean removeEldestEntry(Map.Entry eldest) { return size() > MAX_SIZE; } }
public SimpleCache(int maxSize) { mItems = new LimitMap(maxSize); mMaxSize = maxSize; }
public String tryToValidate(PrefixedName elemName) { if (!elemName.equals(mElemName)) { return "Expected element <"+mElemName+">"; } if (++mCount > 1 && (mArity == '?' || mArity == ' ')) { return "More than one instance of element <"+mElemName+">"; } return null; }
public WstxException(String msg, Location loc, Throwable th) { super(msg, loc, th); mMsg = msg; // 13-Aug-2004, TSa: Better make sure root cause is set... ExceptionUtil.setInitCause(this, th); }
protected ElementIdMap getIdMap() { if (mIdMap == null) { mIdMap = new ElementIdMap(); } return mIdMap; }
/** * Note: calling this method may not be as efficient as calling * {@link #contentsAsString}, since it's not guaranteed that resulting * String is cached. */ public String toString() { return contentsAsString(); }
/** * @return Number of active prefix/namespace mappings for current scope, * NOT including mappings from enclosing elements. */ public final int getCurrentNsCount() { // Need not check for empty stack; should return 0 properly return (mNamespaces.size() - mCurrElement.mNsOffset) >> 1; }
public char[] bufferFull(int needSpaceFor) { mBufferLen = mBuffer.length; resize(1); return mBuffer; }