/* Woodstox XML processor
*
* Copyright (c) 2004- Tatu Saloranta, tatu.saloranta@iki.fi
*
* Licensed under the License specified in file LICENSE, included with
* the source code.
* You may not use this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ctc.wstx.sr;
import java.io.*;
import java.text.MessageFormat;
import java.util.Map;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.ext.LexicalHandler;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
import org.codehaus.stax2.AttributeInfo;
import org.codehaus.stax2.DTDInfo;
import org.codehaus.stax2.LocationInfo;
import org.codehaus.stax2.XMLStreamLocation2;
import org.codehaus.stax2.XMLStreamProperties;
import org.codehaus.stax2.XMLStreamReader2;
import org.codehaus.stax2.typed.TypedXMLStreamException;
import org.codehaus.stax2.validation.*;
import com.ctc.wstx.api.ReaderConfig;
import com.ctc.wstx.api.WstxInputProperties;
import com.ctc.wstx.cfg.ErrorConsts;
import com.ctc.wstx.cfg.XmlConsts;
import com.ctc.wstx.dtd.MinimalDTDReader;
import com.ctc.wstx.ent.EntityDecl;
import com.ctc.wstx.exc.WstxException;
import com.ctc.wstx.io.*;
import com.ctc.wstx.util.DefaultXmlSymbolTable;
import com.ctc.wstx.util.TextBuffer;
import com.ctc.wstx.util.TextBuilder;
/**
* Partial implementation of {@link XMLStreamReader2} consisting of
* all functionality other than DTD-validation-specific parts, and
* Typed Access API (Stax2 v3.0), which are implemented at
* sub-classes.
*<p>
*
* @author Tatu Saloranta
*/
public abstract class BasicStreamReader
extends StreamScanner
implements StreamReaderImpl, DTDInfo, LocationInfo
{
/*
///////////////////////////////////////////////////////////////////////
// Constants
///////////////////////////////////////////////////////////////////////
*/
// // // Standalone values:
final static int DOC_STANDALONE_UNKNOWN = 0;
final static int DOC_STANDALONE_YES = 1;
final static int DOC_STANDALONE_NO = 2;
// // // Main state consts:
final static int STATE_PROLOG = 0; // Before root element
final static int STATE_TREE = 1; // Parsing actual XML tree
final static int STATE_EPILOG = 2; // After root element has been closed
final static int STATE_MULTIDOC_HACK = 3; // State "between" multiple documents (in multi-doc mode)
final static int STATE_CLOSED = 4; // After reader has been closed
// // // Tokenization state consts:
// no idea as to what comes next (unknown type):
final static int TOKEN_NOT_STARTED = 0;
// token type figured out, but not long enough:
final static int TOKEN_STARTED = 1;
/* minimum token length returnable achieved; only used for CDATA and
* CHARACTERS events which allow fragments to be returned
*/
final static int TOKEN_PARTIAL_SINGLE = 2;
/* a single physical event has been succesfully tokenized; as with
* partial, only used with CDATA and CHARACTERS (meaningless for others,
* which should only use TOKEN_FULL_COALESCED, TOKEN_NOT_STARTED or
* TOKEN_STARTED.
*/
final static int TOKEN_FULL_SINGLE = 3;
/* all adjacent (text) events have been tokenized and coalesced (for
* CDATA and CHARACTERS), or that the full event has been parsed (for
* others)
*/
final static int TOKEN_FULL_COALESCED = 4;
// // // Bit masks used for quick type comparisons
/**
* This mask covers all types for which basic {@link #getText} method
* can be called.
*/
final protected static int MASK_GET_TEXT =
(1 << CHARACTERS) | (1 << CDATA) | (1 << SPACE)
| (1 << COMMENT) | (1 << DTD) | (1 << ENTITY_REFERENCE);
/**
* This mask covers all types for which extends <code>getTextXxx</code>
* methods can be called; which is less than those for which
* {@link #getText} can be called. Specifically, <code>DTD</code> and
* <code>ENTITY_REFERENCE</code> types do not support these extended
*/
final protected static int MASK_GET_TEXT_XXX =
(1 << CHARACTERS) | (1 << CDATA) | (1 << SPACE) | (1 << COMMENT);
/**
* This mask is used with Stax2 getText() method (one that takes
* Writer as an argument): accepts even wider range of event types.
*/
final protected static int MASK_GET_TEXT_WITH_WRITER =
(1 << CHARACTERS) | (1 << CDATA) | (1 << SPACE)
| (1 << COMMENT) | (1 << DTD) | (1 << ENTITY_REFERENCE)
| (1 << PROCESSING_INSTRUCTION);
final protected static int MASK_GET_ELEMENT_TEXT =
(1 << CHARACTERS) | (1 << CDATA) | (1 << SPACE)
| (1 << ENTITY_REFERENCE);
// // // Indicator of type of text in text event (WRT white space)
final static int ALL_WS_UNKNOWN = 0x0000;
final static int ALL_WS_YES = 0x0001;
final static int ALL_WS_NO = 0x0002;
/* 2 magic constants used for enabling/disabling indentation checks:
* (to minimize negative impact for both small docs, and large
* docs with non-regular white space)
*/
private final static int INDENT_CHECK_START = 16;
private final static int INDENT_CHECK_MAX = 40;
// // // Shared namespace symbols
final protected static String sPrefixXml = DefaultXmlSymbolTable.getXmlSymbol();
final protected static String sPrefixXmlns = DefaultXmlSymbolTable.getXmlnsSymbol();
/*
///////////////////////////////////////////////////////////////////////
// Configuration
///////////////////////////////////////////////////////////////////////
*/
// note: mConfig defined in base class
/**
* Set of locally stored configuration flags
*/
protected final int mConfigFlags;
// // // Various extracted settings:
protected final boolean mCfgCoalesceText;
protected final boolean mCfgReportTextAsChars;
protected final boolean mCfgLazyParsing;
/**
* Minimum number of characters parser can return as partial text
* segment, IF it's not required to coalesce adjacent text
* segments.
*/
protected final int mShortestTextSegment;
/*
///////////////////////////////////////////////////////////////////////
// Symbol handling:
///////////////////////////////////////////////////////////////////////
*/
/**
* Object to notify about shared stuff, such as symbol tables, as well
* as to query for additional config settings if necessary.
*/
final protected ReaderCreator mOwner;
/*
///////////////////////////////////////////////////////////////////////
// Additional XML document information, in addition
// to what StreamScanner has
///////////////////////////////////////////////////////////////////////
*/
/**
* Status about "stand-aloneness" of document; set to 'yes'/'no'/'unknown'
* based on whether there was xml declaration, and if so, whether
* it had standalone attribute.
*/
protected int mDocStandalone = DOC_STANDALONE_UNKNOWN;
/*
///////////////////////////////////////////////////////////////////////
// DOCTYPE information from document type declaration
// (if any found)
///////////////////////////////////////////////////////////////////////
*/
/**
* Prefix of root element, as dictated by DOCTYPE declaration; null
* if no DOCTYPE declaration, or no root prefix
*/
String mRootPrefix;
/**
* Local name of root element, as dictated by DOCTYPE declaration; null
* if no DO
没有合适的资源?快使用搜索试试~ 我知道了~
woodstox-core-asl-source.rar_jax
共177个文件
java:176个
mf:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 7 浏览量
2022-09-23
13:25:10
上传
评论
收藏 506KB RAR 举报
温馨提示
JAX woodstox-core-asl 源码
资源推荐
资源详情
资源评论
收起资源包目录
woodstox-core-asl-source.rar_jax (177个子文件)
BasicStreamReader.java 205KB
FullDTDReader.java 125KB
StreamScanner.java 84KB
BaseStreamWriter.java 60KB
BufferingXmlWriter.java 53KB
ReaderConfig.java 51KB
TextBuffer.java 45KB
WstxSAXParser.java 44KB
AttributeCollector.java 38KB
InputElementStack.java 35KB
StreamBootstrapper.java 32KB
ISOLatin1XmlWriter.java 29KB
WriterConfig.java 29KB
WstxInputFactory.java 29KB
EncodingXmlWriter.java 28KB
AsciiXmlWriter.java 27KB
TypedStreamReader.java 27KB
BaseNsStreamWriter.java 26KB
WstxDOMWrappingWriter.java 26KB
RepairingNsStreamWriter.java 25KB
ValidatingStreamReader.java 24KB
SymbolTable.java 24KB
XmlChars.java 22KB
XmlWriter.java 21KB
WordResolver.java 19KB
DTDElement.java 19KB
GenericMsvValidator.java 18KB
NonNsStreamWriter.java 18KB
DTDSubsetImpl.java 18KB
DTDAttribute.java 17KB
DTDValidatorBase.java 17KB
InputBootstrapper.java 17KB
WstxInputData.java 16KB
WordSet.java 16KB
UTF8Reader.java 15KB
DTDValidator.java 14KB
DefaultInputResolver.java 14KB
UTF8Writer.java 14KB
ElementIdMap.java 13KB
MinimalDTDReader.java 13KB
ReaderBootstrapper.java 13KB
WstxOutputFactory.java 12KB
OutputElementBase.java 12KB
SimpleNsStreamWriter.java 12KB
TypedStreamWriter.java 11KB
DTDTypingNonValidator.java 11KB
CharsetNames.java 11KB
SimpleOutputElement.java 11KB
DefaultEventAllocator.java 11KB
StringUtil.java 10KB
BijectiveNsMap.java 10KB
WstxInputProperties.java 10KB
EBCDICCodec.java 9KB
ErrorConsts.java 9KB
CompactNsContext.java 8KB
UTF32Reader.java 8KB
CommonConfig.java 8KB
WstxInputSource.java 8KB
ElemAttrs.java 8KB
WstxOutputProperties.java 8KB
URLUtil.java 7KB
StringVector.java 7KB
ChoiceContentSpec.java 7KB
DTDSchemaFactory.java 7KB
InputConfigFlags.java 7KB
SeqContentSpec.java 7KB
DefaultAttrValue.java 6KB
DFAState.java 6KB
DTDNmTokensAttr.java 6KB
BaseReader.java 6KB
ReaderSource.java 6KB
WstxSAXParserFactory.java 6KB
MergedNsContext.java 6KB
DOMOutputElement.java 6KB
DTDEntitiesAttr.java 6KB
SimpleStartElement.java 6KB
PrefixedName.java 5KB
LargePrefixedNameSet.java 5KB
BaseSchemaFactory.java 5KB
BaseStartElement.java 5KB
BaseInputSource.java 5KB
WstxInputLocation.java 5KB
DTDIdRefsAttr.java 5KB
CompactStartElement.java 5KB
BranchingReaderSource.java 5KB
DTDId.java 5KB
ElementId.java 4KB
XmlWriterWrapper.java 4KB
Attribute.java 4KB
DTDWriter.java 4KB
WstxEventFactory.java 4KB
BaseNsContext.java 4KB
DTDIdAttr.java 4KB
OutputConfigFlags.java 4KB
TokenContentSpec.java 4KB
DataUtil.java 4KB
AsciiReader.java 4KB
ISOLatinReader.java 4KB
AttributeProxy.java 4KB
InvalidCharHandler.java 4KB
共 177 条
- 1
- 2
资源评论
JaniceLu
- 粉丝: 78
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功