Search in sources :

Example 1 with AttributeInfo

use of org.ksoap2.serialization.AttributeInfo in project ETSMobile-Android2 by ApplETS.

the class ExtendedSoapSerializationEnvelope method writeObjectBody.

@Override
public void writeObjectBody(XmlSerializer writer, KvmSerializable obj) throws IOException {
    if (obj instanceof AttributeContainer) {
        AttributeContainer soapObject = (AttributeContainer) obj;
        int cnt = soapObject.getAttributeCount();
        for (int counter = 0; counter < cnt; counter++) {
            AttributeInfo attributeInfo = new AttributeInfo();
            soapObject.getAttributeInfo(counter, attributeInfo);
            writer.attribute(attributeInfo.getNamespace(), attributeInfo.getName(), attributeInfo.getValue() != null ? attributeInfo.getValue().toString() : "");
        }
    }
    super.writeObjectBody(writer, obj);
}
Also used : AttributeInfo(org.ksoap2.serialization.AttributeInfo) AttributeContainer(org.ksoap2.serialization.AttributeContainer)

Example 2 with AttributeInfo

use of org.ksoap2.serialization.AttributeInfo in project ETSMobile-Android2 by ApplETS.

the class Helper method getAttribute.

public static Object getAttribute(AttributeContainer obj, String name, String namespace) {
    for (int i = 0; i < obj.getAttributeCount(); i++) {
        AttributeInfo info = new AttributeInfo();
        obj.getAttributeInfo(i, info);
        if (info.name.equals(name) && info.namespace.equals(namespace)) {
            return info.getValue();
        }
    }
    return null;
}
Also used : AttributeInfo(org.ksoap2.serialization.AttributeInfo)

Aggregations

AttributeInfo (org.ksoap2.serialization.AttributeInfo)2 AttributeContainer (org.ksoap2.serialization.AttributeContainer)1