Package net.sf.saxon.value

Examples of net.sf.saxon.value.QNameValue$QNameComparable


                } else {
                    throw new XPathFunctionException("Unexpected argument type: "+args.get(0).getClass());
                }
                String localName = null, namespaceUri = null, prefix = null;
                if (args.get(1) instanceof QNameValue) {
                    QNameValue qNameValue = (QNameValue) args.get(1);
                    namespaceUri = qNameValue.getNamespaceURI();
                    localName = qNameValue.getLocalName();
                    prefix = qNameValue.getPrefix();
                } else if (args.get(1) instanceof List) {
                    List elmts = (List) args.get(1);
                    if (elmts.size() != 1) throw new XPathFunctionException(
                            new FaultException(_oxpath.getOwner().constants.qnSelectionFailure,
                                    "The bpws:rename function MUST be passed a single " +
                                            "element node."));
                    Element nameElmt = (Element) elmts.get(0);
                    namespaceUri = nameElmt.getNamespaceURI();
                    localName = nameElmt.getLocalName();
                    prefix = nameElmt.getPrefix();
                } else if (args.get(1) instanceof NodeWrapper) {
                    Element nameElmt = (Element) ((NodeWrapper) args.get(1)).getUnderlyingNode();
                    namespaceUri = nameElmt.getNamespaceURI();
                    localName = nameElmt.getLocalName();
                    prefix = nameElmt.getPrefix();
                } else if (args.get(1) instanceof Element) {
                    Element nameElmt = (Element) args.get(1);
                    namespaceUri = nameElmt.getNamespaceURI();
                    localName = nameElmt.getLocalName();
                    prefix = nameElmt.getPrefix();
                } else if (args.get(1) instanceof String)  {
                    String qName = (String) args.get(1);
                    if (qName.contains(":")) {
                        int index = qName.indexOf(":");
                        prefix = qName.substring(0, index);
                        localName = qName.substring(index + 1);
                    } else {
                        localName = qName;
                    }
                } else if (args.get(1) instanceof QName) {
                    QName qName = (QName) args.get(1);
                    namespaceUri = qName.getNamespaceURI();
                    localName = qName.getLocalPart();
                    prefix = qName.getPrefix();
                } else {
                    throw new XPathFunctionException("Unexpected argument type: "+args.get(1).getClass());
                }
                if (namespaceUri == null) {
                    namespaceUri = targetElmt.lookupNamespaceURI(prefix);
                }
                elementQName = new QName(namespaceUri, localName, prefix);
                if (args.size() > 2) {
                    if (args.get(2) instanceof QNameValue) {
                        QNameValue qNameValue = (QNameValue) args.get(2);
                        namespaceUri = qNameValue.getNamespaceURI();
                        localName = qNameValue.getLocalName();
                        prefix = qNameValue.getPrefix();
                    } else if (args.get(2) instanceof NodeWrapper) {
                        Element nameElmt = (Element) ((NodeWrapper) args.get(2)).getUnderlyingNode();
                        namespaceUri = nameElmt.getNamespaceURI();
                        localName = nameElmt.getLocalName();
                        prefix = nameElmt.getPrefix();
View Full Code Here


                } else if (args.get(0) instanceof NodeWrapper) {
                    targetElmt = (Element) ((NodeWrapper) args.get(0)).getUnderlyingNode();
                } else if (args.get(0) instanceof Element) {
                    targetElmt = (Element) args.get(0);
                } else if (args.get(0) instanceof QNameValue) {
                    QNameValue qNameValue = (QNameValue) args.get(0);
                    propertyName = new QName(qNameValue.getNamespaceURI(), qNameValue.getLocalName(), qNameValue.getPrefix());
                } else if (args.get(0) instanceof String)  {
                    String stringValue = (String) args.get(0);
                    if (stringValue.indexOf(":") > 0) {
                        String prefix = stringValue.substring(0, stringValue.indexOf(":"));
                        String localPart = stringValue.substring(stringValue.indexOf(":") + 1);
View Full Code Here

                        NamespaceResolver resolver = new InscopeNamespaceResolver(initialMode);
                        final NameChecker checker = config.getNameChecker();
                        String[] parts = checker.getQNameParts(initialModeClarkName);
                        String uri = resolver.getURIForPrefix(parts[0], false);
                        initialModeClarkName =
                                new QNameValue(parts[0], uri, parts[1], BuiltInAtomicType.QNAME, checker).getClarkName();
                    }
                }
                NodeInfo initialTemplate = getChildElement(testInput, entryNamedTemplateNT);
                String initialTemplateClarkName = null;
                if (initialTemplate != null) {
                    initialTemplateClarkName = initialTemplate.getAttributeValue(qnameAtt);
                    if (initialTemplateClarkName.contains(":")) {
                        NamespaceResolver resolver = new InscopeNamespaceResolver(initialTemplate);
                        final NameChecker checker = config.getNameChecker();
                        String[] parts = checker.getQNameParts(initialTemplateClarkName);
                        String uri = resolver.getURIForPrefix(parts[0], false);
                        initialTemplateClarkName =
                                new QNameValue(parts[0], uri, parts[1], BuiltInAtomicType.QNAME, checker).getClarkName();
                    }
                }
                NodeInfo initialContextNode = getChildElement(testInput, initialContextNodeNT);
                String initialContextPath = null;
                if (initialContextNode != null) {
View Full Code Here

        FunctionItem f = (FunctionItem)getArguments()[0].evaluateItem(context);
        StructuredQName name = f.getFunctionName();
        if (name == null) {
            return null;
        } else {
            return new QNameValue(name, BuiltInAtomicType.QNAME);
        }
    }
View Full Code Here

            case NODE_NAME:
                int nc = node.getNameCode();
                if (nc == -1) {
                    return null;
                }
                return new QNameValue(node.getNamePool(), nc);
            default:
                throw new UnsupportedOperationException("Unknown name operation");
        }
        return new StringValue(s);
    }
