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:
| Method from org.apache.xerces.impl.XML11DTDScannerImpl Detail: |
protected String getVersionNotSupportedKey() {
return "VersionNotSupported11";
}
|
protected boolean isInvalid(int value) {
return (!XML11Char.isXML11Valid(value));
}
|
protected boolean isInvalidLiteral(int value) {
return (!XML11Char.isXML11ValidLiteral(value));
}
|
protected int isUnchangedByNormalization(XMLString value) {
int end = value.offset + value.length;
for (int i = value.offset; i < end; ++i) {
int c = value.ch[i];
if (XMLChar.isSpace(c)) {
return i - value.offset;
}
}
return -1;
}
Checks whether this string would be unchanged by normalization. |
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(XMLString value) {
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] = ' ";
}
}
}
Normalize whitespace in an XMLString converting all whitespace
characters to space characters. |
protected void normalizeWhitespace(XMLString value,
int fromIndex) {
int end = value.offset + value.length;
for (int i = value.offset + fromIndex; i < end; ++i) {
int c = value.ch[i];
if (XMLChar.isSpace(c)) {
value.ch[i] = ' ";
}
}
}
Normalize whitespace in an XMLString converting all whitespace
characters to space characters. |
protected boolean scanPubidLiteral(XMLString literal) throws IOException, XNIException {
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;
}
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. |
protected boolean versionSupported(String version) {
return version.equals("1.1") || version.equals ("1.0");
}
|