public AttributeBinding addAttribute(QName name, TypeBinding type, AttributeHandler handler) { AttributeBinding attr = new AttributeBinding(schemaBinding, name, type, handler); addAttribute(attr); return attr; }
QName name = (QName) entry.getKey(); AttributeBinding binding = (AttributeBinding) entry.getValue(); String constraint = binding.getDefaultConstraint(); if( constraint != null )
public Object unmarshal(QName elemName, QName attrName, AttributeBinding binding, NamespaceContext nsCtx, String value) { TypeBinding type = binding.getType(); ValueMetaData valueMetaData = binding.getValueMetaData(); return type == null ? value : type.getCharactersHandler().unmarshal(attrName, type, nsCtx, valueMetaData, value); }
AttributeBinding binding = new AttributeBinding(schema, attrName, typeBinding, DefaultHandlers.ATTRIBUTE_HANDLER); binding.setRequired(attrUse.getRequired()); if(attrUse.getConstraintType() == XSConstants.VC_DEFAULT) binding.setDefaultConstraint(attrUse.getConstraintValue()); if(propertyMetaData != null) binding.setPropertyMetaData(propertyMetaData); if(mapEntryKey) binding.setMapEntryKey(mapEntryKey); binding.setMapEntryValue(mapEntryValue); if(binding.getPropertyMetaData() != null) binding.getPropertyMetaData().getName() + ", collectionType=" + binding.getPropertyMetaData().getCollectionType(); else if(binding.isMapEntryKey()) else if(binding.isMapEntryValue()) if(binding.getDefaultConstraint() != null) msg += ", default=" + binding.getDefaultConstraint();
if(binding.isMapEntryKey()) else if(binding.isMapEntryValue()) PropertyMetaData propertyMetaData = binding.getPropertyMetaData(); if(propertyMetaData != null) property = Util.xmlNameToFieldName(attrName.getLocalPart(), binding.getSchema().isIgnoreLowLine()); binding.getSchema().isIgnoreUnresolvedFieldOrClass(), binding.getValueAdapter());
public Object getValue(MarshallingContext ctx) { Object owner = ctx.peek(); SchemaBinding schema = ctx.getSchemaBinding(); AttributeBinding binding = ctx.getAttributeBinding(); QName qName = binding.getQName(); String fieldName = null; PropertyMetaData propertyMetaData = binding.getPropertyMetaData(); if(propertyMetaData != null) { fieldName = propertyMetaData.getName(); } if(fieldName == null) { fieldName = Util.xmlNameToFieldName(qName.getLocalPart(), schema.isIgnoreLowLine()); } FieldInfo fieldInfo = FieldInfo.getFieldInfo( owner.getClass(), fieldName, binding.getRequired() && !schema.isIgnoreUnresolvedFieldOrClass() ); Object value = null; if(fieldInfo != null) { value = fieldInfo.getValue(owner); } return value; }
if (auxBinding.getQName().getLocalPart().equals(xmlAttrName)) PropertyMetaData prop = new PropertyMetaData(); prop.setName(javaVariableName); attrBinding.setPropertyMetaData(prop);
AttributeHandler handler = attr.getHandler(); if(handler != null) handler.attribute(valueEntry.qName, attr.getQName(), attr, o, valueEntry.value); valueEntry.qName + ", attrinute=" + attr.getQName() );
QName attrQName = attrBinding.getQName(); AttributeMarshaller marshaller = attrBinding.getMarshaller(); String marshalledAttr = marshaller.marshal(ctx);
public void attributes(Object o, QName elementName, TypeBinding type, Attributes attrs, NamespaceContext nsCtx) { for(int i = 0; i < attrs.getLength(); ++i) { QName qName = new QName(attrs.getURI(i), attrs.getLocalName(i)); AttributeBinding binding = type.getAttribute(qName); if(binding != null) { AttributeHandler handler = binding.getHandler(); Object value = handler.unmarshal(elementName, qName, binding, nsCtx, attrs.getValue(i)); handler.attribute(elementName, qName, binding, o, value); } else if(!Constants.NS_XML_SCHEMA_INSTANCE.equals(qName.getNamespaceURI())) { SchemaBinding schemaBinding = type.getSchemaBinding(); if(schemaBinding != null && schemaBinding.isStrictSchema()) { throw new JBossXBRuntimeException( "Attribute is not bound: element owner " + elementName + ", attribute " + qName ); } else if(log.isTraceEnabled()) { log.trace("Attribute is not bound: element owner " + elementName + ", attribute " + qName); } } } } }
attrBinding = bindAttribute(attr); binding.addAttribute(attrBinding); if(hasOnlyIdAttrs && !Constants.QNAME_ID.equals(attrBinding.getType().getQName()))
AttributeHandler handler = attr.getHandler(); if(handler != null) parentValueList.setAttributeValue(attr.getQName(), attr, valueEntry.value); handler.attribute(valueEntry.qName, attr.getQName(), attr, parent, valueEntry.value); valueEntry.qName + ", attrinute=" + attr.getQName() );
if(binding != null) AttributeHandler handler = binding.getHandler(); if(handler != null)