|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.n3.nanoxml.XMLUtil
class XMLUtil
Utility methods for NanoXML.
Constructor Summary | |
---|---|
XMLUtil()
|
Method Summary | |
---|---|
(package private) static boolean |
checkLiteral(IXMLReader reader,
char escapeChar,
IXMLEntityResolver entityResolver,
java.lang.String literal)
Returns true if the data starts with literal. |
(package private) static void |
errorClosingTagNotEmpty(java.lang.String systemID,
int lineNr)
Throws an XMLParseException to indicate that extra data is encountered in a closing tag. |
(package private) static void |
errorExpectedInput(java.lang.String systemID,
int lineNr,
java.lang.String expectedString)
Throws an XMLParseException to indicate that an expected string is not encountered. |
(package private) static void |
errorInvalidAttributeValue(java.lang.String systemID,
int lineNr,
java.lang.String elementName,
java.lang.String attributeName,
java.lang.String attributeValue)
Throws an XMLValidationException to indicate that an attribute has an invalid value. |
(package private) static void |
errorInvalidEntity(java.lang.String systemID,
int lineNr,
java.lang.String key)
Throws an XMLParseException to indicate that an entity could not be resolved. |
(package private) static void |
errorInvalidInput(java.lang.String systemID,
int lineNr,
java.lang.String unexpectedString)
Throws an XMLParseException to indicate that a string is not expected at this point. |
(package private) static void |
errorMissingAttribute(java.lang.String systemID,
int lineNr,
java.lang.String elementName,
java.lang.String attributeName)
Throws an XMLValidationException to indicate that an attribute is missing. |
(package private) static void |
errorMissingElement(java.lang.String systemID,
int lineNr,
java.lang.String parentElementName,
java.lang.String missingElementName)
Throws an XMLValidationException to indicate that an element is missing. |
(package private) static void |
errorMissingPCData(java.lang.String systemID,
int lineNr,
java.lang.String parentElementName)
Throws an XMLValidationException to indicate that a #PCDATA element was missing. |
(package private) static void |
errorUnexpectedAttribute(java.lang.String systemID,
int lineNr,
java.lang.String elementName,
java.lang.String attributeName)
Throws an XMLValidationException to indicate that an attribute is unexpected. |
(package private) static void |
errorUnexpectedElement(java.lang.String systemID,
int lineNr,
java.lang.String parentElementName,
java.lang.String unexpectedElementName)
Throws an XMLValidationException to indicate that an element is unexpected. |
(package private) static void |
errorUnexpectedPCData(java.lang.String systemID,
int lineNr,
java.lang.String parentElementName)
Throws an XMLValidationException to indicate that a #PCDATA element was unexpected. |
(package private) static void |
errorWrongClosingTag(java.lang.String systemID,
int lineNr,
java.lang.String expectedName,
java.lang.String wrongName)
Throws an XMLParseException to indicate that the closing tag of an element does not match the opening tag. |
(package private) static char |
read(IXMLReader reader,
boolean[] isEntityValue,
char escapeChar,
IXMLEntityResolver entityResolver)
Reads a character from the reader. |
(package private) static java.io.Reader |
scanEntity(boolean[] isCharLiteral,
IXMLReader reader,
char escapeChar,
IXMLEntityResolver entityResolver)
Processes an entity. |
(package private) static java.lang.String |
scanIdentifier(IXMLReader reader,
char escapeChar,
IXMLEntityResolver entityResolver)
Retrieves an identifier from the data. |
(package private) static java.lang.String |
scanPublicID(java.lang.StringBuffer publicID,
IXMLReader reader,
char escapeChar,
IXMLEntityResolver entityResolver)
Scans a public ID. |
(package private) static java.lang.String |
scanString(IXMLReader reader,
char escapeChar,
boolean normalizeWhitespace,
IXMLEntityResolver entityResolver)
Retrieves a delimited string from the data. |
(package private) static java.lang.String |
scanSystemID(IXMLReader reader,
char escapeChar,
IXMLEntityResolver entityResolver)
Scans a system ID. |
(package private) static void |
skipComment(IXMLReader reader,
IXMLEntityResolver entityResolver)
Skips the remainder of a comment. |
(package private) static void |
skipTag(IXMLReader reader,
char escapeChar,
IXMLEntityResolver entityResolver)
Skips the remainder of the current XML tag. |
(package private) static void |
skipWhitespace(IXMLReader reader,
char escapeChar,
java.lang.StringBuffer buffer,
boolean[] isEntity)
Skips whitespace from the reader. |
(package private) static void |
validationError(java.lang.String systemID,
int lineNr,
java.lang.String message,
java.lang.String elementName,
java.lang.String attributeName,
java.lang.String attributeValue)
Throws an XMLValidationException. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
XMLUtil()
Method Detail |
---|
static void skipComment(IXMLReader reader, IXMLEntityResolver entityResolver) throws java.io.IOException, XMLParseException
reader
- the readerentityResolver
- the entity resolver
java.io.IOException
- if an error occurred reading the data
XMLParseException
static void skipTag(IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) throws java.io.IOException, XMLParseException
reader
- the readerescapeChar
- the escape character (& or %)entityResolver
- the entity resolver
java.io.IOException
- if an error occurred reading the data
XMLParseException
static java.lang.String scanPublicID(java.lang.StringBuffer publicID, IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) throws java.io.IOException, XMLParseException
publicID
- will contain the public IDreader
- the readerescapeChar
- the escape character (& or %)entityResolver
- the entity resolver
java.io.IOException
- if an error occurred reading the data
XMLParseException
static java.lang.String scanSystemID(IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) throws java.io.IOException, XMLParseException
reader
- the readerescapeChar
- the escape character (& or %)entityResolver
- the entity resolver
java.io.IOException
- if an error occurred reading the data
XMLParseException
static java.lang.String scanIdentifier(IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) throws java.io.IOException, XMLParseException
reader
- the readerescapeChar
- the escape character (& or %)entityResolver
- the entity resolver
java.io.IOException
- if an error occurred reading the data
XMLParseException
static java.lang.String scanString(IXMLReader reader, char escapeChar, boolean normalizeWhitespace, IXMLEntityResolver entityResolver) throws java.io.IOException, XMLParseException
reader
- the readerescapeChar
- the escape character (& or %)normalizeWhitespace
- if all whitespace chars need to be converted to spacesentityResolver
- the entity resolver
java.io.IOException
- if an error occurred reading the data
XMLParseException
static java.io.Reader scanEntity(boolean[] isCharLiteral, IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) throws java.io.IOException, XMLParseException
isCharLiteral
- will contain true if the entity is a char literalreader
- the readerescapeChar
- the escape character (& or %)entityResolver
- the entity resolver
java.io.IOException
- if an error occurred reading the data
XMLParseException
static void skipWhitespace(IXMLReader reader, char escapeChar, java.lang.StringBuffer buffer, boolean[] isEntity) throws java.io.IOException
reader
- the readerescapeChar
- the escape character (& or %)buffer
- where to put the whitespace; null if the whitespace does not have to be stored.isEntity
- if not null, will contain true if the data following the whitespace is an
entity
java.io.IOException
- if an error occurred reading the datastatic char read(IXMLReader reader, boolean[] isEntityValue, char escapeChar, IXMLEntityResolver entityResolver) throws java.io.IOException, XMLParseException
reader
- the readerisEntityValue
- if the character is the first character in an entityescapeChar
- the escape character (& or %)entityResolver
- the entity resolver
java.io.IOException
- if an error occurred reading the data
XMLParseException
static boolean checkLiteral(IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver, java.lang.String literal) throws java.io.IOException, XMLParseException
reader
- the readerescapeChar
- the escape character (& or %)entityResolver
- the entity resolverliteral
- the literal to check
java.io.IOException
- if an error occurred reading the data
XMLParseException
static void errorExpectedInput(java.lang.String systemID, int lineNr, java.lang.String expectedString) throws XMLParseException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.expectedString
- the string that is expected
XMLParseException
static void errorInvalidEntity(java.lang.String systemID, int lineNr, java.lang.String key) throws XMLParseException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.key
- the name of the entity
XMLParseException
static void errorInvalidInput(java.lang.String systemID, int lineNr, java.lang.String unexpectedString) throws XMLParseException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.unexpectedString
- the string that is unexpected
XMLParseException
static void errorWrongClosingTag(java.lang.String systemID, int lineNr, java.lang.String expectedName, java.lang.String wrongName) throws XMLParseException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.expectedName
- the name of the opening tagwrongName
- the name of the closing tag
XMLParseException
static void errorClosingTagNotEmpty(java.lang.String systemID, int lineNr) throws XMLParseException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.
XMLParseException
static void errorMissingElement(java.lang.String systemID, int lineNr, java.lang.String parentElementName, java.lang.String missingElementName) throws XMLValidationException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.parentElementName
- the name of the offending elementmissingElementName
- the name of the offending attribute
XMLValidationException
static void errorUnexpectedElement(java.lang.String systemID, int lineNr, java.lang.String parentElementName, java.lang.String unexpectedElementName) throws XMLValidationException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.parentElementName
- the name of the parent attributeunexpectedElementName
- the name of the offending attribute
XMLValidationException
static void errorMissingAttribute(java.lang.String systemID, int lineNr, java.lang.String elementName, java.lang.String attributeName) throws XMLValidationException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.elementName
- the name of the offending elementattributeName
- the name of the offending attribute
XMLValidationException
static void errorUnexpectedAttribute(java.lang.String systemID, int lineNr, java.lang.String elementName, java.lang.String attributeName) throws XMLValidationException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.elementName
- the name of the offending elementattributeName
- the name of the offending attribute
XMLValidationException
static void errorInvalidAttributeValue(java.lang.String systemID, int lineNr, java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue) throws XMLValidationException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.elementName
- the name of the offending elementattributeName
- the name of the offending attributeattributeValue
- the value of the offending attribute
XMLValidationException
static void errorMissingPCData(java.lang.String systemID, int lineNr, java.lang.String parentElementName) throws XMLValidationException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.parentElementName
- the name of the offending element
XMLValidationException
static void errorUnexpectedPCData(java.lang.String systemID, int lineNr, java.lang.String parentElementName) throws XMLValidationException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.parentElementName
- the name of the offending element
XMLValidationException
static void validationError(java.lang.String systemID, int lineNr, java.lang.String message, java.lang.String elementName, java.lang.String attributeName, java.lang.String attributeValue) throws XMLValidationException
systemID
- the system ID from where the data camelineNr
- the line number in the XML data where the exception occurred.message
- the message of the exception.elementName
- the name of the offending elementattributeName
- the name of the offending attributeattributeValue
- the value of the offending attribute
XMLValidationException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |