Beispiel #1
0
  /**
   * Processes the global complex type declarations found in the schema.
   *
   * @param derivedArtifacts
   * @param sourceArtifact
   * @param schema
   * @param xpath
   * @throws XPathExpressionException
   */
  private void processComplexTypeDeclarations(
      Collection<DerivedArtifactType> derivedArtifacts,
      BaseArtifactType sourceArtifact,
      Element schema,
      XPath xpath)
      throws XPathExpressionException {
    String targetNS = schema.getAttribute("targetNamespace");

    // xpath expression to find all global complex type decls
    NodeList nodes =
        (NodeList) this.query(xpath, 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);
      }
    }
  }