当前位置: 首页>>代码示例>>Java>>正文


Java Axis.ATTRIBUTE属性代码示例

本文整理汇总了Java中com.sun.org.apache.xml.internal.dtm.Axis.ATTRIBUTE属性的典型用法代码示例。如果您正苦于以下问题:Java Axis.ATTRIBUTE属性的具体用法?Java Axis.ATTRIBUTE怎么用?Java Axis.ATTRIBUTE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.org.apache.xml.internal.dtm.Axis的用法示例。


在下文中一共展示了Axis.ATTRIBUTE属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setParser

public void setParser(Parser parser) {
    super.setParser(parser);
    // find all expressions in this Union
    final Vector components = new Vector();
    flatten(components);
    final int size = components.size();
    _components = (Expression[])components.toArray(new Expression[size]);
    for (int i = 0; i < size; i++) {
        _components[i].setParser(parser);
        _components[i].setParent(this);
        if (_components[i] instanceof Step) {
            final Step step = (Step)_components[i];
            final int axis = step.getAxis();
            final int type = step.getNodeType();
            // Put attribute iterators first
            if ((axis == Axis.ATTRIBUTE) || (type == DTM.ATTRIBUTE_NODE)) {
                _components[i] = _components[0];
                _components[0] = step;
            }
            // Check if the union contains a reverse iterator
    if (Axis.isReverse(axis)) _reverse = true;
        }
    }
    // No need to reverse anything if another expression lies on top of this
    if (getParent() instanceof Expression) _reverse = false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:UnionPathExpr.java

示例2: getNamespaceAxisIterator

/**
 * Do not think that this returns an iterator for the namespace axis.
 * It returns an iterator with nodes that belong in a certain namespace,
 * such as with <xsl:apply-templates select="blob/foo:*"/>
 * The 'axis' specifies the axis for the base iterator from which the
 * nodes are taken, while 'ns' specifies the namespace URI type.
 */
public DTMAxisIterator getNamespaceAxisIterator(int axis, int ns)
{

    DTMAxisIterator iterator = null;

    if (ns == NO_TYPE) {
        return EMPTYITERATOR;
    }
    else {
        switch (axis) {
            case Axis.CHILD:
                return new NamespaceChildrenIterator(ns);
            case Axis.ATTRIBUTE:
                return new NamespaceAttributeIterator(ns);
            default:
                return new NamespaceWildcardIterator(axis, ns);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:SAXImpl.java

示例3: NamespaceWildcardIterator

/**
 * Constructor NamespaceWildcard
 *
 * @param axis The axis that this iterator will traverse
 * @param nsType The namespace type index
 */
public NamespaceWildcardIterator(int axis, int nsType) {
    m_nsType = nsType;

    // Create a nested iterator that will select nodes of
    // the principal node kind for the selected axis.
    switch (axis) {
        case Axis.ATTRIBUTE: {
            // For "attribute::p:*", the principal node kind is
            // attribute
            m_baseIterator = getAxisIterator(axis);
        }
        case Axis.NAMESPACE: {
            // This covers "namespace::p:*".  It is syntactically
            // correct, though it doesn't make much sense.
            m_baseIterator = getAxisIterator(axis);
        }
        default: {
            // In all other cases, the principal node kind is
            // element
            m_baseIterator = getTypedAxisIterator(axis,
                                                  DTM.ELEMENT_NODE);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:SAXImpl.java

示例4: getNamespaceAxisIterator

/**
 * Do not think that this returns an iterator for the namespace axis.
 * It returns an iterator with nodes that belong in a certain namespace,
 * such as with <xsl:apply-templates select="blob/foo:*"/>
 * The 'axis' specifies the axis for the base iterator from which the
 * nodes are taken, while 'ns' specifies the namespace URI type.
 */
public DTMAxisIterator getNamespaceAxisIterator(int axis, int ns)
{
    if (ns == NO_TYPE) {
        return EMPTYITERATOR;
    }
    else {
        switch (axis) {
            case Axis.CHILD:
                return new NamespaceChildrenIterator(ns);
            case Axis.ATTRIBUTE:
                return new NamespaceAttributeIterator(ns);
            default:
                return new NamespaceWildcardIterator(axis, ns);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:SAXImpl.java

示例5: getAxisIterator

/**
 * This is a shortcut to the iterators that implement the
 * supported XPath axes (only namespace::) is not supported.
 * Returns a bare-bones iterator that must be initialized
 * with a start node (using iterator.setStartNode()).
 */
public DTMAxisIterator getAxisIterator(final int axis)
{
    switch (axis)
    {
        case Axis.SELF:
            return new SingletonIterator();
        case Axis.CHILD:
            return new ChildrenIterator();
        case Axis.PARENT:
            return new ParentIterator();
        case Axis.ANCESTOR:
            return new AncestorIterator();
        case Axis.ANCESTORORSELF:
            return (new AncestorIterator()).includeSelf();
        case Axis.ATTRIBUTE:
            return new AttributeIterator();
        case Axis.DESCENDANT:
            return new DescendantIterator();
        case Axis.DESCENDANTORSELF:
            return (new DescendantIterator()).includeSelf();
        case Axis.FOLLOWING:
            return new FollowingIterator();
        case Axis.PRECEDING:
            return new PrecedingIterator();
        case Axis.FOLLOWINGSIBLING:
            return new FollowingSiblingIterator();
        case Axis.PRECEDINGSIBLING:
            return new PrecedingSiblingIterator();
        case Axis.NAMESPACE:
            return new NamespaceIterator();
        case Axis.ROOT:
            return new RootIterator();
        default:
            BasisLibrary.runTimeError(BasisLibrary.AXIS_SUPPORT_ERR,
                    Axis.getNames(axis));
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:SAXImpl.java

示例6: addPattern

/**
 * Adds a pattern to a pattern group
 */
private void addPattern(int kernelType, LocationPathPattern pattern) {
    // Make sure the array of pattern groups is long enough
    final int oldLength = _patternGroups.length;
    if (kernelType >= oldLength) {
        Vector[] newGroups = new Vector[kernelType * 2];
        System.arraycopy(_patternGroups, 0, newGroups, 0, oldLength);
        _patternGroups = newGroups;
    }

    // Find the vector to put this pattern into
    Vector patterns;

    if (kernelType == DOM.NO_TYPE) {
        if (pattern.getAxis() == Axis.ATTRIBUTE) {
            patterns = (_attribNodeGroup == null) ?
                (_attribNodeGroup = new Vector(2)) : _attribNodeGroup;
        }
        else {
            patterns = (_childNodeGroup == null) ?
                (_childNodeGroup = new Vector(2)) : _childNodeGroup;
        }
    }
    else {
        patterns = (_patternGroups[kernelType] == null) ?
            (_patternGroups[kernelType] = new Vector(2)) :
            _patternGroups[kernelType];
    }

    if (patterns.size() == 0) {
        patterns.addElement(pattern);
    }
    else {
        boolean inserted = false;
        for (int i = 0; i < patterns.size(); i++) {
            final LocationPathPattern lppToCompare =
                (LocationPathPattern)patterns.elementAt(i);

            if (pattern.noSmallerThan(lppToCompare)) {
                inserted = true;
                patterns.insertElementAt(pattern, i);
                break;
            }
        }
        if (inserted == false) {
            patterns.addElement(pattern);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:Mode.java

示例7: findNodeType

public int findNodeType(int axis, Object test) {
    if (test == null) {  // *
        return (axis == Axis.ATTRIBUTE) ?
            NodeTest.ATTRIBUTE :
            (axis == Axis.NAMESPACE) ? -1 : NodeTest.ELEMENT;
    }
    else if (test instanceof Integer) {
        return ((Integer)test).intValue();
    }
    else {
        QName name = (QName)test;

        if (axis == Axis.NAMESPACE) {
            return (name.toString().equals("*")) ? -1
                : _xsltc.registerNamespacePrefix(name);
        }

        if (name.getNamespace() == null) {
            final String local = name.getLocalPart();

            if (local.equals("*")) {
                return (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE
                    : NodeTest.ELEMENT;
            }
            else if (local.equals("@*")) {
                return NodeTest.ATTRIBUTE;
            }
        }

        return (axis == Axis.ATTRIBUTE) ? _xsltc.registerAttribute(name)
            : _xsltc.registerElement(name);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:XPathParser.java

示例8: getTypedAxisIterator

/**
 * Similar to getAxisIterator, but this one returns an iterator
 * containing nodes of a typed axis (ex.: child::foo)
 */
public DTMAxisIterator getTypedAxisIterator(int axis, int type)
{
    // Most common case handled first
    if (axis == Axis.CHILD) {
        return new TypedChildrenIterator(type);
    }

    if (type == NO_TYPE) {
        return(EMPTYITERATOR);
    }

    switch (axis)
    {
        case Axis.SELF:
            return new TypedSingletonIterator(type);
        case Axis.CHILD:
            return new TypedChildrenIterator(type);
        case Axis.PARENT:
            return new ParentIterator().setNodeType(type);
        case Axis.ANCESTOR:
            return new TypedAncestorIterator(type);
        case Axis.ANCESTORORSELF:
            return (new TypedAncestorIterator(type)).includeSelf();
        case Axis.ATTRIBUTE:
            return new TypedAttributeIterator(type);
        case Axis.DESCENDANT:
            return new TypedDescendantIterator(type);
        case Axis.DESCENDANTORSELF:
            return (new TypedDescendantIterator(type)).includeSelf();
        case Axis.FOLLOWING:
            return new TypedFollowingIterator(type);
        case Axis.PRECEDING:
            return new TypedPrecedingIterator(type);
        case Axis.FOLLOWINGSIBLING:
            return new TypedFollowingSiblingIterator(type);
        case Axis.PRECEDINGSIBLING:
            return new TypedPrecedingSiblingIterator(type);
        case Axis.NAMESPACE:
            return  new TypedNamespaceIterator(type);
        case Axis.ROOT:
            return new TypedRootIterator(type);
        default:
            BasisLibrary.runTimeError(BasisLibrary.TYPED_AXIS_SUPPORT_ERR,
                    Axis.getNames(axis));
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:SAXImpl.java

示例9: canBeWalkedInNaturalDocOrderStatic

/**
 * Tell if the nodeset can be walked in doc order, via static analysis.
 *
 *
 * @return true if the nodeset can be walked in doc order, without sorting.
 */
boolean canBeWalkedInNaturalDocOrderStatic()
{

  if (null != m_firstWalker)
  {
    AxesWalker walker = m_firstWalker;
    int prevAxis = -1;
    boolean prevIsSimpleDownAxis = true;

    for(int i = 0; null != walker; i++)
    {
      int axis = walker.getAxis();

      if(walker.isDocOrdered())
      {
        boolean isSimpleDownAxis = ((axis == Axis.CHILD)
                                 || (axis == Axis.SELF)
                                 || (axis == Axis.ROOT));
        // Catching the filtered list here is only OK because
        // FilterExprWalker#isDocOrdered() did the right thing.
        if(isSimpleDownAxis || (axis == -1))
          walker = walker.getNextWalker();
        else
        {
          boolean isLastWalker = (null == walker.getNextWalker());
          if(isLastWalker)
          {
            if(walker.isDocOrdered() && (axis == Axis.DESCENDANT ||
               axis == Axis.DESCENDANTORSELF || axis == Axis.DESCENDANTSFROMROOT
               || axis == Axis.DESCENDANTSORSELFFROMROOT) || (axis == Axis.ATTRIBUTE))
              return true;
          }
          return false;
        }
      }
      else
        return false;
    }
    return true;
  }
  return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:48,代码来源:WalkingIteratorSorted.java

示例10: getAxisFromStep

/**
 * Special purpose function to see if we can optimize the pattern for
 * a DescendantIterator.
 *
 * @param compiler non-null reference to compiler object that has processed
 *                 the XPath operations into an opcode map.
 * @param stepOpCodePos The opcode position for the step.
 *
 * @return 32 bits as an integer that give information about the location
 * path as a whole.
 *
 * @throws javax.xml.transform.TransformerException
 */
public static int getAxisFromStep(
        Compiler compiler, int stepOpCodePos)
          throws javax.xml.transform.TransformerException
{

  int stepType = compiler.getOp(stepOpCodePos);

  switch (stepType)
  {
  case OpCodes.FROM_FOLLOWING :
    return Axis.FOLLOWING;
  case OpCodes.FROM_FOLLOWING_SIBLINGS :
    return Axis.FOLLOWINGSIBLING;
  case OpCodes.FROM_PRECEDING :
    return Axis.PRECEDING;
  case OpCodes.FROM_PRECEDING_SIBLINGS :
    return Axis.PRECEDINGSIBLING;
  case OpCodes.FROM_PARENT :
    return Axis.PARENT;
  case OpCodes.FROM_NAMESPACE :
    return Axis.NAMESPACE;
  case OpCodes.FROM_ANCESTORS :
    return Axis.ANCESTOR;
  case OpCodes.FROM_ANCESTORS_OR_SELF :
    return Axis.ANCESTORORSELF;
  case OpCodes.FROM_ATTRIBUTES :
    return Axis.ATTRIBUTE;
  case OpCodes.FROM_ROOT :
    return Axis.ROOT;
  case OpCodes.FROM_CHILDREN :
    return Axis.CHILD;
  case OpCodes.FROM_DESCENDANTS_OR_SELF :
    return Axis.DESCENDANTORSELF;
  case OpCodes.FROM_DESCENDANTS :
    return Axis.DESCENDANT;
  case OpCodes.FROM_SELF :
    return Axis.SELF;
  case OpCodes.OP_EXTFUNCTION :
  case OpCodes.OP_FUNCTION :
  case OpCodes.OP_GROUP :
  case OpCodes.OP_VARIABLE :
    return Axis.FILTEREDLIST;
  }

  throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: "
                             //+ stepType);
 }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:WalkerFactory.java

示例11: getAnalysisBitFromAxes

/**
 * Get a corresponding BIT_XXX from an axis.
 * @param axis One of Axis.ANCESTOR, etc.
 * @return One of BIT_ANCESTOR, etc.
 */
static public int getAnalysisBitFromAxes(int axis)
{
  switch (axis) // Generate new traverser
    {
    case Axis.ANCESTOR :
      return BIT_ANCESTOR;
    case Axis.ANCESTORORSELF :
      return BIT_ANCESTOR_OR_SELF;
    case Axis.ATTRIBUTE :
      return BIT_ATTRIBUTE;
    case Axis.CHILD :
      return BIT_CHILD;
    case Axis.DESCENDANT :
      return BIT_DESCENDANT;
    case Axis.DESCENDANTORSELF :
      return BIT_DESCENDANT_OR_SELF;
    case Axis.FOLLOWING :
      return BIT_FOLLOWING;
    case Axis.FOLLOWINGSIBLING :
      return BIT_FOLLOWING_SIBLING;
    case Axis.NAMESPACE :
    case Axis.NAMESPACEDECLS :
      return BIT_NAMESPACE;
    case Axis.PARENT :
      return BIT_PARENT;
    case Axis.PRECEDING :
      return BIT_PRECEDING;
    case Axis.PRECEDINGSIBLING :
      return BIT_PRECEDING_SIBLING;
    case Axis.SELF :
      return BIT_SELF;
    case Axis.ALLFROMNODE :
      return BIT_DESCENDANT_OR_SELF;
      // case Axis.PRECEDINGANDANCESTOR :
    case Axis.DESCENDANTSFROMROOT :
    case Axis.ALL :
    case Axis.DESCENDANTSORSELFFROMROOT :
      return BIT_ANY_DESCENDANT_FROM_ROOT;
    case Axis.ROOT :
      return BIT_ROOT;
    case Axis.FILTEREDLIST :
      return BIT_FILTER;
    default :
      return BIT_FILTER;
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:WalkerFactory.java

示例12: createStepPattern

/**
 * This method is similar to findNodeType(int, Object) except that it
 * creates a StepPattern instead of just returning a node type. It also
 * differs in the way it handles "{uri}:*" and "{uri}:@*". The last two
 * patterns are expanded as "*[namespace-uri() = 'uri']" and
 * "@*[namespace-uri() = 'uri']", respectively. This expansion considerably
 * simplifies the grouping of patterns in the Mode class. For this
 * expansion to be correct, the priority of the pattern/template must be
 * set to -0.25 (when no other predicates are present).
 */
public StepPattern createStepPattern(int axis, Object test, Vector predicates) {
    int nodeType;

    if (test == null) {  // "*"
        nodeType = (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE :
            (axis == Axis.NAMESPACE) ? -1 : NodeTest.ELEMENT;

        return new StepPattern(axis, nodeType, predicates);
    }
    else if (test instanceof Integer) {
        nodeType = ((Integer) test).intValue();

        return new StepPattern(axis, nodeType, predicates);
    }
    else {
        QName name = (QName)test;
        boolean setPriority = false;

        if (axis == Axis.NAMESPACE) {
            nodeType = (name.toString().equals("*")) ? -1
                            : _xsltc.registerNamespacePrefix(name);;
        }
        else {
            final String uri = name.getNamespace();
            final String local = name.getLocalPart();
            final QName namespace_uri =
                _parser.getQNameIgnoreDefaultNs("namespace-uri");

            // Expand {uri}:* to *[namespace-uri() = 'uri'] - same for @*
            if (uri != null && (local.equals("*") || local.equals("@*"))) {
                if (predicates == null) {
                    predicates = new Vector(2);
                }

                // Priority is set by hand if no other predicates exist
                setPriority = (predicates.size() == 0);

                predicates.add(
                    new Predicate(
                        new EqualityExpr(Operators.EQ,
                            new NamespaceUriCall(namespace_uri),
                            new LiteralExpr(uri))));
            }

            if (local.equals("*")) {
                nodeType = (axis == Axis.ATTRIBUTE) ? NodeTest.ATTRIBUTE
                    : NodeTest.ELEMENT;
            }
            else if (local.equals("@*")) {
                nodeType = NodeTest.ATTRIBUTE;
            }
            else {
                nodeType = (axis == Axis.ATTRIBUTE) ? _xsltc.registerAttribute(name)
                    : _xsltc.registerElement(name);
            }
        }

        final StepPattern result = new StepPattern(axis, nodeType, predicates);

        // Set priority for case prefix:* and prefix:@* (no predicates)
        if (setPriority) {
            result.setPriority(-0.25);
        }

        return result;
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:77,代码来源:XPathParser.java

示例13: isElementAxis

/**
 * Returns true if the axis applies to elements only. The axes
 * child, attribute, namespace, descendant result in non-empty
 * nodesets only if the context node is of type element.
 */
public boolean isElementAxis(int axis) {
    return (axis == Axis.CHILD || axis == Axis.ATTRIBUTE ||
            axis == Axis.NAMESPACE || axis == Axis.DESCENDANT);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:XPathParser.java


注:本文中的com.sun.org.apache.xml.internal.dtm.Axis.ATTRIBUTE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。