Package client.net.sf.saxon.ce.om

Examples of client.net.sf.saxon.ce.om.NodeInfo


    public void validate(Declaration decl) throws XPathException {
        //checkWithinTemplate();

        AxisIterator kids = iterateAxis(Axis.CHILD);
        while(true) {
            NodeInfo curr = (NodeInfo)kids.next();
            if (curr == null) {
                break;
            }
            if (curr instanceof XSLFallback) {
                // no-op
            } else if (curr instanceof XSLMatchingSubstring) {
                boolean b = curr.getLocalPart().equals("matching-substring");
                if (b) {
                    if (matching!=null) {
                        compileError("xsl:matching-substring element must only appear once", "XTSE0010");
                    }
                    matching = (StyleElement)curr;
View Full Code Here


    // Implement the SequenceIterator as a wrapper around the underlying iterator
    // over the sequenceExtent, but looking ahead to remove duplicates.

    public Item next() throws XPathException {
        while (true) {
            NodeInfo next = (NodeInfo)iterator.next();
            if (next == null) {
                current = null;
                position = -1;
                return null;
            }
            if (current != null && next.isSameNodeInfo(current)) {
                continue;
            } else {
                position++;
                current = next;
                return current;
View Full Code Here

        AxisIterator iter = node.iterateAxis(Axis.CHILD);
        // The match is true if there is exactly one element node child, no text node
        // children, and the element node matches the element test.
        boolean found = false;
        while (true) {
            NodeInfo n = (NodeInfo)iter.next();
            if (n==null) {
                return found;
            }
            int kind = n.getNodeKind();
            if (kind==Type.TEXT) {
                return false;
            } else if (kind==Type.ELEMENT) {
                if (found) {
                    return false;
View Full Code Here

    }
    public void bubbleApplyTemplates(Node node, Event event)  {
      if (principleEventListener) {
        Controller.relayEvent(node, event); // make a call to this method for other instances
      }
      NodeInfo eventNode = ((HTMLDocumentWrapper)config.getHostPage()).wrap(node);
      SequenceIterator bubbleElements = eventNode.iterateAxis(Axis.ANCESTOR, NodeKindTest.ELEMENT);
      Controller controller = stylesheet.newTransformer();
      try {
          controller.importControllerSettings(localController);
        XPathContext ruleContext = controller.newXPathContext();
        Mode matchedMode = getModeFromEvent(event);
       
        if (matchedMode == null) {
          return;
        }
       
        // walk up the tree until we find an element with matching rule for the event mode

        NodeInfo element = eventNode;
          while (element != null) {
              Rule matchedRule = matchedMode.getRule(element, ruleContext);
              if (matchedRule != null && eventPropertyMatch(event, matchedRule)) {
                logger.log(Level.FINER, "Bubble Apply-Templates - Mode: " + matchedMode.getModeName().getLocalName() +
                    " Element: " + controller.getNamePool().getLocalName(element.getNameCode()));
                applyEventTemplates(matchedMode.getModeName().getClarkName(), element, event, null);
                if (matchedRule.getIxslPreventDefault()) {
                  event.preventDefault();
                }
                break;
View Full Code Here

    * Called when an item becomes the context item
    */

   public void startCurrentItem(Item item) {
       if (item instanceof NodeInfo) {
           NodeInfo curr = (NodeInfo) item;
           logger.finest(AbstractTraceListener.spaces(indent) + "<source node=\"" + Navigator.getPath(curr)
                   // + "\" line=\"" + curr.getLineNumber()
                   + "\" file=\"" + escape(StandardErrorListener.abbreviatePath(curr.getSystemId()))
                   + "\">");
       }
       indent++;
   }
View Full Code Here

     */

    public void endCurrentItem(Item item) {
        indent--;
        if (item instanceof NodeInfo) {
            NodeInfo curr = (NodeInfo) item;
            logger.finest(AbstractTraceListener.spaces(indent) + "</source><!-- " +
                    Navigator.getPath(curr) + " -->");
        }
    }
View Full Code Here

        }

        boolean found = false;
        AxisIterator kids = iterateAxis(Axis.CHILD);
        while(true) {
            NodeInfo child = (NodeInfo)kids.next();
            if (child == null) {
                break;
            } else if (child instanceof XSLFallback) {
                // do nothing;
            } else if (child instanceof XSLCallTemplate) {
View Full Code Here

        AtomicValue hrefVal = (AtomicValue)argument[0].evaluateItem(context);
        if (hrefVal==null) {
            return null;
        }
        String href = hrefVal.getStringValue();
        NodeInfo item = DocumentFn.makeDoc(href, expressionBaseURI, context, this.getSourceLocator());
        if (item==null) {
            // we failed to read the document
            dynamicError("Failed to load document " + href, "FODC0002", context);
            return null;
        }
View Full Code Here

        DocumentInfo doc = config.buildDocument("normalizationData.xml");

        BitSet isExcluded = new BitSet(128000);
        BitSet isCompatibility = new BitSet(128000);

        NodeInfo canonicalClassKeys = null;
        NodeInfo canonicalClassValues = null;
        NodeInfo decompositionKeys = null;
        NodeInfo decompositionValues = null;

        AxisIterator iter = doc.iterateAxis(Axis.DESCENDANT, NodeKindTest.ELEMENT);
        while (true) {
            NodeInfo item = (NodeInfo)iter.next();
            if (item == null) {
                break;
            }
            if (item.getLocalPart().equals("CanonicalClassKeys")) {
                canonicalClassKeys = item;
            } else if (item.getLocalPart().equals("CanonicalClassValues")) {
                canonicalClassValues = item;
            } else if (item.getLocalPart().equals("DecompositionKeys")) {
                decompositionKeys = item;
            } else if (item.getLocalPart().equals("DecompositionValues")) {
                decompositionValues = item;
            } else if (item.getLocalPart().equals("ExclusionList")) {
                readExclusionList(item.getStringValue(), isExcluded);
            } else if (item.getLocalPart().equals("CompatibilityList")) {
                readCompatibilityList(item.getStringValue(), isCompatibility);
            }
        }

        Map<Integer, Integer> canonicalClass = new HashMap<Integer, Integer>(400);
        readCanonicalClassTable(canonicalClassKeys.getStringValue(), canonicalClassValues.getStringValue(), canonicalClass);
View Full Code Here

        }
        if (!(item instanceof NodeInfo)) {
            out.append(item, NodeInfo.ALL_NAMESPACES);
            return null;
        }
        NodeInfo source = (NodeInfo)item;
        //out.getPipelineConfiguration().setBaseURI(source.getBaseURI());

        // Processing depends on the node kind.

        switch(source.getNodeKind()) {

        case Type.ELEMENT:
            // use the generic code for creating new elements
            return super.processLeavingTail(context, (NodeInfo)item);

        case Type.ATTRIBUTE:
            try {
                context.getReceiver().attribute(source.getNameCode(), source.getStringValueCS());
            } catch (NoOpenStartTagException err) {
                err.setXPathContext(context);
                throw dynamicError(getSourceLocator(), err, context);
            }
            break;

        case Type.TEXT:
            out.characters(source.getStringValueCS());
            break;

        case Type.PROCESSING_INSTRUCTION:
            out.processingInstruction(source.getDisplayName(), source.getStringValueCS());
            break;

        case Type.COMMENT:
            out.comment(source.getStringValueCS());
            break;

        case Type.NAMESPACE:
            try {
                source.copy(out, 0);
            } catch (NoOpenStartTagException err) {
                dynamicError(err.getMessage(), err.getErrorCodeLocalPart(), context);
            }
            break;

        case Type.DOCUMENT:
            out.startDocument();
            content.process(context);
            out.endDocument();
            break;

        default:
            throw new IllegalArgumentException("Unknown node kind " + source.getNodeKind());

        }
        return null;
    }
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.om.NodeInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.