Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.DOM#getStringValueX()

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.DOM#getStringValueX() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasisLibrary.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Utility function: used to convert reference to String.
 */
public static String referenceToString(Object obj, DOM dom) {
    if (obj instanceof String) {
        return (String) obj;
    }
    else if (obj instanceof DTMAxisIterator) {
        return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
    }
    else if (obj instanceof Node) {
        return dom.getStringValueX(((Node)obj).node);
    }
    else if (obj instanceof DOM) {
        return ((DOM) obj).getStringValue();
    }
    else {
        final String className = obj.getClass().getName();
        runTimeError(DATA_CONVERSION_ERR, className, String.class);
        return null;
    }
}
 
Example 2
Source File: BasisLibrary.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Utility function: used to convert reference to String.
 */
public static String referenceToString(Object obj, DOM dom) {
    if (obj instanceof String) {
        return (String) obj;
    }
    else if (obj instanceof DTMAxisIterator) {
        return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
    }
    else if (obj instanceof Node) {
        return dom.getStringValueX(((Node)obj).node);
    }
    else if (obj instanceof DOM) {
        return ((DOM) obj).getStringValue();
    }
    else {
        final String className = obj.getClass().getName();
        runTimeError(DATA_CONVERSION_ERR, className, String.class);
        return null;
    }
}
 
Example 3
Source File: BasisLibrary.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Utility function: used to convert reference to String.
 */
public static String referenceToString(Object obj, DOM dom) {
    if (obj instanceof String) {
        return (String) obj;
    }
    else if (obj instanceof DTMAxisIterator) {
        return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
    }
    else if (obj instanceof Node) {
        return dom.getStringValueX(((Node)obj).node);
    }
    else if (obj instanceof DOM) {
        return ((DOM) obj).getStringValue();
    }
    else {
        final String className = obj.getClass().getName();
        runTimeError(DATA_CONVERSION_ERR, className, String.class);
        return null;
    }
}
 
Example 4
Source File: LoadDocument.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 5
Source File: LoadDocument.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 6
Source File: BasisLibrary.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility function: node-set/node-set compare.
 */
public static boolean compare(DTMAxisIterator left, DTMAxisIterator right,
                              int op, DOM dom) {
    int lnode;
    left.reset();

    while ((lnode = left.next()) != DTMAxisIterator.END) {
        final String lvalue = dom.getStringValueX(lnode);

        int rnode;
        right.reset();
        while ((rnode = right.next()) != DTMAxisIterator.END) {
            // String value must be the same if both nodes are the same
            if (lnode == rnode) {
                if (op == Operators.EQ) {
                    return true;
                } else if (op == Operators.NE) {
                    continue;
                }
            }
            if (compareStrings(lvalue, dom.getStringValueX(rnode), op,
                               dom)) {
                return true;
            }
        }
    }
    return false;
}
 
Example 7
Source File: BasisLibrary.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * XSLT Standard function string(value)
 */
public static String stringF(Object obj, int node, DOM dom) {
    if (obj instanceof DTMAxisIterator) {
        return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
    }
    else if (obj instanceof Node) {
        return dom.getStringValueX(((Node)obj).node);
    }
    else if (obj instanceof DOM) {
        // When the first argument is a DOM we want the whole
        // DOM and not just a single node - that would not make sense.
        //return ((DOM)obj).getStringValueX(node);
        return ((DOM)obj).getStringValue();
    }
    else if (obj instanceof Double) {
        Double d = (Double)obj;
        final String result = d.toString();
        final int length = result.length();
        if ((result.charAt(length-2)=='.') &&
            (result.charAt(length-1) == '0'))
            return result.substring(0, length-2);
        else
            return result;
    }
    else {
        return obj != null ? obj.toString() : "";
    }
}
 
Example 8
Source File: BasisLibrary.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * XSLT Standard function string(value)
 */
public static String stringF(Object obj, DOM dom) {
    if (obj instanceof DTMAxisIterator) {
        return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
    }
    else if (obj instanceof Node) {
        return dom.getStringValueX(((Node)obj).node);
    }
    else if (obj instanceof DOM) {
        return ((DOM)obj).getStringValue();
    }
    else {
        return obj.toString();
    }
}
 
Example 9
Source File: BasisLibrary.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * XSLT Standard function string(value)
 */
