Search in sources :

Example 1 with Attribute

use of org.whole.lang.xml.model.Attribute 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)

Example 2 with Attribute

use of org.whole.lang.xml.model.Attribute in project whole by wholeplatform.

the class AttributesPreprocessor method preprocess.

public void preprocess(Attributes attributes) {
    IEntityIterator<Attribute> iterator = IteratorFactory.<Attribute>childIterator();
    iterator.reset(attributes);
    while (iterator.hasNext()) {
        Attribute attribute = iterator.next();
        if (updateNamespaceDeclarations(attribute) || processXsiDirectives(attribute))
            iterator.remove();
    }
}
Also used : Attribute(org.whole.lang.xml.model.Attribute)

Example 3 with Attribute

use of org.whole.lang.xml.model.Attribute in project whole by wholeplatform.

the class ByChildAPITest method testAbstractUListEntity.

@Test
public void testAbstractUListEntity() {
    XmlEntityFactory xmlf = XmlEntityFactory.instance(RegistryConfigurations.STRICT);
    Attribute a1 = xmlf.createAttribute(xmlf.createName("attr1"), xmlf.createValue("value1"));
    Attribute a2 = xmlf.createAttribute(xmlf.createName("attr2"), xmlf.createValue("value2"));
    Attribute a3 = xmlf.createAttribute(xmlf.createName("attr3"), xmlf.createValue("value3"));
    Attribute[] attributesArray = new Attribute[] { a1, a2, a3 };
    int[] businessEquivalence = new int[] { 0, 1, 2 };
    Attributes attributes = xmlf.createAttributes(attributesArray);
    orderedCompositeOperationsEntityTest(attributesArray, businessEquivalence, attributes);
    commonOperationsEntityTest(attributesArray, attributesArray, attributes);
    uniqueOperationsEntityTest(attributesArray, attributes);
    propertyChangeEntityTest(attributesArray, attributes, xmlf.createAttribute(xmlf.createName("attr4"), xmlf.createValue("value4")));
}
Also used : Attribute(org.whole.lang.xml.model.Attribute) Attributes(org.whole.lang.xml.model.Attributes) XmlEntityFactory(org.whole.lang.xml.factories.XmlEntityFactory) Test(org.junit.Test)

Example 4 with Attribute

use of org.whole.lang.xml.model.Attribute in project whole by wholeplatform.

the class AttributePart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    List<IEntity> list = new ArrayList<IEntity>(2);
    Attribute attribute = getModelEntity();
    list.add(attribute.getName());
    list.add(attribute.getValue());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) Attribute(org.whole.lang.xml.model.Attribute) ArrayList(java.util.ArrayList)

Aggregations

Attribute (org.whole.lang.xml.model.Attribute)4 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 IEntity (org.whole.lang.model.IEntity)1 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)1 XmlEntityFactory (org.whole.lang.xml.factories.XmlEntityFactory)1 Attributes (org.whole.lang.xml.model.Attributes)1 QName (org.whole.lang.xml.util.QName)1