Package net.sf.saxon.om

Examples of net.sf.saxon.om.StructuredQName


    public void error(Throwable exception) {
        log.error(exceptionMessage(exception) + exception.getMessage());
    }

    private String exceptionMessage(Throwable exception) {
        StructuredQName qCode = null;
        SourceLocator loc = null;
        String message = "";

        if (exception instanceof XPathException) {
            qCode = ((XPathException) exception).getErrorCodeQName();
        }

        if (exception instanceof TransformerException) {
            TransformerException tx = (TransformerException) exception;
            if (qCode == null && tx.getException() instanceof XPathException) {
                qCode = ((XPathException) tx.getException()).getErrorCodeQName();
            }

            if (tx.getLocator() != null) {
                loc = tx.getLocator();
                boolean done = false;
                while (!done && loc == null) {
                    if (tx.getException() instanceof TransformerException) {
                        tx = (TransformerException) tx.getException();
                        loc = tx.getLocator();
                    } else if (exception.getCause() instanceof TransformerException) {
                        tx = (TransformerException) exception.getCause();
                        loc = tx.getLocator();
                    } else {
                        done = true;
                    }
                }
            }
        }

        if (exception instanceof XProcException) {
            XProcException err = (XProcException) exception;
            loc = err.getLocator();
            if (err.getErrorCode() != null) {
                QName n = err.getErrorCode();
                qCode = new StructuredQName(n.getPrefix(),n.getNamespaceURI(),n.getLocalName());
            }
            if (err.getStep() != null) {
                message = message + err.getStep() + ":";
            }
        }

        if (loc != null) {
            if (loc.getSystemId() != null && !"".equals(loc.getSystemId())) {
                message = message + loc.getSystemId() + ":";
            }
            if (loc.getLineNumber() != -1) {
                message = message + loc.getLineNumber() + ":";
            }
            if (loc.getColumnNumber() != -1) {
                message = message + loc.getColumnNumber() + ":";
            }
        }

        if (qCode != null) {
            message = message + qCode.getDisplayName() + ":";
        }

        return message;
    }
View Full Code Here


        if (requiredParams == null) {
            return;
        }
        Iterator<StructuredQName> iter = requiredParams.iterator();
        while (iter.hasNext()) {
            StructuredQName req = iter.next();
            if (params == null || params.get(req) == null) {
                XPathException err = new XPathException("No value supplied for required parameter " +
                        req.getDisplayName());
                err.setErrorCode("XTDE0050");
                throw err;
            }
        }
    }
View Full Code Here

            }
            String uri = nsContext.getURIForPrefix(prefix, false);
            if (uri==null) {
              dynamicError("Namespace prefix " + prefix + " has not been declared", "XTSE0650", context);
          }
            StructuredQName qName = new StructuredQName("", uri, localName);
            Template target = controller.getExecutable().getNamedTemplate(qName);
            if (target==null) {
              dynamicError("Template " + qname + " has not been defined", "XTSE0650", context);
            }
            return target;
View Full Code Here

            return SequenceType.SINGLE_STRING;
        }

        @Override
        public StructuredQName getFunctionQName() {
            return new StructuredQName("efx", "http://test/saxon/ext", "simple");
        }
View Full Code Here

            return SequenceType.SINGLE_STRING;
        }

        @Override
        public StructuredQName getFunctionQName() {
            return new StructuredQName("efx", "http://test/saxon/ext", "simple");
        }
View Full Code Here

        }
        // If we can't determine the primitive type at compile time, we generate a run-time typeswitch

        LetExpression let = new LetExpression();
        let.setRequiredType(SequenceType.OPTIONAL_ATOMIC);
        let.setVariableQName(new StructuredQName("nn", NamespaceConstant.SAXON, "nn" + let.hashCode()));
        let.setSequence(operand);

        LocalVariableReference var = new LocalVariableReference(let);
        Expression isDouble = new InstanceOfExpression(
                var, SequenceType.makeSequenceType(BuiltInAtomicType.DOUBLE, StaticProperty.ALLOWS_ZERO_OR_ONE));
View Full Code Here

     * @param localName The local part of the QName
     * @param type The type label, xs:QName or a subtype of xs:QName
     */

    public QNameValue(String prefix, String uri, String localName, AtomicType type) {
        qName = new StructuredQName(prefix, uri, localName);
        if (type == null) {
            type = BuiltInAtomicType.QNAME;
        }
        typeLabel = type;
    }
View Full Code Here

     *          if a dynamic error occurs during evaluation of the function.
     */

    public Item evaluateItem(XPathContext context) throws XPathException {
        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

            if (argument[2] instanceof StringLiteral) {
                // common case, decimal format name is supplied as a string literal

                String lexicalName = ((StringLiteral)argument[2]).getStringValue();

                StructuredQName qName;
                try {
                    qName = StructuredQName.fromLexicalQName(lexicalName, false,
                        visitor.getConfiguration().getNameChecker(), env.getNamespaceResolver());
                } catch (XPathException e) {
                    XPathException se = new XPathException("Invalid decimal format name. " + e.getMessage());
View Full Code Here

            if (numArgs==2) {
                dfs = dfm.getDefaultDecimalFormat();
            } else {
                // the decimal-format name was given as a run-time expression
                String lexicalName = argument[2].evaluateItem(context).getStringValue();
                StructuredQName qName = null;
                try {
                    qName = StructuredQName.fromLexicalQName(lexicalName, false,
                        context.getConfiguration().getNameChecker(), nsContext);
                } catch (XPathException e) {
                    XPathException err = new XPathException("Invalid decimal format name. " + e.getMessage());
View Full Code Here

TOP

Related Classes of net.sf.saxon.om.StructuredQName

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.