public static String stringF(Object obj, DOM dom) {
    if (obj instanceof DTMAxisIterator) {
        return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
    }
    else if (obj instanceof Node) {
        return dom.getStringValueX(((Node)obj).node);
    }
    else if (obj instanceof DOM) {
        return ((DOM)obj).getStringValue();
    }
    else {
        return obj.toString();
    }
}
 
Example 10
Source File: BasisLibrary.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * XSLT Standard function string(value)
 */
public static String stringF(Object obj, int node, DOM dom) {
    if (obj instanceof DTMAxisIterator) {
        return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
    }
    else if (obj instanceof Node) {
        return dom.getStringValueX(((Node)obj).node);
    }
    else if (obj instanceof DOM) {
        // When the first argument is a DOM we want the whole
        // DOM and not just a single node - that would not make sense.
        //return ((DOM)obj).getStringValueX(node);
        return ((DOM)obj).getStringValue();
    }
    else if (obj instanceof Double) {
        Double d = (Double)obj;
        final String result = d.toString();
        final int length = result.length();
        if ((result.charAt(length-2)=='.') &&
            (result.charAt(length-1) == '0'))
            return result.substring(0, length-2);
        else
            return result;
    }
    else {
        return obj != null ? obj.toString() : "";
    }
}
 
Example 11
Source File: BasisLibrary.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility function: node-set/node-set compare.
 */
public static boolean compare(DTMAxisIterator left, DTMAxisIterator right,
                              int op, DOM dom) {
    int lnode;
    left.reset();

    while ((lnode = left.next()) != DTMAxisIterator.END) {
        final String lvalue = dom.getStringValueX(lnode);

        int rnode;
        right.reset();
        while ((rnode = right.next()) != DTMAxisIterator.END) {
            // String value must be the same if both nodes are the same
            if (lnode == rnode) {
                if (op == Operators.EQ) {
                    return true;
                } else if (op == Operators.NE) {
                    continue;
                }
            }
            if (compareStrings(lvalue, dom.getStringValueX(rnode), op,
                               dom)) {
                return true;
            }
        }
    }
    return false;
}
 
Example 12
Source File: BasisLibrary.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility function: node-set/node-set compare.
 */
public static boolean compare(DTMAxisIterator left, DTMAxisIterator right,
                              int op, DOM dom) {
    int lnode;
    left.reset();

    while ((lnode = left.next()) != DTMAxisIterator.END) {
        final String lvalue = dom.getStringValueX(lnode);

        int rnode;
        right.reset();
        while ((rnode = right.next()) != DTMAxisIterator.END) {
            // String value must be the same if both nodes are the same
            if (lnode == rnode) {
                if (op == Operators.EQ) {
                    return true;
                } else if (op == Operators.NE) {
                    continue;
                }
            }
            if (compareStrings(lvalue, dom.getStringValueX(rnode), op,
                               dom)) {
                return true;
            }
        }
    }
    return false;
}
 
Example 13
Source File: BasisLibrary.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static boolean compare(int node, DTMAxisIterator iterator,
                              int op, DOM dom) {
    //iterator.reset();

    int rnode;
    String value;

    switch(op) {
case Operators.EQ:
        rnode = iterator.next();
        if (rnode != DTMAxisIterator.END) {
            value = dom.getStringValueX(node);
            do {
                if (node == rnode
                      || value.equals(dom.getStringValueX(rnode))) {
                   return true;
                }
            } while ((rnode = iterator.next()) != DTMAxisIterator.END);
        }
        break;
case Operators.NE:
        rnode = iterator.next();
        if (rnode != DTMAxisIterator.END) {
            value = dom.getStringValueX(node);
            do {
                if (node != rnode
                      && !value.equals(dom.getStringValueX(rnode))) {
                    return true;
                }
            } while ((rnode = iterator.next()) != DTMAxisIterator.END);
        }
        break;
case Operators.LT:
        // Assume we're comparing document order here
        while ((rnode = iterator.next()) != DTMAxisIterator.END) {
            if (rnode > node) return true;
        }
        break;
case Operators.GT:
        // Assume we're comparing document order here
        while ((rnode = iterator.next()) != DTMAxisIterator.END) {
            if (rnode < node) return true;
        }
        break;
    }
    return(false);
}
 
Example 14
Source File: BasisLibrary.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * XSLT Standard function string()
 */
public static String stringF(int node, DOM dom) {
    return dom.getStringValueX(node);
}
 
Example 15
Source File: BasisLibrary.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * XSLT Standard function string()
 */
