Search in sources :

Example 6 with Prop

use of com.dexels.navajo.document.stream.api.Prop in project navajo by Dexels.

the class StreamSaxHandler method endElement.

@Override
public final int endElement(String tag) {
    Map<String, String> attributes = attributeStack.pop();
    if (tag.equals("tml")) {
        handler.navajoDone(methods);
        return 1;
    }
    if (tag.equals("message")) {
        List<Prop> currentProperties = currentPropertiesStack.pop();
        String type = attributes.get("type");
        String name = attributes.get("name");
        if (Message.MSG_TYPE_DEFINITION.equals(type)) {
            handler.messageDefinition(attributes, currentProperties);
        } else if (Message.MSG_TYPE_ARRAY.equals(type)) {
            handler.arrayDone(name);
        } else {
            if (Message.MSG_TYPE_ARRAY_ELEMENT.equals(type)) {
                handler.arrayElement(currentProperties);
            } else {
                handler.messageDone(attributes, currentProperties);
            }
        }
        currentProperties.clear();
        return 1;
    }
    if (tag.equals("property")) {
        Prop currentProperty;
        String val = attributes.get("value");
        if ("selection".equals(attributes.get("type"))) {
            currentProperty = Prop.create(attributes, currentSelections);
        } else if (val != null) {
            Hashtable<String, String> h2 = new Hashtable<String, String>(attributes);
            // BaseNode.XMLUnescape(val);
            val = StringEscapeUtils.unescapeXml(val);
            h2.put("value", val);
            currentProperty = Prop.create(h2, currentSelections);
        } else if ("binary".equals(attributes.get("type"))) {
            handler.binaryDone();
            return 1;
        } else {
            currentProperty = Prop.create(attributes, currentSelections);
        }
        currentPropertiesStack.peek().add(currentProperty);
        // currentProperties.add(currentProperty);
        currentProperty = null;
        currentSelections.clear();
        return 0;
    }
    if (tag.equals("header")) {
        parseHeader(attributes);
        return 1;
    }
    if (tag.equals("option")) {
    }
    if (tag.equals("method")) {
    }
    if (tag.equals("transaction")) {
    }
    if (tag.equals("callback")) {
    }
    return 0;
}
Also used : Prop(com.dexels.navajo.document.stream.api.Prop) Hashtable(java.util.Hashtable)

Aggregations

Prop (com.dexels.navajo.document.stream.api.Prop)6 Msg (com.dexels.navajo.document.stream.api.Msg)4 NavajoHead (com.dexels.navajo.document.stream.api.NavajoHead)3 List (java.util.List)3 Message (com.dexels.navajo.document.Message)2 Property (com.dexels.navajo.document.Property)2 Method (com.dexels.navajo.document.stream.api.Method)2 IOException (java.io.IOException)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Header (com.dexels.navajo.document.Header)1 Navajo (com.dexels.navajo.document.Navajo)1 NavajoFactory (com.dexels.navajo.document.NavajoFactory)1 Selection (com.dexels.navajo.document.Selection)1 Select (com.dexels.navajo.document.stream.api.Select)1 NavajoStreamEvent (com.dexels.navajo.document.stream.events.NavajoStreamEvent)1 Binary (com.dexels.navajo.document.types.Binary)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Hashtable (java.util.Hashtable)1 Map (java.util.Map)1