@Override public boolean visit(final VisitContextMutable<Object> context, final Element element) { for (final AttributeType attrType : AttributeType.values()) { final String attrName = attrType.getAttributeName(); final String attrVal = element.getAttribute(attrName); if (attrVal != null && !attrVal.isEmpty()) { final String[] attributeValues = (attrType == AttributeType.CLASS) ? attrVal.split(" +") : new String[]{attrVal}; for (final String dataFieldName : attributeValues) { final TaggedElement existingCandidate = childTemplateElements.get(dataFieldName); if (existingCandidate == null || existingCandidate.getAttributeType().ordinal() < attrType.ordinal()) { childTemplateElements.put(dataFieldName, new TaggedElement(attrType, element)); dataFields.put(dataFieldName, element); } } } } return true; } });
@Override public boolean visit(final VisitContextMutable<Object> context, final Element element) { for (final AttributeType attrType : AttributeType.values()) { final String attrName = attrType.getAttributeName(); final String attrVal = element.getAttribute(attrName); if (attrVal != null && !attrVal.isEmpty()) { final String[] attributeValues = (attrType == AttributeType.CLASS) ? attrVal.split(" +") : new String[]{attrVal}; for (final String dataFieldName : attributeValues) { final TaggedElement existingCandidate = childTemplateElements.get(dataFieldName); if (existingCandidate == null || existingCandidate.getAttributeType().ordinal() < attrType.ordinal()) { childTemplateElements.put(dataFieldName, new TaggedElement(attrType, element)); dataFields.put(dataFieldName, element); } } } } return true; } });
@Override public boolean visit(final VisitContextMutable<TaggedElement> context, final Element element) { for (final AttributeType attrType : AttributeType.values()) { final String attrName = attrType.getAttributeName(); final TaggedElement existingCandidate = context.getResult(); if (element.hasAttribute(attrName) && element.getAttribute(attrName).equals(rootField) && (existingCandidate == null || existingCandidate.getAttributeType().ordinal() < attrType.ordinal())) { context.setResult(new TaggedElement(attrType, element)); } } return true; } });
@Override public boolean visit(final VisitContextMutable<TaggedElement> context, final Element element) { for (final AttributeType attrType : AttributeType.values()) { final String attrName = attrType.getAttributeName(); final TaggedElement existingCandidate = context.getResult(); if (element.hasAttribute(attrName) && element.getAttribute(attrName).equals(rootField) && (existingCandidate == null || existingCandidate.getAttributeType().ordinal() < attrType.ordinal())) { context.setResult(new TaggedElement(attrType, element)); } } return true; } });