public static String stringF(int node, DOM dom) {
    return dom.getStringValueX(node);
}
 
Example 16
Source File: BasisLibrary.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * XSLT Standard function string()
 */
public static String stringF(int node, DOM dom) {
    return dom.getStringValueX(node);
}
 
Example 17
Source File: BasisLibrary.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public static boolean compare(int node, DTMAxisIterator iterator,
                              int op, DOM dom) {
    //iterator.reset();

    int rnode;
    String value;

    switch(op) {
case Operators.EQ:
        rnode = iterator.next();
        if (rnode != DTMAxisIterator.END) {
            value = dom.getStringValueX(node);
            do {
                if (node == rnode
                      || value.equals(dom.getStringValueX(rnode))) {
                   return true;
                }
            } while ((rnode = iterator.next()) != DTMAxisIterator.END);
        }
        break;
case Operators.NE:
        rnode = iterator.next();
        if (rnode != DTMAxisIterator.END) {
            value = dom.getStringValueX(node);
            do {
                if (node != rnode
                      && !value.equals(dom.getStringValueX(rnode))) {
                    return true;
                }
            } while ((rnode = iterator.next()) != DTMAxisIterator.END);
        }
        break;
case Operators.LT:
        // Assume we're comparing document order here
        while ((rnode = iterator.next()) != DTMAxisIterator.END) {
            if (rnode > node) return true;
        }
        break;
case Operators.GT:
        // Assume we're comparing document order here
        while ((rnode = iterator.next()) != DTMAxisIterator.END) {
            if (rnode < node) return true;
        }
        break;
    }
    return(false);
}
 
Example 18
Source File: BasisLibrary.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public static boolean compare(int node, DTMAxisIterator iterator,
                              int op, DOM dom) {
    //iterator.reset();

    int rnode;
    String value;

    switch(op) {
case Operators.EQ:
        rnode = iterator.next();
        if (rnode != DTMAxisIterator.END) {
            value = dom.getStringValueX(node);
            do {
                if (node == rnode
                      || value.equals(dom.getStringValueX(rnode))) {
                   return true;
                }
            } while ((rnode = iterator.next()) != DTMAxisIterator.END);
        }
        break;
case Operators.NE:
        rnode = iterator.next();
        if (rnode != DTMAxisIterator.END) {
            value = dom.getStringValueX(node);
            do {
                if (node != rnode
                      && !value.equals(dom.getStringValueX(rnode))) {
                    return true;
                }
            } while ((rnode = iterator.next()) != DTMAxisIterator.END);
        }
        break;
case Operators.LT:
        // Assume we're comparing document order here
        while ((rnode = iterator.next()) != DTMAxisIterator.END) {
            if (rnode > node) return true;
        }
        break;
case Operators.GT:
        // Assume we're comparing document order here
        while ((rnode = iterator.next()) != DTMAxisIterator.END) {
            if (rnode < node) return true;
        }
        break;
    }
    return(false);
}
 
Example 19
Source File: BasisLibrary.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public static boolean compare(int node, DTMAxisIterator iterator,
                              int op, DOM dom) {
    //iterator.reset();

    int rnode;
    String value;

    switch(op) {
case Operators.EQ:
        rnode = iterator.next();
        if (rnode != DTMAxisIterator.END) {
            value = dom.getStringValueX(node);
            do {
                if (node == rnode
                      || value.equals(dom.getStringValueX(rnode))) {
                   return true;
                }
            } while ((rnode = iterator.next()) != DTMAxisIterator.END);
        }
        break;
case Operators.NE:
        rnode = iterator.next();
        if (rnode != DTMAxisIterator.END) {
            value = dom.getStringValueX(node);
            do {
                if (node != rnode
                      && !value.equals(dom.getStringValueX(rnode))) {
                    return true;
                }
            } while ((rnode = iterator.next()) != DTMAxisIterator.END);
        }
        break;
case Operators.LT:
        // Assume we're comparing document order here
        while ((rnode = iterator.next()) != DTMAxisIterator.END) {
            if (rnode > node) return true;
        }
        break;
case Operators.GT:
        // Assume we're comparing document order here
        while ((rnode = iterator.next()) != DTMAxisIterator.END) {
            if (rnode < node) return true;
        }
        break;
    }
    return(false);
}
 
Example 20
Source File: BasisLibrary.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * XSLT Standard function string()
 */
public static String stringF(int node, DOM dom) {
    return dom.getStringValueX(node);
}