Пример #1
0
  public static List<String> getType(XmlTreeNode node, List<String> restrictionsList) {
    String baseType = null;

    for (int i = 0; i < node.getChildCount(); i++) {
      XmlTreeNode mynode = node.getChild(i);

      if (mynode.getNodeName().equals("@base")) {
        baseType = mynode.getNodeText();
        if (baseType.contains(":")) {
          baseType = baseType.substring(baseType.indexOf(":") + 1);
        }
        restrictionsList.add("type = " + baseType);
      }
      getType(mynode, restrictionsList);
    }
    return restrictionsList;
  }
Пример #2
0
  public static List<String> getRestrictions(XmlTreeNode node, List<String> restrictionsList) {
    String baseType = null;

    for (int i = 0; i < node.getChildCount(); i++) {
      XmlTreeNode mynode = node.getChild(i);

      if ("xsd:restriction".equals(mynode.getParent().getNodeName())) {
        if (mynode.getNodeName().equals("@base")) {
          baseType = mynode.getNodeText();
          restrictionsList.add("type = " + baseType);
        } else {
          String nodeName = mynode.getNodeName();
          String nodeValue = mynode.getChild(0).getNodeText();
          restrictionsList.add(nodeName + " = " + nodeValue);
        }
      }
      getRestrictions(mynode, restrictionsList);
    }
    return restrictionsList;
  }