/** * recursively drills down to get namespace pairs in nested imported elements * * @param descriptionElement - a description element from where import elements * and types can be found */ private void createNamespaceMap(DescriptionElement descriptionElement) { ImportElement[] importElements = descriptionElement.getImportElements(); for (int i = 0; i < importElements.length; i++) { DescriptionElement descElem = importElements[i].getDescriptionElement(); NamespaceDeclaration[] namespaceDeclarations = descElem.getDeclaredNamespaces(); for (int j = 0; j < namespaceDeclarations.length; j++) { NamespaceDeclaration importedNamespaceDeclaration = namespaceDeclarations[j]; if (!stringBasedNamespaceMap.containsKey(importedNamespaceDeclaration.getPrefix())) { stringBasedNamespaceMap.put(importedNamespaceDeclaration.getPrefix(), importedNamespaceDeclaration.getNamespaceURI().toString()); } } createNamespaceMap(descElem); // recursively drill down } }
/** * recursively drills down to get namespace pairs in nested imported elements * * @param descriptionElement - a description element from where import elements * and types can be found */ private void createNamespaceMap(DescriptionElement descriptionElement) { ImportElement[] importElements = descriptionElement.getImportElements(); for (int i = 0; i < importElements.length; i++) { DescriptionElement descElem = importElements[i].getDescriptionElement(); NamespaceDeclaration[] namespaceDeclarations = descElem.getDeclaredNamespaces(); for (int j = 0; j < namespaceDeclarations.length; j++) { NamespaceDeclaration importedNamespaceDeclaration = namespaceDeclarations[j]; if (!stringBasedNamespaceMap.containsKey(importedNamespaceDeclaration.getPrefix())) { stringBasedNamespaceMap.put(importedNamespaceDeclaration.getPrefix(), importedNamespaceDeclaration.getNamespaceURI().toString()); } } createNamespaceMap(descElem); // recursively drill down } }
createNamespaceMap(descriptionElement);
createNamespaceMap(descriptionElement);