Java 类org.jivesoftware.smack.packet.NamedElement 实例源码

项目:Smack    文件:AbstractHttpOverXmppProvider.java   
private AbstractHttpOverXmpp.Data parseData(XmlPullParser parser) throws XmlPullParserException, IOException {
    NamedElement child = null;
    boolean done = false;

    while (!done) {
        int eventType = parser.next();

        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals(ELEMENT_TEXT)) {
                child = parseText(parser);
            } else if (parser.getName().equals(ELEMENT_BASE_64)) {
                child = parseBase64(parser);
            } else if (parser.getName().equals(ELEMENT_CHUNKED_BASE_64)) {
                child = parseChunkedBase64(parser);
            } else if (parser.getName().equals(ELEMENT_XML)) {
                child = parseXml(parser);
            } else if (parser.getName().equals(ELEMENT_IBB)) {
                child = parseIbb(parser);
            } else if (parser.getName().equals(ELEMENT_SIPUB)) {
                // TODO: sipub is allowed by xep-0332, but is not implemented yet
                throw new UnsupportedOperationException("sipub is not supported yet");
            } else if (parser.getName().equals(ELEMENT_JINGLE)) {
                // TODO: jingle is allowed by xep-0332, but is not implemented yet
                throw new UnsupportedOperationException("jingle is not supported yet");
            } else {
                // other elements are not allowed
                throw new IllegalArgumentException("unsupported child tag: " + parser.getName());
            }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals(ELEMENT_DATA)) {
                done = true;
            }
        }
    }

    AbstractHttpOverXmpp.Data data = new AbstractHttpOverXmpp.Data(child);
    return data;
}
项目:Smack    文件:Header.java   
@Override
public XmlStringBuilder toXML() {
    // Upcast to NamedElement since we don't want a xmlns attribute
    XmlStringBuilder xml = new XmlStringBuilder((NamedElement) this);
    xml.attribute("name", name);
    xml.rightAngleBracket();
    xml.escape(value);
    xml.closeElement(this);
    return xml;
}
项目:Smack    文件:XmlStringBuilder.java   
public XmlStringBuilder(NamedElement e) {
    this();
    halfOpenElement(e.getElementName());
}
项目:Smack    文件:XmlStringBuilder.java   
public XmlStringBuilder halfOpenElement(NamedElement namedElement) {
    return halfOpenElement(namedElement.getElementName());
}
项目:Smack    文件:XmlStringBuilder.java   
public XmlStringBuilder closeElement(NamedElement e) {
    closeElement(e.getElementName());
    return this;
}
项目:Smack    文件:AbstractHttpOverXmpp.java   
/**
 * Creates Data element.
 *
 * @param child element nested by Data
 */
public Data(NamedElement child) {
    this.child = child;
}
项目:Smack    文件:AbstractHttpOverXmpp.java   
/**
 * Returns element nested by Data.
 *
 * @return element nested by Data
 */
public NamedElement getChild() {
    return child;
}