Java Reference
In-Depth Information
// Find the tag name
while (this.source.peek() != -1)
{
if (Character.isWhitespace((char) this.source.peek())
|| (this.source.peek() == '>'))
{
break;
}
tagName.append((char) this.source.read());
}
eatWhitespace();
this.tag.setName(tagName.toString());
// get the attributes
while ((this.source.peek() != '>') &&
(this.source.peek() != -1))
{
String attributeName = parseAttributeName();
String attributeValue = null;
if (attributeName.equals("/"))
{
eatWhitespace();
if (this.source.peek() == '>')
{
this.tag.setEnding(true);
break;
}
}
// is there a value?
eatWhitespace();
if (this.source.peek() == '=')
{
this.source.read();
attributeValue = parseString();
}
this.tag.setAttribute(attributeName, attributeValue);
}
this.source.read();
}
}
Search WWH ::




Custom Search