/** * Validate attributes of element. This is designed to be called during unmarshalling as part of the pre-set method * processing when a subclass instance is being created. * * @param ictx unmarshalling context * @param attrs attributes array */ protected void validateAttributes(IUnmarshallingContext ictx, StringArray attrs) { // setup for attribute access ValidationContext vctx = (ValidationContext)ictx.getUserContext(); UnmarshallingContext uctx = (UnmarshallingContext)ictx; // loop through all attributes of current element for (int i = 0; i < uctx.getAttributeCount(); i++) { // check if nonamespace attribute is in the allowed set String name = uctx.getAttributeName(i); if (uctx.getAttributeNamespace(i).length() == 0) { if (attrs.indexOf(name) < 0) { vctx.addWarning("Undefined attribute " + name, this); } } } }
/** * Validate attributes of element. This is designed to be called during unmarshalling as part of the pre-set method * processing when a subclass instance is being created. * * @param ictx unmarshalling context * @param attrs attributes array */ protected void validateAttributes(IUnmarshallingContext ictx, StringArray attrs) { // setup for attribute access ValidationContext vctx = (ValidationContext)ictx.getUserContext(); UnmarshallingContext uctx = (UnmarshallingContext)ictx; // loop through all attributes of current element for (int i = 0; i < uctx.getAttributeCount(); i++) { // check if nonamespace attribute is in the allowed set String name = uctx.getAttributeName(i); if (uctx.getAttributeNamespace(i).length() == 0) { if (attrs.indexOf(name) < 0) { vctx.addWarning("Undefined attribute " + name, this); } } } }
/** * Validate attributes of element from schema namespace. This allows any number of attributes from other namespaces * on the element. * * @param ictx unmarshalling context * @param attrs attributes array * @exception JiBXException on unmarshalling error */ protected void validateAttributes(IUnmarshallingContext ictx, StringArray attrs) throws JiBXException { // handle basic validation readNamespaces(ictx); validateAttributes(ictx, true, attrs); // loop through all attributes of current element UnmarshallingContext uctx = (UnmarshallingContext)ictx; clearExtraAttributes(); for (int i = 0; i < uctx.getAttributeCount(); i++) { // collect attributes from non-schema namespaces String ns = uctx.getAttributeNamespace(i); if (ns != null && ns.length() > 0 && !getNamespace().equals(ns)) { addExtraAttribute(uctx.getAttributeName(i), ns, uctx.getAttributeValue(i)); } } } }
String name = ctx.getAttributeName(i); String value = ctx.getAttributeValue(i); if (ctx.getAttributeNamespace(i).length() == 0) {
prefix = m_unmarshalContext.getAttributePrefix(i); uri = m_unmarshalContext.getAttributeNamespace(i); name = m_unmarshalContext.getAttributeName(i); if (prefix != null) { name = prefix + ':' + name;
String name = uctx.getAttributeName(i); String ns = uctx.getAttributeNamespace(i); if (ns == null || ns.length() == 0) {
String name = ctx.getAttributeName(i); if (ctx.getAttributeNamespace(i).length() == 0) { if (s_allowedAttributes.indexOf(name) < 0) {
String prefix = m_unmarshalContext.getAttributePrefix(i); String uri = m_unmarshalContext.getAttributeNamespace(i); String name = m_unmarshalContext.getAttributeName(i); String value = m_unmarshalContext.getAttributeValue(i); qname = QName.get(name, prefix, uri);