Listing 8. OrderReferenceHandler Implementation /** * This handler constructs a List of references from the reference elements */ class OrderReferenceHandler implements SAXTagHandler { public void onStartTag(String argTagNamespace, String argLocalTagName, String argQName, Attributes argAttributes, StringBuffer argText, Map argContext, NamespaceContext argNamespaceContext) throws SAXException { // clear any previous state argContext.put(OrderConstants.ORDER_REFERENCE_TYPE_TAG, null); argContext.put(OrderConstants.ORDER_REFERENCE_NUM_TAG, null); argContext.put(OrderConstants.ORDER_REFERENCE_DESC_TAG, null); } public void onEndTag(String argTagNamespace, String argLocalTagName, String argQName, Map argContext, NamespaceContext argNamespaceContext) throws SAXException { String type = (String) argContext.get(OrderConstants.ORDER_REFERENCE_TYPE_TAG); String ref = (String) argContext.get(OrderConstants.ORDER_REFERENCE_NUM_TAG); String desc = (String) argContext.get(OrderConstants.ORDER_REFERENCE_DESC_TAG); OrderReference newRef = new OrderReference(type, ref, desc); List list = (List) argContext.get(OrderConstants.ORDER_REFERENCE_TAG); if (null == list) { list = new LinkedList(); argContext.put(OrderConstants.ORDER_REFERENCE_TAG, list); } list.add(newRef); } }