private void processSubstitutionGroups(Collection elements, String targetNamespace, String defaultNamespace) { Iterator elementsIter = elements.iterator(); while (elementsIter.hasNext()) { Element nextElement = (Element) elementsIter.next(); if (nextElement.getSubstitutionGroup() != null) { String substitutionGroup = nextElement.getSubstitutionGroup(); String localName = null; String uri = null; int index = substitutionGroup.indexOf(':'); if (index != -1) { String prefix = substitutionGroup.substring(0, index); localName = substitutionGroup.substring(index + 1, substitutionGroup.length()); uri = getURIForPrefix(prefix); } else { localName = substitutionGroup; uri = defaultNamespace; } SDOProperty rootProp = getExistingGlobalProperty(uri, localName, true); SDOProperty thisProperty = getExistingGlobalProperty(targetNamespace, nextElement.getName(), true); if (rootProp != null && thisProperty != null) { if (rootProp.getSubstitutableElements() == null) { rootProp.setSubstitutableElements(new java.util.ArrayList<SDOProperty>()); rootProp.setSubstitutable(true); } rootProp.getSubstitutableElements().add(thisProperty); } } } }
private void processSubstitutionGroups(Collection elements, String targetNamespace, String defaultNamespace) { Iterator elementsIter = elements.iterator(); while (elementsIter.hasNext()) { Element nextElement = (Element) elementsIter.next(); if (nextElement.getSubstitutionGroup() != null) { String substitutionGroup = nextElement.getSubstitutionGroup(); String localName = null; String uri = null; int index = substitutionGroup.indexOf(':'); if (index != -1) { String prefix = substitutionGroup.substring(0, index); localName = substitutionGroup.substring(index + 1, substitutionGroup.length()); uri = getURIForPrefix(prefix); } else { localName = substitutionGroup; uri = defaultNamespace; } SDOProperty rootProp = getExistingGlobalProperty(uri, localName, true); SDOProperty thisProperty = getExistingGlobalProperty(targetNamespace, nextElement.getName(), true); if (rootProp != null && thisProperty != null) { if (rootProp.getSubstitutableElements() == null) { rootProp.setSubstitutableElements(new java.util.ArrayList<SDOProperty>()); rootProp.setSubstitutable(true); } rootProp.getSubstitutableElements().add(thisProperty); } } } }