in batik-transcoder/src/main/java/org/apache/batik/transcoder/svg2svg/PrettyPrinter.java [285:497]
protected void printXMLDecl()
throws TranscoderException,
XMLException,
IOException {
if (xmlDeclaration == null) {
if (type == LexicalUnits.XML_DECL_START) {
if (scanner.next() != LexicalUnits.S) {
throw fatalError("space", null);
}
char[] space1 = getCurrentValue();
if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) {
throw fatalError("token", new Object[] { "version" });
}
type = scanner.next();
char[] space2 = null;
if (type == LexicalUnits.S) {
space2 = getCurrentValue();
type = scanner.next();
}
if (type != LexicalUnits.EQ) {
throw fatalError("token", new Object[] { "=" });
}
type = scanner.next();
char[] space3 = null;
if (type == LexicalUnits.S) {
space3 = getCurrentValue();
type = scanner.next();
}
if (type != LexicalUnits.STRING) {
throw fatalError("string", null);
}
char[] version = getCurrentValue();
char versionDelim = scanner.getStringDelimiter();
char[] space4 = null;
char[] space5 = null;
char[] space6 = null;
char[] encoding = null;
char encodingDelim = 0;
char[] space7 = null;
char[] space8 = null;
char[] space9 = null;
char[] standalone = null;
char standaloneDelim = 0;
char[] space10 = null;
type = scanner.next();
if (type == LexicalUnits.S) {
space4 = getCurrentValue();
type = scanner.next();
if (type == LexicalUnits.ENCODING_IDENTIFIER) {
type = scanner.next();
if (type == LexicalUnits.S) {
space5 = getCurrentValue();
type = scanner.next();
}
if (type != LexicalUnits.EQ) {
throw fatalError("token", new Object[] { "=" });
}
type = scanner.next();
if (type == LexicalUnits.S) {
space6 = getCurrentValue();
type = scanner.next();
}
if (type != LexicalUnits.STRING) {
throw fatalError("string", null);
}
encoding = getCurrentValue();
encodingDelim = scanner.getStringDelimiter();
type = scanner.next();
if (type == LexicalUnits.S) {
space7 = getCurrentValue();
type = scanner.next();
}
}
if (type == LexicalUnits.STANDALONE_IDENTIFIER) {
type = scanner.next();
if (type == LexicalUnits.S) {
space8 = getCurrentValue();
type = scanner.next();
}
if (type != LexicalUnits.EQ) {
throw fatalError("token", new Object[] { "=" });
}
type = scanner.next();
if (type == LexicalUnits.S) {
space9 = getCurrentValue();
type = scanner.next();
}
if (type != LexicalUnits.STRING) {
throw fatalError("string", null);
}
standalone = getCurrentValue();
standaloneDelim = scanner.getStringDelimiter();
type = scanner.next();
if (type == LexicalUnits.S) {
space10 = getCurrentValue();
type = scanner.next();
}
}
}
if (type != LexicalUnits.PI_END) {
throw fatalError("pi.end", null);
}
output.printXMLDecl(space1, space2, space3,
version, versionDelim,
space4, space5, space6,
encoding, encodingDelim,
space7, space8, space9,
standalone, standaloneDelim,
space10);
type = scanner.next();
}
} else {
output.printString(xmlDeclaration);
output.printNewline();
if (type == LexicalUnits.XML_DECL_START) {
// Skip the XML declaraction.
if (scanner.next() != LexicalUnits.S) {
throw fatalError("space", null);
}
if (scanner.next() != LexicalUnits.VERSION_IDENTIFIER) {
throw fatalError("token", new Object[] { "version" });
}
type = scanner.next();
if (type == LexicalUnits.S) {
type = scanner.next();
}
if (type != LexicalUnits.EQ) {
throw fatalError("token", new Object[] { "=" });
}
type = scanner.next();
if (type == LexicalUnits.S) {
type = scanner.next();
}
if (type != LexicalUnits.STRING) {
throw fatalError("string", null);
}
type = scanner.next();
if (type == LexicalUnits.S) {
type = scanner.next();
if (type == LexicalUnits.ENCODING_IDENTIFIER) {
type = scanner.next();
if (type == LexicalUnits.S) {
type = scanner.next();
}
if (type != LexicalUnits.EQ) {
throw fatalError("token", new Object[] { "=" });
}
type = scanner.next();
if (type == LexicalUnits.S) {
type = scanner.next();
}
if (type != LexicalUnits.STRING) {
throw fatalError("string", null);
}
type = scanner.next();
if (type == LexicalUnits.S) {
type = scanner.next();
}
}
if (type == LexicalUnits.STANDALONE_IDENTIFIER) {
type = scanner.next();
if (type == LexicalUnits.S) {
type = scanner.next();
}
if (type != LexicalUnits.EQ) {
throw fatalError("token", new Object[] { "=" });
}
type = scanner.next();
if (type == LexicalUnits.S) {
type = scanner.next();
}
if (type != LexicalUnits.STRING) {
throw fatalError("string", null);
}
type = scanner.next();
if (type == LexicalUnits.S) {
type = scanner.next();
}
}
}
if (type != LexicalUnits.PI_END) {
throw fatalError("pi.end", null);
}
type = scanner.next();
}
}
}