XML11DTDScannerImplpublic class XML11DTDScannerImpl extends XMLDTDScannerImpl This class is responsible for scanning the declarations found
in the internal and external subsets of a DTD in an XML document.
The scanner acts as the sources for the DTD information which is
communicated to the DTD handlers.
This component requires the following features and properties from the
component manager that uses it:
- http://xml.org/sax/features/validation
- http://apache.org/xml/features/scanner/notify-char-refs
- http://apache.org/xml/properties/internal/symbol-table
- http://apache.org/xml/properties/internal/error-reporter
- http://apache.org/xml/properties/internal/entity-manager
|
Fields Summary |
---|
private String[] | fStringsArray of 3 strings. | private XMLString | fStringString. | private XMLStringBuffer | fStringBufferString buffer. | private XMLStringBuffer | fStringBuffer2String buffer. | private XMLStringBuffer | fStringBuffer3 |
Constructors Summary |
---|
public XML11DTDScannerImpl()Default constructor.
//
// Constructors
//
super();
| public XML11DTDScannerImpl(SymbolTable symbolTable, XMLErrorReporter errorReporter, XMLEntityManager entityManager)Constructor for he use of non-XMLComponentManagers.
super(symbolTable, errorReporter, entityManager);
|
Methods Summary |
---|
protected java.lang.String | getVersionNotSupportedKey()
return "VersionNotSupported11";
| protected boolean | isInvalid(int value)
return (!XML11Char.isXML11Valid(value));
| protected boolean | isInvalidLiteral(int value)
return (!XML11Char.isXML11ValidLiteral(value));
| protected boolean | isValidNCName(int value)
return (XML11Char.isXML11NCName(value));
| protected boolean | isValidNameChar(int value)
return (XML11Char.isXML11Name(value));
| protected boolean | isValidNameStartChar(int value)
return (XML11Char.isXML11NameStart(value));
| protected boolean | isValidNameStartHighSurrogate(int value)
return XML11Char.isXML11NameHighSurrogate(value);
| protected void | normalizeWhitespace(com.sun.org.apache.xerces.internal.xni.XMLString value)Normalize whitespace in an XMLString converting all whitespace
characters to space characters.
int end = value.offset + value.length;
for (int i = value.offset; i < end; i++) {
int c = value.ch[i];
if (XMLChar.isSpace(c)) {
value.ch[i] = ' ";
}
}
| protected boolean | scanPubidLiteral(com.sun.org.apache.xerces.internal.xni.XMLString literal)Scans public ID literal.
[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
[13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
The returned string is normalized according to the following rule,
from http://www.w3.org/TR/REC-xml#dt-pubid:
Before a match is attempted, all strings of white space in the public
identifier must be normalized to single space characters (#x20), and
leading and trailing white space must be removed.
int quote = fEntityScanner.scanChar();
if (quote != '\'" && quote != '"") {
reportFatalError("QuoteRequiredInPublicID", null);
return false;
}
fStringBuffer.clear();
// skip leading whitespace
boolean skipSpace = true;
boolean dataok = true;
while (true) {
int c = fEntityScanner.scanChar();
// REVISIT: it could really only be \n or 0x20; all else is normalized, no? - neilg
if (c == ' " || c == '\n" || c == '\r" || c == 0x85 || c == 0x2028) {
if (!skipSpace) {
// take the first whitespace as a space and skip the others
fStringBuffer.append(' ");
skipSpace = true;
}
}
else if (c == quote) {
if (skipSpace) {
// if we finished on a space let's trim it
fStringBuffer.length--;
}
literal.setValues(fStringBuffer);
break;
}
else if (XMLChar.isPubid(c)) {
fStringBuffer.append((char)c);
skipSpace = false;
}
else if (c == -1) {
reportFatalError("PublicIDUnterminated", null);
return false;
}
else {
dataok = false;
reportFatalError("InvalidCharInPublicID",
new Object[]{Integer.toHexString(c)});
}
}
return dataok;
| protected boolean | versionSupported(java.lang.String version)
return version.equals("1.1") || version.equals ("1.0");
|
|