private void processComplexTypeDeclarations(Element schema, String targetNS) throws XPathExpressionException { // xpath expression to find all global complex type decls NodeList nodes = (NodeList) query(schema, "./xsd:complexType", XPathConstants.NODESET); for (int idx = 0; idx < nodes.getLength(); idx++) { Element node = (Element) nodes.item(idx); if (node.hasAttribute("name")) { String nsName = node.getAttribute("name"); ComplexTypeDeclaration complexTypeDecl = new ComplexTypeDeclaration(); complexTypeDecl.setArtifactType(BaseArtifactEnum.COMPLEX_TYPE_DECLARATION); complexTypeDecl.setName(nsName); complexTypeDecl.setNamespace(targetNS); complexTypeDecl.setNCName(nsName); derivedArtifacts.add(complexTypeDecl); } } }
/** * Processes the global complex type declarations found in the schema. * @param derivedArtifacts * @param sourceArtifact * @param schema * @param xpath * @throws XPathExpressionException */ private void processComplexTypeDeclarations(Collection<BaseArtifactType> derivedArtifacts, BaseArtifactType sourceArtifact, Element schema, XPath xpath) throws XPathExpressionException { String targetNS = schema.getAttribute("targetNamespace"); //$NON-NLS-1$ // xpath expression to find all global complex type decls NodeList nodes = (NodeList) this.query(xpath, schema, "./xsd:complexType", XPathConstants.NODESET); //$NON-NLS-1$ for (int idx = 0; idx < nodes.getLength(); idx++) { Element node = (Element) nodes.item(idx); if (node.hasAttribute("name")) { //$NON-NLS-1$ String nsName = node.getAttribute("name"); //$NON-NLS-1$ ComplexTypeDeclaration complexTypeDecl = new ComplexTypeDeclaration(); complexTypeDecl.setArtifactType(BaseArtifactEnum.COMPLEX_TYPE_DECLARATION); complexTypeDecl.setName(nsName); complexTypeDecl.setNamespace(targetNS); complexTypeDecl.setNCName(nsName); derivedArtifacts.add(complexTypeDecl); } } }