Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1349 → Rev 1350

/xmlparser_java/branches/001_buffer_move/XmlParser.java
1,6 → 1,6
/*
* input 2072160977 bytes; AMD Athlon 3100+, disk speed 38.0 MB/s
* 49.18s user 10.07s system 89% cpu 1:06.32 total; RES 9384K (empty java - 8200K)
* 47.92s user 10.40s system 91% cpu 1:03.57 total; RES 9372K (empty java - 8200K)
*/
import java.io.*;
 
209,8 → 209,8
//log("parseDecl begin " + bufPos);
// begin
if(!testChar('<', bufPos) || !testChar('?', bufPos) || !testChar('x', bufPos)
|| !testChar('m', bufPos) || !testChar('l', bufPos))
if(!testChar('<') || !testChar('?') || !testChar('x')
|| !testChar('m') || !testChar('l'))
{
//log("parseDecl no 'xml' " + bufPos);
return false;
225,7 → 225,7
}
 
// end
if(!testChar('?', bufPos) || !testChar('>', bufPos)) {
if(!testChar('?') || !testChar('>')) {
throwException("end of XML declaration expected");
}
283,7 → 283,7
return true;
}
 
private boolean testChar(char c, int rollback)
private boolean testChar(char c)
throws XmlException, IOException
{
if(bufPos >= bufLen && !ensureNext(1)) {
291,7 → 291,6
}
if(buf[bufPos] != c) {
bufPos = rollback;
return false;
}
else {
312,7 → 311,7
// eq
skipSpaces();
if(!testChar('=', bufPos)) {
if(!testChar('=')) {
throwException("equal sign expected");
}
skipSpaces();
320,7 → 319,7
// FIXME allow 'Reference' here
// value
if(!testChar('"', bufPos)) {
if(!testChar('"')) {
throwException("quoted string expected");
}
337,7 → 336,7
}
saveSelEnd(selValue);
if(!testChar('"', bufPos)) {
if(!testChar('"')) {
throwException("end of quoted string expected");
}
459,7 → 458,7
int start = bufPos;
 
// begin
if(!testChar('<', bufPos)) {
if(!testChar('<')) {
//log("parseStartTag no signature " + bufPos);
return false;
}
484,8 → 483,8
//System.out.println();
// end
element.isEmpty = testChar('/', bufPos);
if(!testChar('>', bufPos)) {
element.isEmpty = testChar('/');
if(!testChar('>')) {
throwException("end of tag expected");
}
498,7 → 497,7
{
//log("parseEndTag begin " + bufPos);
// begin
if(!testChar('<', bufPos) || !testChar('/', bufPos)) {
if(!testChar('<') || !testChar('/')) {
throwException("cannot find tag end");
}
511,7 → 510,7
skipSpaces();
// end
if(!testChar('>', bufPos)) {
if(!testChar('>')) {
throwException("end of tag expected");
}