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);
}
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();
}
}
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")));
}
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;
}
Aggregations