bool XmlStreamParser::isAtEndOf(QString qName) const
{
    if (atEnd() || !_reader->isEndElement()) {
        return false;
    }
    return isAtElement(qName);
}
Esempio n. 2
0
String HtmlScraper::getElementName()
{
	jassert(isAtElement());

	int endpos = _html.indexOfAnyOf(" >", _position + 1);
	if(endpos < 0)
		return String::empty;

	String name = _html.substring(_position + 1, endpos);
	return name.trimCharactersAtEnd(" />");
}
Esempio n. 3
0
String HtmlScraper::getElementContents()
{
	jassert(isAtElement());

	// Locate start of content
	int startpos = _html.indexOfChar(_position + 1, '>');
	if(startpos < 0)
		return String::empty;

	startpos++;		// Skip left bracket

	// Locate end tag position
	String name = getElementName();
	int endpos = _html.indexOfIgnoreCase(startpos, "</" + name + ">");
	if(endpos < 0)
		return String::empty;

	return _html.substring(startpos, endpos);
}
Esempio n. 4
0
String HtmlScraper::getAttribute( const String & attributeName )
{
	jassert(isAtElement());

	int endpos = _html.indexOf(_position + 1, ">");
	if(endpos < 0)
		return String::empty;

	int pos = _html.indexOf(_position + 1, attributeName + "=");
	if(pos < 0 || pos > endpos)
		return String::empty;

	int attributeStartPos = pos + attributeName.length() + 1;
	int attributeEndPos = _html.indexOfAnyOf(" >\"", attributeStartPos + 1);
	if(attributeEndPos < 0)
		return String::empty;

	String value = _html.substring(attributeStartPos, attributeEndPos).trimCharactersAtEnd(" >");
	return value.unquoted();
}