private static boolean matches(XSObject aObject, QName aQName) { return aObject.getName().equals(aQName.getLocalPart()) && aObject.getNamespace().equals(aQName.getNamespaceURI()); } }
if (component.getType() == XSConstants.TYPE_DEFINITION && component.getName() == null) { resultComponents.add(component); resultComponents.add(component); } else { String localPart = component.getName(); String uri = component.getNamespace(); if (uri != null && localPart != null) { // .../schemaElement::p:item if (uri.equals(nameTest.uri) short type = component.getType(); if (type == XSConstants.MODEL_GROUP || type == XSConstants.FACET
private void expandRelatedComponents(XSObject component, Vector componentList, Hashtable dependencies) { short componentType = component.getType(); switch (componentType) { case XSConstants.TYPE_DEFINITION : expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies); break; case XSConstants.ATTRIBUTE_DECLARATION : expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies); break; case XSConstants.ATTRIBUTE_GROUP : expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies); case XSConstants.ELEMENT_DECLARATION : expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies); break; case XSConstants.MODEL_GROUP_DEFINITION : expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies); case XSConstants.ATTRIBUTE_USE : //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies); case XSConstants.NOTATION_DECLARATION : case XSConstants.IDENTITY_CONSTRAINT : default : break; } }
private Schema.Field createField(Iterable<Schema.Field> fields, XSObject source, XSTypeDefinition type, boolean optional, boolean array) { List<Short> supportedTypes = Arrays.asList(XSConstants.ELEMENT_DECLARATION, XSConstants.ATTRIBUTE_DECLARATION, XSConstants.WILDCARD); if (!supportedTypes.contains(source.getType())) throw new ConverterException("Invalid source object type " + source.getType()); boolean wildcard = source.getType() == XSConstants.WILDCARD; if (wildcard) { Schema map = Schema.createMap(Schema.create(Schema.Type.STRING)); return new Schema.Field(Source.WILDCARD, map, null, null); } Schema fieldSchema = createTypeSchema(type, optional, array); String name = validName(source.getName()); name = uniqueFieldName(fields, name); Schema.Field field = new Schema.Field(name, fieldSchema, null, null); boolean attribute = source.getType() == XSConstants.ATTRIBUTE_DECLARATION; field.addProp(Source.SOURCE, "" + new Source(source.getName(), attribute)); return field; }
public static String toDefXmlTagName(XSObject xs) { String xmlName = xs.getName(); if (xmlName.endsWith(TYPE_SUFFIX)) { xmlName = xmlName.substring(0, xmlName.length() - 4); } return xmlName; }
/** * Construct an XSNamedMap implementation one namespace from an array * * @param array containing all components * @param length number of components */ public XSNamedMapImpl(XSObject[] array, int length) { if (length == 0) { fNamespaces = null; fMaps = null; fNSNum = 0; fArray = array; fLength = 0; return; } // because all components are from the same target namesapce, // get the namespace from the first one. fNamespaces = new String[]{array[0].getNamespace()}; fMaps = null; fNSNum = 1; // copy elements to the Vector fArray = array; fLength = length; }
private void addElidedComponents(XSObject sourceComponent) { // these are the components returned from the term() accessor whose component-kind() is equal to xscd:model-group // currentComponents.size() gets changed in each iteration for (int i = currentComponents.size() - 1; i < currentComponents.size(); ++i) { term((XSObject)currentComponents.get(i), XSConstants.MODEL_GROUP, SCDParser.WILDCARD, currentComponents); } switch (sourceComponent.getType()) { case XSConstants.ELEMENT_DECLARATION: { XSObject typeDef = ((XSElementDeclaration)sourceComponent).getTypeDefinition(); if (typeDef != null && !currentComponents.contains(typeDef)) { currentComponents.add(typeDef); } } break; case XSConstants.ATTRIBUTE_DECLARATION: { XSObject typeDef = ((XSAttributeDeclaration)sourceComponent).getTypeDefinition(); if (typeDef != null && !currentComponents.contains(typeDef)) { currentComponents.add(typeDef); } } break; } // TODO: we dont have type alternative for now. } // getElidedComponents()
for (int j = 0; j < fLength; j++) { ret = fArray[j]; if (ret.getName().equals(localName)) { return ret;
addGlobalComponents(expandedComponents, importDependencies); if (referType == XSDDescription.CONTEXT_PREPARSE) { desc.setTargetNamespace(components[0].getNamespace());
private void componentScope(XSObject sourceComponent, List targetComponents) { switch (sourceComponent.getType()) { case XSConstants.ATTRIBUTE_DECLARATION: if (((XSAttributeDeclaration)sourceComponent).getScope() != XSConstants.SCOPE_GLOBAL) { XSObject type = ((XSAttributeDeclaration)sourceComponent).getEnclosingCTDefinition(); if (type != null && !targetComponents.contains(type)) { targetComponents.add(type); } } break; case XSConstants.ELEMENT_DECLARATION: if (((XSElementDeclaration)sourceComponent).getScope() != XSConstants.SCOPE_GLOBAL) { XSObject type = ((XSElementDeclaration)sourceComponent).getEnclosingCTDefinition(); if (type != null && !targetComponents.contains(type)) { targetComponents.add(type); } } break; } } // componentScope()
public String toJavaQualifiedTypeName(XSObject xs, Map<String, NamespaceDesc> nsdMap, boolean isEnum) { String typeName = toJavaTypeName(xs.getName(), xs.getNamespace()); return getNSDPrefix(xs.getNamespace(), xs.getName(), isEnum) + typeName; }
if (term.getType() == XSConstants.ELEMENT_DECLARATION) if (WSIConstants.NS_URI_SWA_REF.equals(xsType.getNamespace()) && WSIConstants.SCHEMA_TYPE_SWA_REF.equals(xsType.getName())) new QName(elem.getNamespace(), elem.getName())); else if(term.getType() == XSConstants.MODEL_GROUP)
String name = enclosingParent.getName(); reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.getName(), idName}, child); String name = enclosingParent.getName(); reportSchemaError(code, new Object[]{name, tempAttrUse.fAttrDecl.getName()}, child); String name = enclosingParent.getName(); reportSchemaError(code, new Object[]{name, oneAttrUse.fAttrDecl.getName(), idName}, child); String name = enclosingParent.getName(); reportSchemaError(code, new Object[]{name, oneAttrUse.fAttrDecl.getName()}, child); if (attrGrp.fAttributeWC == null) { String code = (enclosingParent instanceof XSAttributeGroupDecl) ? "src-attribute_group.2" : "src-ct.4"; String name = enclosingParent.getName(); reportSchemaError(code, new Object[]{name}, child); Integer count = (Integer)attrGroupCounts.get(qname); if (count.intValue() > 1) { reportSchemaWarning("src-ct.7", new Object[]{qname.localpart, enclosingParent.getName()}, (Element)firstAttr.getParentNode()); if (attrGrp.fAttributeWC == null) { String code = (enclosingParent instanceof XSAttributeGroupDecl) ? "src-attribute_group.2" : "src-ct.4"; String name = enclosingParent.getName(); reportSchemaError(code, new Object[]{name}, child);
XSObject[] components = xsinput.getComponents(); if (components != null && components.length > 0) { grammar = fGrammarBucket.getGrammar(components[0].getNamespace());
private String componentVariety(XSObject component) { short type = component.getType(); if (type == XSConstants.MODEL_GROUP) { switch (((XSModelGroup)component).getCompositor()) {
/** * Retrieves an <code>XSObject</code> specified by local name and * namespace URI. * <br>Per XML Namespaces, applications must use the value <code>null</code> as the * <code>namespace</code> parameter for methods if they wish to specify * no namespace. * @param namespace The namespace URI of the <code>XSObject</code> to * retrieve, or <code>null</code> if the <code>XSObject</code> has no * namespace. * @param localName The local name of the <code>XSObject</code> to * retrieve. * @return A <code>XSObject</code> (of any type) with the specified local * name and namespace URI, or <code>null</code> if they do not * identify any object in this map. */ public XSObject itemByName(String namespace, String localName) { XSObject xso = null; //Since our list may contain types from xerces implementation for(XSObject obj: list) { if(localName.equals(obj.getName()) && namespace.equals(obj.getNamespace())) return obj; } return xso; }
private boolean canAddComponent(XSObject component, XSDDescription desc) { desc.setNamespace(component.getNamespace()); short componentType = component.getType(); final String name = component.getName();
public String toJavaTypeName(XSObject xs, Map<String, NamespaceDesc> nsdMap) { String name = xs.getName(); if (name == null) { if (xs instanceof TypeInfo) { name = ((TypeInfo) xs).getTypeName(); if (name != null && name.startsWith("#")) { name = name.substring(1); } } } return model.toJavaTypeName(name, xs.getNamespace()); }
private void addGlobalComponent(XSObject component, XSDDescription desc) { final String namespace = component.getNamespace(); short componentType = component.getType(); final String name = component.getName();