View Full Code Here

            dynamicError(err.getMessage(), "FOCA0002", context);
            return null;
        }

        if (parts[0].equals("")) {
            return new QNameValue("", null, parts[1]);
        }

        NodeInfo element = (NodeInfo)argument[1].evaluateItem(context);
        SequenceIterator nsNodes = element.iterateAxis(Axis.NAMESPACE);

        while (true) {
            NodeInfo namespace = (NodeInfo)nsNodes.next();
            if (namespace==null) {
                break;
            }
            String prefix = namespace.getLocalPart();
            if (prefix.equals(parts[0])) {
                return new QNameValue(prefix, namespace.getStringValue(), parts[1]);
            }
        }

        dynamicError(
            "Namespace prefix '" + parts[0] + "' is not in scope for the selected element", "FONS0004", context);
View Full Code Here

        }

        try {
            String lex = argument[1].evaluateItem(context).getStringValue();
            String[] parts = Name.getQNameParts(lex);
            return new QNameValue(parts[0], uri, parts[1]);
        } catch (QNameException e) {
            dynamicError(e.getMessage(), context);
            return null;
        }
    }
View Full Code Here

            case NODE_NAME:
                int nc = node.getNameCode();
                if (nc == -1) {
                    return null;
                }
                return new QNameValue(node.getNamePool(), nc);
            default:
                throw new UnsupportedOperationException("Unknown name operation");
        }
        return new StringValue(s);
    }
View Full Code Here

            if (uri==null) {
                DynamicError e = new DynamicError("Prefix '" + parts[0] + "' has not been declared");
                e.setXPathContext(context);
                throw e;
            }
            return new QNameValue(parts[0], uri, parts[1]);
        } catch (QNameException err) {
            DynamicError e = new DynamicError(err);
            e.setXPathContext(context);
            throw e;
        }
View Full Code Here

        }
        if (isNamespaceSensitive()) {
            if (nsResolver == null) {
                throw new UnsupportedOperationException("Cannot validate a QName without a namespace resolver");
            }
            QNameValue qname;
            try {
                String[] parts = Name.getQNameParts(value.toString());
                String uri = nsResolver.getURIForPrefix(parts[0], true);
                if (uri == null) {
                    throw new ValidationException("Namespace prefix " + Err.wrap(parts[0]) +
                            " has not been declared");
                }
                qname = new QNameValue(parts[0], uri, parts[1]);
                if (!isBuiltIn()) {
                    String lexicalValue = value.toString();
                    DerivedAtomicValue.makeValue(qname, lexicalValue, this, true);
                }
            } catch (QNameException err) {
View Full Code Here

TOP

Related Classes of net.sf.saxon.value.QNameValue$QNameComparable

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.