/** * Set name converter to be used. * * @param nconv * @param ictx */ private void setNameConverter(NameConverter nconv, IUnmarshallingContext ictx) { if (nconv != null) { if (m_nameConverter != null) { ValidationContext vctx = (ValidationContext)ictx.getUserContext(); vctx.addWarning("Repeated 'name-converter' element overrides previous setting", new ProblemLocation(ictx)); } m_nameConverter = nconv; } }
/** * Evaluate the remaining path for a customization after the first step, and apply it to the extension for each * matching schema component. If no matches are found or multiple matches are found this generates a warning. * * @param path customization path * @param match starting point for path * @param custom customization information * @param vctx validation context */ private static void applyRemainingCustomizationPath(SchemaPath path, OpenAttrBase match, ComponentCustom custom, ValidationContext vctx) { List matches = path.partialMatchMultiple(1, path.getPathLength()-1, match); if (matches.size() == 0) { vctx.addWarning("No matches found for customization expression", custom); } else { if (matches.size() > 1) { vctx.addWarning("Found " + matches.size() + " matches for customization expression", custom); } for (Iterator iter = matches.iterator(); iter.hasNext();) { OpenAttrBase target = (OpenAttrBase)iter.next(); custom.apply((ComponentExtension)target.getExtension(), vctx); } } }
/** * Recursively check that each schema customization has been matched to a schema. A warning is generated for any * customization without a matching schema. * * @param vctx */ public void checkSchemas(ValidationContext vctx) { // check for unique match to schema customization for (int i = 0; i < getChildren().size(); i++) { SchemaRootBase child = (SchemaRootBase)getChildren().get(i); if (child instanceof SchemaCustom) { SchemaCustom custom = (SchemaCustom)child; if (custom.getSchema() == null) { StringBuffer buff = new StringBuffer("No schema loaded for customization"); if (custom.getName() != null) { buff.append(" with name "); buff.append(custom.getName()); } else if (custom.getNamespace() != null) { buff.append(" with namespace "); buff.append(custom.getNamespace()); } vctx.addWarning(buff.toString(), custom); } } else if (child instanceof SchemasetCustom) { ((SchemasetCustom)child).checkSchemas(vctx); } } }
/** * 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); } } } }
} catch (IllegalArgumentException e) { /* ignore failure */ } catch (InvocationTargetException e) { vctx.addWarning("Failed passing existing name converter to constructor for class " + cname + ": " + e.getMessage(), new ProblemLocation(ctx));
String name = (String)iterator.next(); if (!foundset.contains(name)) { vctx.addWarning("Name '" + name + "' not found in schema", this); vctx.addWarning("Name '" + name + "' is on include list for schema, but excluded by customization", custom); vctx.addWarning("Name '" + name + "' is on excludes list for schema, but has a customization", custom); exten.setRemoved(false);
vctx.addWarning("Child customizations ignored for skipped component", this); List matches = path.partialMatchMultiple(0, path.getPathLength()-1, exten.getComponent()); if (matches.size() == 0) { vctx.addWarning("No matches found for customization expression", child); } else { for (Iterator iter = matches.iterator(); iter.hasNext();) {
vctx.addWarning("Non-WSDL attribute not allowed " + qname, ictx.getStackTop());
if (ctx.getAttributeNamespace(i).length() == 0) { if (s_allowedAttributes.indexOf(name) < 0) { vctx.addWarning("Undefined attribute " + name, ctx.getStackTop());