コード例 #1
0
 @NotNull
 public XmlTag[] findSubTags(final String name, final String namespace) {
   final XmlTag[] subTags = getSubTags();
   final List<XmlTag> result = new ArrayList<XmlTag>();
   for (final XmlTag subTag : subTags) {
     if (namespace == null) {
       if (name.equals(subTag.getName())) result.add(subTag);
     } else if (name.equals(subTag.getLocalName()) && namespace.equals(subTag.getNamespace())) {
       result.add(subTag);
     }
   }
   return ContainerUtil.toArray(result, new XmlTag[result.size()]);
 }
コード例 #2
0
 protected XPathType getTypeForTag(XmlTag tag, String attribute) {
   String tagName = tag.getLocalName();
   if ("select".equals(attribute)) {
     if ("copy-of".equals(tagName)
         || "for-each".equals(tagName)
         || "apply-templates".equals(tagName)) {
       return XPathType.NODESET;
     } else if ("value-of".equals(tagName) || "sort".equals(tagName)) {
       return XPathType.STRING;
     }
     return XPathType.ANY;
   } else if ("test".equals(attribute)) {
     if ("if".equals(tagName) || "when".equals(tagName)) {
       return XPathType.BOOLEAN;
     }
   } else if ("number".equals(attribute)) {
     if ("value".equals(tagName)) {
       return XPathType.NUMBER;
     }
   }
   return XPathType.UNKNOWN;
 }