Search in sources :

Example 1 with QName

use of org.whole.lang.xml.util.QName in project whole by wholeplatform.

the class XmlSpecific2XsiBuilderAdapter method attributeEntities.

protected void attributeEntities(EntityDescriptor<?> context, Attributes attributes) {
    String uri = context.getLanguageKit().getURI();
    boolean isAttributeFormQualified = MappingStrategyUtils.hasMappingStrategy(uri) && MappingStrategyUtils.getMappingStrategy(uri).isAttributesFormQualified();
    IEntityIterator<Attribute> iterator = IteratorFactory.<Attribute>childIterator();
    iterator.reset(attributes);
    // add attribute features
    while (iterator.hasNext()) {
        Attribute attribute = iterator.next();
        QName name = QName.create(ns, isAttributeFormQualified ? NamespaceUtils.getDefaultNamespace(ns) : uri, attribute.getName());
        String value = attribute.getValue().getValue();
        if (hasAttributeEntityMapping(context, name)) {
            FeatureDescriptor fd = getAttributeFeatureMapping(context, name);
            EntityDescriptor<?> ed = getAttributeEntityMapping(context, name);
            attributeEntity(fd, ed, value);
            iterator.remove();
        }
    }
    // add any attributes feature
    anyAttributeEntities(context, attributes);
}
Also used : Attribute(org.whole.lang.xml.model.Attribute) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) QName(org.whole.lang.xml.util.QName)

Aggregations

FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)1 Attribute (org.whole.lang.xml.model.Attribute)1 QName (org.whole.lang.xml.util.QName)1