|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.plexus.metadata.merge.MXParser
public class MXParser
Absolutely minimal implementation of XMLPULL V1 API. Encoding handling done with XmlReader
XmlReader| Field Summary | |
|---|---|
protected boolean |
allStringsInterned
Implementation notice: the is instance variable that controls if newString() is interning. |
protected int |
attributeCount
|
protected String[] |
attributeName
|
protected int[] |
attributeNameHash
|
protected String[] |
attributePrefix
|
protected String[] |
attributeUri
|
protected String[] |
attributeValue
|
protected char[] |
buf
|
protected int |
bufAbsoluteStart
|
protected int |
bufEnd
|
protected int |
bufLoadFactor
|
protected int |
bufSoftLimit
|
protected int |
bufStart
|
protected char[] |
charRefOneCharBuf
|
protected int |
columnNumber
|
protected int |
depth
|
protected String[] |
elName
|
protected int[] |
elNamespaceCount
|
protected String[] |
elPrefix
|
protected char[][] |
elRawName
|
protected int[] |
elRawNameEnd
|
protected int[] |
elRawNameLine
|
protected String[] |
elUri
|
protected boolean |
emptyElementTag
|
protected int |
entityEnd
|
protected String[] |
entityName
|
protected char[][] |
entityNameBuf
|
protected int[] |
entityNameHash
|
protected String |
entityRefName
|
protected String[] |
entityReplacement
|
protected char[][] |
entityReplacementBuf
|
protected int |
eventType
|
protected static String |
FEATURE_NAMES_INTERNED
|
protected static String |
FEATURE_XML_ROUNDTRIP
|
protected String |
inputEncoding
|
protected int |
lineNumber
|
protected String |
location
|
protected static int |
LOOKUP_MAX
|
protected static char |
LOOKUP_MAX_CHAR
|
protected static boolean[] |
lookupNameChar
|
protected static boolean[] |
lookupNameStartChar
|
protected int |
namespaceEnd
|
protected String[] |
namespacePrefix
|
protected int[] |
namespacePrefixHash
|
protected String[] |
namespaceUri
|
protected static char[] |
NCODING
|
protected static char[] |
NO
|
protected boolean |
pastEndTag
|
protected char[] |
pc
|
protected int |
pcEnd
|
protected int |
pcStart
|
protected int |
pos
|
protected int |
posEnd
|
protected int |
posStart
|
protected boolean |
preventBufferCompaction
|
protected boolean |
processNamespaces
|
protected static String |
PROPERTY_LOCATION
|
protected static String |
PROPERTY_XMLDECL_CONTENT
|
protected static String |
PROPERTY_XMLDECL_STANDALONE
|
protected static String |
PROPERTY_XMLDECL_VERSION
|
protected boolean |
reachedEnd
|
protected static int |
READ_CHUNK_SIZE
|
protected Reader |
reader
|
protected static String |
REPORT_NAMESPACE_PREFIXES
|
protected boolean |
roundtripSupported
|
protected boolean |
seenAmpersand
|
protected boolean |
seenDocdecl
|
protected boolean |
seenEndTag
|
protected boolean |
seenMarkup
|
protected boolean |
seenRoot
|
protected boolean |
seenStartTag
|
protected static char[] |
TANDALONE
|
protected String |
text
|
protected boolean |
tokenize
|
protected boolean |
usePC
|
protected static char[] |
VERSION
|
protected static String |
XML_URI
|
protected String |
xmlDeclContent
|
protected Boolean |
xmlDeclStandalone
|
protected String |
xmlDeclVersion
|
protected static String |
XMLNS_URI
|
protected static char[] |
YES
|
| Fields inherited from interface org.codehaus.plexus.util.xml.pull.XmlPullParser |
|---|
CDSECT, COMMENT, DOCDECL, END_DOCUMENT, END_TAG, ENTITY_REF, FEATURE_PROCESS_DOCDECL, FEATURE_PROCESS_NAMESPACES, FEATURE_REPORT_NAMESPACE_ATTRIBUTES, FEATURE_VALIDATION, IGNORABLE_WHITESPACE, NO_NAMESPACE, PROCESSING_INSTRUCTION, START_DOCUMENT, START_TAG, TEXT, TYPES |
| Constructor Summary | |
|---|---|
MXParser()
|
|
| Method Summary | |
|---|---|
void |
defineEntityReplacementText(String entityName,
String replacementText)
|
protected void |
ensureAttributesCapacity(int size)
Make sure that in attributes temporary array is enough space. |
protected void |
ensureElementsCapacity()
Make sure that we have enough space to keep element stack if passed size. |
protected void |
ensureEntityCapacity()
|
protected void |
ensureNamespacesCapacity(int size)
|
protected void |
ensurePC(int end)
|
protected static int |
fastHash(char[] ch,
int off,
int len)
simplistic implementation of hash function that has constant time to compute - so it also means diminishing hash quality for long strings but for XML parsing it should be good enough ... |
protected void |
fillBuf()
|
int |
getAttributeCount()
|
String |
getAttributeName(int index)
|
String |
getAttributeNamespace(int index)
|
String |
getAttributePrefix(int index)
|
String |
getAttributeType(int index)
|
String |
getAttributeValue(int index)
|
String |
getAttributeValue(String namespace,
String name)
|
int |
getColumnNumber()
|
int |
getDepth()
|
int |
getEventType()
|
boolean |
getFeature(String name)
Unknown properties are |
String |
getInputEncoding()
|
int |
getLineNumber()
|
String |
getName()
|
String |
getNamespace()
|
String |
getNamespace(String prefix)
|
int |
getNamespaceCount(int depth)
|
String |
getNamespacePrefix(int pos)
|
String |
getNamespaceUri(int pos)
|
String |
getPositionDescription()
Return string describing current position of parsers as text 'STATE [seen %s...] @line:column'. |
String |
getPrefix()
|
Object |
getProperty(String name)
|
String |
getText()
|
char[] |
getTextCharacters(int[] holderForStartAndLength)
|
boolean |
isAttributeDefault(int index)
|
boolean |
isEmptyElementTag()
|
protected boolean |
isNameChar(char ch)
|
protected boolean |
isNameStartChar(char ch)
|
protected boolean |
isS(char ch)
|
boolean |
isWhitespace()
|
protected void |
joinPC()
|
protected char[] |
lookuEntityReplacement(int entitNameLen)
|
protected char |
more()
|
protected String |
newString(char[] cbuf,
int off,
int len)
|
protected String |
newStringIntern(char[] cbuf,
int off,
int len)
|
int |
next()
|
protected int |
nextImpl()
|
int |
nextTag()
|
String |
nextText()
|
int |
nextToken()
|
protected char |
parseAttribute()
|
protected void |
parseCDSect(boolean hadCharData)
|
protected void |
parseComment()
|
protected void |
parseDocdecl()
|
int |
parseEndTag()
|
protected char[] |
parseEntityRef()
|
protected int |
parseEpilog()
|
protected boolean |
parsePI()
|
protected int |
parseProlog()
|
int |
parseStartTag()
|
protected void |
parseXmlDecl(char ch)
|
protected void |
parseXmlDeclWithVersion(int versionStart,
int versionEnd)
|
protected String |
printable(char ch)
|
protected String |
printable(String s)
|
void |
require(int type,
String namespace,
String name)
|
protected char |
requireInput(char ch,
char[] input)
|
protected char |
requireNextS()
|
protected void |
reset()
|
protected void |
resetStringCache()
|
void |
setFeature(String name,
boolean state)
Method setFeature |
void |
setInput(InputStream inputStream,
String inputEncoding)
|
void |
setInput(Reader in)
|
void |
setProperty(String name,
Object value)
|
protected char |
skipS(char ch)
|
void |
skipSubTree()
Skip sub tree that is currently porser positioned on. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String XML_URI
protected static final String XMLNS_URI
protected static final String FEATURE_XML_ROUNDTRIP
protected static final String FEATURE_NAMES_INTERNED
protected static final String PROPERTY_XMLDECL_VERSION
protected static final String PROPERTY_XMLDECL_STANDALONE
protected static final String PROPERTY_XMLDECL_CONTENT
protected static final String PROPERTY_LOCATION
protected static final String REPORT_NAMESPACE_PREFIXES
protected boolean allStringsInterned
NOTE: newStringIntern always returns interned strings and newString MAY return interned String depending on this variable.
NOTE: by default in this minimal implementation it is false!
protected boolean usePC
protected boolean seenStartTag
protected boolean seenEndTag
protected boolean pastEndTag
protected boolean seenAmpersand
protected boolean seenMarkup
protected boolean seenDocdecl
protected boolean tokenize
protected String text
protected String entityRefName
protected String xmlDeclVersion
protected Boolean xmlDeclStandalone
protected String xmlDeclContent
protected boolean processNamespaces
protected boolean roundtripSupported
protected String location
protected int lineNumber
protected int columnNumber
protected boolean seenRoot
protected boolean reachedEnd
protected int eventType
protected boolean emptyElementTag
protected int depth
protected char[][] elRawName
protected int[] elRawNameEnd
protected int[] elRawNameLine
protected String[] elName
protected String[] elPrefix
protected String[] elUri
protected int[] elNamespaceCount
protected static final int READ_CHUNK_SIZE
protected Reader reader
protected String inputEncoding
protected int bufLoadFactor
protected char[] buf
protected int bufSoftLimit
protected boolean preventBufferCompaction
protected int bufAbsoluteStart
protected int bufStart
protected int bufEnd
protected int pos
protected int posStart
protected int posEnd
protected char[] pc
protected int pcStart
protected int pcEnd
protected int attributeCount
protected String[] attributeName
protected int[] attributeNameHash
protected String[] attributePrefix
protected String[] attributeUri
protected String[] attributeValue
protected int namespaceEnd
protected String[] namespacePrefix
protected int[] namespacePrefixHash
protected String[] namespaceUri
protected int entityEnd
protected String[] entityName
protected char[][] entityNameBuf
protected String[] entityReplacement
protected char[][] entityReplacementBuf
protected int[] entityNameHash
protected char[] charRefOneCharBuf
protected static final char[] VERSION
protected static final char[] NCODING
protected static final char[] TANDALONE
protected static final char[] YES
protected static final char[] NO
protected static final int LOOKUP_MAX
protected static final char LOOKUP_MAX_CHAR
protected static boolean[] lookupNameStartChar
protected static boolean[] lookupNameChar
| Constructor Detail |
|---|
public MXParser()
| Method Detail |
|---|
protected void resetStringCache()
protected String newString(char[] cbuf,
int off,
int len)
protected String newStringIntern(char[] cbuf,
int off,
int len)
protected void ensureElementsCapacity()
protected void ensureAttributesCapacity(int size)
protected void ensureNamespacesCapacity(int size)
protected static final int fastHash(char[] ch,
int off,
int len)
protected void ensureEntityCapacity()
protected void reset()
public void setFeature(String name,
boolean state)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
setFeature in interface org.codehaus.plexus.util.xml.pull.XmlPullParsername - a Stringstate - a boolean
org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionpublic boolean getFeature(String name)
getFeature in interface org.codehaus.plexus.util.xml.pull.XmlPullParser
public void setProperty(String name,
Object value)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
setProperty in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserExceptionpublic Object getProperty(String name)
getProperty in interface org.codehaus.plexus.util.xml.pull.XmlPullParser
public void setInput(Reader in)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
setInput in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
public void setInput(InputStream inputStream,
String inputEncoding)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
setInput in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserExceptionpublic String getInputEncoding()
getInputEncoding in interface org.codehaus.plexus.util.xml.pull.XmlPullParser
public void defineEntityReplacementText(String entityName,
String replacementText)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
defineEntityReplacementText in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
public int getNamespaceCount(int depth)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
getNamespaceCount in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
public String getNamespacePrefix(int pos)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
getNamespacePrefix in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
public String getNamespaceUri(int pos)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
getNamespaceUri in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserExceptionpublic String getNamespace(String prefix)
getNamespace in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic int getDepth()
getDepth in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic String getPositionDescription()
getPositionDescription in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic int getLineNumber()
getLineNumber in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic int getColumnNumber()
getColumnNumber in interface org.codehaus.plexus.util.xml.pull.XmlPullParser
public boolean isWhitespace()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
isWhitespace in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserExceptionpublic String getText()
getText in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic char[] getTextCharacters(int[] holderForStartAndLength)
getTextCharacters in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic String getNamespace()
getNamespace in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic String getName()
getName in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic String getPrefix()
getPrefix in interface org.codehaus.plexus.util.xml.pull.XmlPullParser
public boolean isEmptyElementTag()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
isEmptyElementTag in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserExceptionpublic int getAttributeCount()
getAttributeCount in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic String getAttributeNamespace(int index)
getAttributeNamespace in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic String getAttributeName(int index)
getAttributeName in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic String getAttributePrefix(int index)
getAttributePrefix in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic String getAttributeType(int index)
getAttributeType in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic boolean isAttributeDefault(int index)
isAttributeDefault in interface org.codehaus.plexus.util.xml.pull.XmlPullParserpublic String getAttributeValue(int index)
getAttributeValue in interface org.codehaus.plexus.util.xml.pull.XmlPullParser
public String getAttributeValue(String namespace,
String name)
getAttributeValue in interface org.codehaus.plexus.util.xml.pull.XmlPullParser
public int getEventType()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
getEventType in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
public void require(int type,
String namespace,
String name)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
require in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
public void skipSubTree()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
public String nextText()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
nextText in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
public int nextTag()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
nextTag in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
public int next()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
next in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
public int nextToken()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
nextToken in interface org.codehaus.plexus.util.xml.pull.XmlPullParserorg.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected int nextImpl()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected int parseProlog()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected int parseEpilog()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
public int parseEndTag()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
public int parseStartTag()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected char parseAttribute()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected char[] parseEntityRef()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected char[] lookuEntityReplacement(int entitNameLen)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected void parseComment()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected boolean parsePI()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected void parseXmlDecl(char ch)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected void parseXmlDeclWithVersion(int versionStart,
int versionEnd)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected void parseDocdecl()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected void parseCDSect(boolean hadCharData)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected void fillBuf()
throws IOException,
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
protected char more()
throws IOException,
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserExceptionprotected void ensurePC(int end)
protected void joinPC()
protected char requireInput(char ch,
char[] input)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected char requireNextS()
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOException
protected char skipS(char ch)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
IOException
org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOExceptionprotected boolean isNameStartChar(char ch)
protected boolean isNameChar(char ch)
protected boolean isS(char ch)
protected String printable(char ch)
protected String printable(String s)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||