/** * Read an end tag. * * <p>The resulting token will contain the '</' and '>' plus the * name plus any whitespace between those three. */ protected void parseEndElement (Token token) { token.setType (Type.END_ELEMENT); skipWhiteSpace (); parseName ("end tag"); skipWhiteSpace (); expect ('>'); }
/** Read the name of an element. * * <p>The resulting token will contain the '<' plus any whitespace between * it and the name plus the name itself but no whitespace after the name. */ protected void parseBeginElement (Token token) { token.setType (Type.BEGIN_ELEMENT); inStartElement = true; skipWhiteSpace (); int nameStartOffset = pos; parseName ("start tag"); if (pos == nameStartOffset) throw new XMLParseException ("Missing element name", token); if (pos >= source.length ()) throw new XMLParseException ("Missing '>' of start tag", source, pos); char c = source.charAt (pos); if (!charValidator.isWhitespace (c) && c != '/' && c != '>') throw new XMLParseException ("Expected whitespace, '>' or '/>' after element name", source, pos); }
throw new XMLParseException ("Expected attribute name", source, pos); skipWhiteSpace (); expect ('='); skipWhiteSpace ();
if (inStartElement) skipWhiteSpace ();