Examples of QNameValue


Examples of net.sf.saxon.value.QNameValue

        }

        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

Examples of net.sf.saxon.value.QNameValue

            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

Examples of net.sf.saxon.value.QNameValue

            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

Examples of net.sf.saxon.value.QNameValue

        }
        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

Examples of net.sf.saxon.value.QNameValue

                    if (ns == null) {
                        throw new ValidationException("No namespace binding for prefix in QName value " + Err.wrap(value));
                    }
                    if (ns.getLocalPart().equals(parts[0])) {
                        uri = ns.getStringValue();
                        QNameValue qname = new QNameValue(parts[0], uri, parts[1]);
                        return SingletonIterator.makeIterator(qname);
                    }
                }

            } catch (QNameException err) {
View Full Code Here

Examples of net.sf.saxon.value.QNameValue

                } 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

Examples of net.sf.saxon.value.QNameValue

                } 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

Examples of net.sf.saxon.value.QNameValue

                } 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 {
                    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

Examples of net.sf.saxon.value.QNameValue

                } 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

Examples of net.sf.saxon.value.QNameValue

        } catch (XPathException e) {
            e.maybeSetLocation(this);
            throw e;
        }

        return new QNameValue(qName, BuiltInAtomicType.QNAME);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.