| java.lang.Object net.n3.nanoxml.XMLUtil
XMLUtil | class XMLUtil (Code) | | Utility methods for NanoXML.
author: Marc De Scheemaecker version: $Name$, $Revision: 1421 $ |
Method Summary | |
static boolean | checkLiteral(IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver, String literal) Returns true if the data starts with literal. | static void | errorClosingTagNotEmpty(String systemID, int lineNr) Throws an XMLParseException to indicate that extra data is encountered in a closing tag. | static void | errorExpectedInput(String systemID, int lineNr, String expectedString) Throws an XMLParseException to indicate that an expected string is not encountered. | static void | errorInvalidAttributeValue(String systemID, int lineNr, String elementName, String attributeName, String attributeValue) Throws an XMLValidationException to indicate that an attribute has an invalid value. | static void | errorInvalidEntity(String systemID, int lineNr, String key) Throws an XMLParseException to indicate that an entity could not be resolved. | static void | errorInvalidInput(String systemID, int lineNr, String unexpectedString) Throws an XMLParseException to indicate that a string is not expected at this point. | static void | errorMissingAttribute(String systemID, int lineNr, String elementName, String attributeName) Throws an XMLValidationException to indicate that an attribute is missing. | static void | errorMissingElement(String systemID, int lineNr, String parentElementName, String missingElementName) Throws an XMLValidationException to indicate that an element is missing. | static void | errorMissingPCData(String systemID, int lineNr, String parentElementName) Throws an XMLValidationException to indicate that a #PCDATA element was missing. | static void | errorUnexpectedAttribute(String systemID, int lineNr, String elementName, String attributeName) Throws an XMLValidationException to indicate that an attribute is unexpected. | static void | errorUnexpectedElement(String systemID, int lineNr, String parentElementName, String unexpectedElementName) Throws an XMLValidationException to indicate that an element is unexpected. | static void | errorUnexpectedPCData(String systemID, int lineNr, String parentElementName) Throws an XMLValidationException to indicate that a #PCDATA element was unexpected. | static void | errorWrongClosingTag(String systemID, int lineNr, String expectedName, String wrongName) Throws an XMLParseException to indicate that the closing tag of an element does not match the
opening tag. | static char | read(IXMLReader reader, boolean[] isEntityValue, char escapeChar, IXMLEntityResolver entityResolver) Reads a character from the reader. | static Reader | scanEntity(boolean[] isCharLiteral, IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) Processes an entity. | static String | scanIdentifier(IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) Retrieves an identifier from the data. | static String | scanPublicID(StringBuffer publicID, IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) Scans a public ID. | static String | scanString(IXMLReader reader, char escapeChar, boolean normalizeWhitespace, IXMLEntityResolver entityResolver) Retrieves a delimited string from the data. | static String | scanSystemID(IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) Scans a system ID. | static void | skipComment(IXMLReader reader, IXMLEntityResolver entityResolver) Skips the remainder of a comment. | static void | skipTag(IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) Skips the remainder of the current XML tag. | static void | skipWhitespace(IXMLReader reader, char escapeChar, StringBuffer buffer, boolean[] isEntity) Skips whitespace from the reader. | static void | validationError(String systemID, int lineNr, String message, String elementName, String attributeName, String attributeValue) Throws an XMLValidationException. |
checkLiteral | static boolean checkLiteral(IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver, String literal) throws IOException, XMLParseException(Code) | | Returns true if the data starts with literal. Enough chars are read to determine this
result.
Parameters: reader - the reader Parameters: escapeChar - the escape character (& or %) Parameters: entityResolver - the entity resolver Parameters: literal - the literal to check throws: java.io.IOException - if an error occurred reading the data |
errorClosingTagNotEmpty | static void errorClosingTagNotEmpty(String systemID, int lineNr) throws XMLParseException(Code) | | Throws an XMLParseException to indicate that extra data is encountered in a closing tag.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. |
errorExpectedInput | static void errorExpectedInput(String systemID, int lineNr, String expectedString) throws XMLParseException(Code) | | Throws an XMLParseException to indicate that an expected string is not encountered.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: expectedString - the string that is expected |
errorInvalidAttributeValue | static void errorInvalidAttributeValue(String systemID, int lineNr, String elementName, String attributeName, String attributeValue) throws XMLValidationException(Code) | | Throws an XMLValidationException to indicate that an attribute has an invalid value.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: elementName - the name of the offending element Parameters: attributeName - the name of the offending attribute Parameters: attributeValue - the value of the offending attribute |
errorInvalidEntity | static void errorInvalidEntity(String systemID, int lineNr, String key) throws XMLParseException(Code) | | Throws an XMLParseException to indicate that an entity could not be resolved.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: key - the name of the entity |
errorInvalidInput | static void errorInvalidInput(String systemID, int lineNr, String unexpectedString) throws XMLParseException(Code) | | Throws an XMLParseException to indicate that a string is not expected at this point.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: unexpectedString - the string that is unexpected |
errorMissingAttribute | static void errorMissingAttribute(String systemID, int lineNr, String elementName, String attributeName) throws XMLValidationException(Code) | | Throws an XMLValidationException to indicate that an attribute is missing.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: elementName - the name of the offending element Parameters: attributeName - the name of the offending attribute |
errorMissingElement | static void errorMissingElement(String systemID, int lineNr, String parentElementName, String missingElementName) throws XMLValidationException(Code) | | Throws an XMLValidationException to indicate that an element is missing.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: parentElementName - the name of the offending element Parameters: missingElementName - the name of the offending attribute |
errorMissingPCData | static void errorMissingPCData(String systemID, int lineNr, String parentElementName) throws XMLValidationException(Code) | | Throws an XMLValidationException to indicate that a #PCDATA element was missing.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: parentElementName - the name of the offending element |
errorUnexpectedAttribute | static void errorUnexpectedAttribute(String systemID, int lineNr, String elementName, String attributeName) throws XMLValidationException(Code) | | Throws an XMLValidationException to indicate that an attribute is unexpected.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: elementName - the name of the offending element Parameters: attributeName - the name of the offending attribute |
errorUnexpectedElement | static void errorUnexpectedElement(String systemID, int lineNr, String parentElementName, String unexpectedElementName) throws XMLValidationException(Code) | | Throws an XMLValidationException to indicate that an element is unexpected.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: parentElementName - the name of the parent attribute Parameters: unexpectedElementName - the name of the offending attribute |
errorUnexpectedPCData | static void errorUnexpectedPCData(String systemID, int lineNr, String parentElementName) throws XMLValidationException(Code) | | Throws an XMLValidationException to indicate that a #PCDATA element was unexpected.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: parentElementName - the name of the offending element |
errorWrongClosingTag | static void errorWrongClosingTag(String systemID, int lineNr, String expectedName, String wrongName) throws XMLParseException(Code) | | Throws an XMLParseException to indicate that the closing tag of an element does not match the
opening tag.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: expectedName - the name of the opening tag Parameters: wrongName - the name of the closing tag |
read | static char read(IXMLReader reader, boolean[] isEntityValue, char escapeChar, IXMLEntityResolver entityResolver) throws IOException, XMLParseException(Code) | | Reads a character from the reader.
Parameters: reader - the reader Parameters: isEntityValue - if the character is the first character in an entity Parameters: escapeChar - the escape character (& or %) Parameters: entityResolver - the entity resolver throws: java.io.IOException - if an error occurred reading the data |
scanEntity | static Reader scanEntity(boolean[] isCharLiteral, IXMLReader reader, char escapeChar, IXMLEntityResolver entityResolver) throws IOException, XMLParseException(Code) | | Processes an entity.
Parameters: isCharLiteral - will contain true if the entity is a char literal Parameters: reader - the reader Parameters: escapeChar - the escape character (& or %) Parameters: entityResolver - the entity resolver a reader from which the entity value can be retrieved throws: java.io.IOException - if an error occurred reading the data |
scanString | static String scanString(IXMLReader reader, char escapeChar, boolean normalizeWhitespace, IXMLEntityResolver entityResolver) throws IOException, XMLParseException(Code) | | Retrieves a delimited string from the data.
Parameters: reader - the reader Parameters: escapeChar - the escape character (& or %) Parameters: normalizeWhitespace - if all whitespace chars need to be converted to spaces Parameters: entityResolver - the entity resolver throws: java.io.IOException - if an error occurred reading the data |
skipWhitespace | static void skipWhitespace(IXMLReader reader, char escapeChar, StringBuffer buffer, boolean[] isEntity) throws IOException(Code) | | Skips whitespace from the reader.
Parameters: reader - the reader Parameters: escapeChar - the escape character (& or %) Parameters: buffer - where to put the whitespace; null if the whitespace does not have to be stored. Parameters: isEntity - if not null, will contain true if the data following the whitespace is anentity throws: java.io.IOException - if an error occurred reading the data |
validationError | static void validationError(String systemID, int lineNr, String message, String elementName, String attributeName, String attributeValue) throws XMLValidationException(Code) | | Throws an XMLValidationException.
Parameters: systemID - the system ID from where the data came Parameters: lineNr - the line number in the XML data where the exception occurred. Parameters: message - the message of the exception. Parameters: elementName - the name of the offending element Parameters: attributeName - the name of the offending attribute Parameters: attributeValue - the value of the offending attribute |
|
|