예제 #1
0
  protected Node processAttributeDeclaration(
      XSDAttributeDeclaration decl, Node parentNode, boolean isUse) throws RepositoryException {
    if (decl == null) {
      return null;
    }
    logger.debug(
        "Attribute declaration: '{0}' in ns '{1}' ", decl.getName(), decl.getTargetNamespace());

    Node attributeDeclarationNode =
        parentNode.addNode(decl.getName(), XsdLexicon.ATTRIBUTE_DECLARATION);
    attributeDeclarationNode.setProperty(XsdLexicon.NC_NAME, decl.getName());
    attributeDeclarationNode.setProperty(XsdLexicon.NAMESPACE, decl.getTargetNamespace());
    if (decl.isGlobal() && !isUse) {
      registerForSymbolSpace(
          ATTRIBUTE_DECLARATIONS,
          decl.getTargetNamespace(),
          decl.getName(),
          attributeDeclarationNode.getIdentifier());
    }
    XSDTypeDefinition type = decl.getType();
    if (type != null) {
      attributeDeclarationNode.setProperty(XsdLexicon.TYPE_NAME, type.getName());
      attributeDeclarationNode.setProperty(XsdLexicon.TYPE_NAMESPACE, type.getTargetNamespace());
    }
    processAnnotation(decl.getAnnotation(), attributeDeclarationNode);
    processNonSchemaAttributes(type, attributeDeclarationNode);
    return attributeDeclarationNode;
  }