コード例 #1
0
 /**
  * Returns the XML field descriptor matching the given xml name and nodeType. If NodeType is null,
  * then either an AttributeDescriptor, or ElementDescriptor may be returned. Null is returned if
  * no matching descriptor is available.
  *
  * @param name the xml name to match against
  * @param namespace the namespace uri
  * @param nodeType, the NodeType to match against, or null if the node type is not known.
  * @return the matching descriptor, or null if no matching descriptor is available.
  */
 public XMLFieldDescriptor getFieldDescriptor(String name, String namespace, NodeType nodeType) {
   if ((nodeType == null) || (nodeType == NodeType.Element)) {
     for (int i = 0; i < _elements.length; i++) {
       XMLFieldDescriptor desc = _elements[i];
       if (desc == null) continue;
       if (desc.matches(name, namespace)) return desc;
     }
   }
   return null;
 } // -- getFieldDescriptor
コード例 #2
0
 /**
  * Returns the XML field descriptor matching the given xml name and nodeType. If NodeType is null,
  * then either an AttributeDescriptor, or ElementDescriptor may be returned. Null is returned if
  * no matching descriptor is available.
  *
  * @param name the xml name to match against
  * @param namespace the namespace uri
  * @param nodeType the NodeType to match against, or null if the node type is not known.
  * @return the matching descriptor, or null if no matching descriptor is available.
  */
 public XMLFieldDescriptor getFieldDescriptor(
     final String name, final String namespace, final NodeType nodeType) {
   if (nodeType == null || nodeType == NodeType.Element) {
     for (int i = 0; i < _elements.length; i++) {
       XMLFieldDescriptor desc = _elements[i];
       if (desc != null && desc.matches(name, namespace)) {
         return desc;
       }
     }
   }
   return null;
 } // -- getFieldDescriptor
コード例 #3
0
  /**
   * Returns the XML field descriptor matching the given xml name and nodeType. If NodeType is null,
   * then either an AttributeDescriptor, or ElementDescriptor may be returned. Null is returned if
   * no matching descriptor is available.
   *
   * @param name the xml name to match against
   * @param nodeType, the NodeType to match against, or null if the node type is not known.
   * @return the matching descriptor, or null if no matching descriptor is available.
   */
  public XMLFieldDescriptor getFieldDescriptor(String name, NodeType nodeType) {

    boolean wild = (nodeType == null);

    if (wild || (nodeType == NodeType.Element)) {
      XMLFieldDescriptor desc = null;
      for (int i = 0; i < elements.length; i++) {
        desc = elements[i];
        if (desc == null) continue;
        if (desc.matches(name)) return desc;
      }
    }

    if (wild || (nodeType == NodeType.Attribute)) {
      XMLFieldDescriptor desc = null;
      for (int i = 0; i < attributes.length; i++) {
        desc = attributes[i];
        if (desc == null) continue;
        if (desc.matches(name)) return desc;
      }
    }

    return null;
  } // -- getFieldDescriptor