src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
public static StreamError parseStreamError(Element el) throws IOException,
            XmlPullParserException {
        String code = null;
        Element condEl = (Element) el.elements().iterator().next();
        if (condEl.getNamespace().getURI().equals(StreamError.NAMESPACE)) {
            code = condEl.getName();
        }
        String text = condEl.elementText("text");
        return new StreamError(code, text);
    }
public static StreamError parseStreamError(Element el) throws IOException,
            XmlPullParserException {
        String code = null;
        Element condEl = (Element) el.elements().iterator().next();
        if (condEl.getNamespace().getURI().equals(StreamError.NAMESPACE)) {
            code = condEl.getName();
        }
        String text = condEl.elementText("text");
        return new StreamError(code, text);
    }
Parses stream error packets.

@param doc
the XML parser.
@return an stream error packet.
@throws Exception
if an exception occurs while parsing the packet.