Package hu.jokeman.xparser.parser

Examples of hu.jokeman.xparser.parser.ParserException


  public ParserState process (int ch) throws ParserException {
        char c = (char) ch;
        DocumentBuilder builder = getDocumentBuilder ();
       
    if (_isShort && c != '>') {
      throw new ParserException ("Invalid short tag.");
    }
       
    if (XMLCharacterSet.isNameChar (c)) {
      if (_isAdded) {
        return new AttributeState (builder, this, ch);
      }
      _name.append (c);
            return this;
    }
       
        if (XMLCharacterSet.isWhiteSpace (c)) {
      if (!_isAdded) {
        builder.createTagStart (_name.toString ());
        _isAdded = true;
      }
      return this;
    }
       
        if (c == '/') {
      _isShort = true;
      return this;
    }
       
        if (c == '>') {
      if (!_isAdded) {
        builder.createTagStart (_name.toString ());
      }
      builder.finishTagStart ();
      if (_isShort) {
        builder.addTagClose (_name.toString ());
      }
      return new NormalState (builder);
    }
   
    throw new ParserException ("Illegal character '" + c + "'.");
  }
View Full Code Here


        if (ch == ';') {
            getDocumentBuilder ().addEntityReference (_name.toString ());
            return getPreviousState ();
        }
       
        throw new ParserException ("Invalid entity name character: '" +
                (char) ch + "'.");
    }
View Full Code Here

    public ParserState process (int ch) throws ParserException {
        char c = (char) ch;

        if (XMLCharacterSet.isNameChar (c)) {
            if (_isClosed) {
                throw new ParserException ("Dirt detected '" + c + "'");
            }
            _name.append (c);
            return this;
        }

        if (XMLCharacterSet.isWhiteSpace (c)) {
            _isClosed = true;
            return this;
        }

        if (ch == '>') {
            getDocumentBuilder ().addTagClose (_name.toString ());
            return new NormalState (getDocumentBuilder ());
        }

        throw new ParserException ("Invalid character '" + c + "'.");
    }
View Full Code Here

      return new ElementClosingState (getDocumentBuilder ());
    default:
            if (XMLCharacterSet.isNameChar (ch)) {
        return new ElementState (getDocumentBuilder (), this, ch);
      }
      throw new ParserException ("Invalid element name character: " +
          (char) ch);
    }
  }
View Full Code Here

        if (ch == '>') {
            if (_isClosed) {
                getDocumentBuilder ().finishProcessingInstructionStart ();
                return new NormalState (getDocumentBuilder ());
            }
            throw new ParserException (
                    "Processing Instruction not closed with '?'.");
        }
        throw new ParserException ("Illegal character: " + (char) ch);
    }
View Full Code Here

                _quotMode = ch == '"';
                _aposMode = ch == '\'';
                _eqMode = false;
                return this;
            }
            throw new ParserException ("Illegal character");
        }

        if (_eqMode) {
            throw new ParserException ("Values must start with \" or '");
        }

        if (XMLCharacterSet.isWhiteSpace (ch)) {
            return this;
        }

        if (XMLCharacterSet.isNameChar (ch)) {
            _name.append ((char) ch);
            return this;
        }

        if (ch == '=') {
            _eqMode = true;
            return this;
        }

        throw new ParserException ("Illegal character");
    }
View Full Code Here

TOP

Related Classes of hu.jokeman.xparser.parser.ParserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.