private void parseModifiers(StartElement element, QName parentName) { if (element == null || !ELEMENT_TYPE.modifiers.toString().equals(element.getName().toString())) { return; } if (ELEMENT_TYPE.source.toString().equals(parentName.toString())) { assignProperties(sourceAssociation, element.asStartElement()); } else if (ELEMENT_TYPE.target.toString().equals(parentName.toString())) { assignProperties(targetAssociation, element.asStartElement()); } }
private void parseProperties(StartElement element) { if (element == null || !ELEMENT_TYPE.properties.toString().equals(element.getName().toString())) { return; } properties = new AssociationProperties(); assignProperties(properties, element.asStartElement()); }
/** * Get attributes of a start element in a map. Attributes should be * described in an enumeration such that * {@link FileSourceXML#toConstantName(Attribute)} correspond to names * of enumeration constants. * * @param <T> type of the enumeration describing attributes * @param cls class of the enumeration T * @param e start event from which attributes have to be extracted * @return a mapping between enum constants and attribute values. */ protected <T extends Enum<T>> EnumMap<T, String> getAttributes( Class<T> cls, StartElement e) { EnumMap<T, String> values = new EnumMap<T, String>(cls); @SuppressWarnings("unchecked") Iterator<? extends Attribute> attributes = e.asStartElement() .getAttributes(); while (attributes.hasNext()) { Attribute a = attributes.next(); for (int i = 0; i < cls.getEnumConstants().length; i++) { if (cls.getEnumConstants()[i].name().equals( toConstantName(a))) { values.put(cls.getEnumConstants()[i], a.getValue()); break; } } } return values; }
Iterator<? extends Attribute> attributes = e.asStartElement() .getAttributes();
Element el = (Element) getForeignElement(se.asStartElement()); cs.getExtendedElements().add(el); } catch (XMLStreamException e) {