org.xml.sax.DTDHandler#com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg源码实例Demo

下面列出了org.xml.sax.DTDHandler#com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-jdk8u-backup   文件: StartsWithCall.java
/**
 * Type check the two parameters for this function
 */
public Type typeCheck(SymbolTable stable) throws TypeCheckError {

    // Check that the function was passed exactly two arguments
    if (argumentCount() != 2) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
                                    getName(), this);
        throw new TypeCheckError(err);
    }

    // The first argument must be a String, or cast to a String
    _base = argument(0);
    Type baseType = _base.typeCheck(stable);
    if (baseType != Type.String)
        _base = new CastExpr(_base, Type.String);

    // The second argument must also be a String, or cast to a String
    _token = argument(1);
    Type tokenType = _token.typeCheck(stable);
    if (tokenType != Type.String)
        _token = new CastExpr(_token, Type.String);

    return _type = Type.Boolean;
}
 
源代码2 项目: jdk1.8-source-analysis   文件: TransletOutput.java
/**
 * Parse the contents of this <xsltc:output> element. The only attribute
 * we recognise is the 'file' attribute that contains teh output filename.
 */
public void parseContents(Parser parser) {
    // Get the output filename from the 'file' attribute
    String filename = getAttribute("file");

    // If the 'append' attribute is set to "yes" or "true",
    // the output is appended to the file.
    String append   = getAttribute("append");

    // Verify that the filename is in fact set
    if ((filename == null) || (filename.equals(EMPTYSTRING))) {
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "file");
    }

    // Save filename as an attribute value template
    _filename = AttributeValue.create(this, filename, parser);

    if (append != null && (append.toLowerCase().equals("yes") ||
        append.toLowerCase().equals("true"))) {
      _append = true;
    }
    else
      _append = false;

    parseChildren(parser);
}
 
源代码3 项目: jdk1.8-source-analysis   文件: If.java
/**
 * Parse the "test" expression and contents of this element.
 */
public void parseContents(Parser parser) {
    // Parse the "test" expression
    _test = parser.parseExpression(this, "test", null);

    // Make sure required attribute(s) have been set
    if (_test.isDummy()) {
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "test");
        return;
    }

    // Ignore xsl:if when test is false (function-available() and
    // element-available())
    Object result = _test.evaluateAtCompileTime();
    if (result != null && result instanceof Boolean) {
        _ignore = !((Boolean) result).booleanValue();
    }

    parseChildren(parser);
}
 
源代码4 项目: openjdk-jdk8u   文件: When.java
public void parseContents(Parser parser) {
    _test = parser.parseExpression(this, "test", null);

    // Ignore xsl:if when test is false (function-available() and
    // element-available())
    Object result = _test.evaluateAtCompileTime();
    if (result != null && result instanceof Boolean) {
        _ignore = !((Boolean) result).booleanValue();
    }

    parseChildren(parser);

    // Make sure required attribute(s) have been set
    if (_test.isDummy()) {
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "test");
    }
}
 
源代码5 项目: TencentKona-8   文件: TransletOutput.java
/**
 * Parse the contents of this <xsltc:output> element. The only attribute
 * we recognise is the 'file' attribute that contains teh output filename.
 */
public void parseContents(Parser parser) {
    // Get the output filename from the 'file' attribute
    String filename = getAttribute("file");

    // If the 'append' attribute is set to "yes" or "true",
    // the output is appended to the file.
    String append   = getAttribute("append");

    // Verify that the filename is in fact set
    if ((filename == null) || (filename.equals(EMPTYSTRING))) {
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "file");
    }

    // Save filename as an attribute value template
    _filename = AttributeValue.create(this, filename, parser);

    if (append != null && (append.toLowerCase().equals("yes") ||
        append.toLowerCase().equals("true"))) {
      _append = true;
    }
    else
      _append = false;

    parseChildren(parser);
}
 
源代码6 项目: hottub   文件: WithParam.java
/**
 * The contents of a <xsl:with-param> elements are either in the element's
 * 'select' attribute (this has precedence) or in the element body.
 */
public void parseContents(Parser parser) {
    final String name = getAttribute("name");
    if (name.length() > 0) {
        if (!XML11Char.isXML11ValidQName(name)) {
            ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name,
                                        this);
            parser.reportError(Constants.ERROR, err);
        }
        setName(parser.getQNameIgnoreDefaultNs(name));
    }
    else {
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name");
    }

    final String select = getAttribute("select");
    if (select.length() > 0) {
        _select = parser.parseExpression(this, "select", null);
    }

    parseChildren(parser);
}
 
源代码7 项目: jdk8u60   文件: When.java
public void parseContents(Parser parser) {
    _test = parser.parseExpression(this, "test", null);

    // Ignore xsl:if when test is false (function-available() and
    // element-available())
    Object result = _test.evaluateAtCompileTime();
    if (result != null && result instanceof Boolean) {
        _ignore = !((Boolean) result).booleanValue();
    }

    parseChildren(parser);

    // Make sure required attribute(s) have been set
    if (_test.isDummy()) {
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "test");
    }
}
 
源代码8 项目: hottub   文件: TransformerImpl.java
/**
 * Receive notification of a recoverable error.
 * The transformer must continue to provide normal parsing events after
 * invoking this method. It should still be possible for the application
 * to process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void error(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
源代码9 项目: openjdk-8   文件: TransformerImpl.java
/**
 * Receive notification of a non-recoverable error.
 * The application must assume that the transformation cannot continue
 * after the Transformer has invoked this method, and should continue
 * (if at all) only to collect addition error messages. In fact,
 * Transformers are free to stop reporting events once this method has
 * been invoked.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void fatalError(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
源代码10 项目: jdk8u60   文件: TransformerFactoryImpl.java
/**
 * Receive notification of a non-recoverable error.
 * The application must assume that the transformation cannot continue
 * after the Transformer has invoked this method, and should continue
 * (if at all) only to collect addition error messages. In fact,
 * Transformers are free to stop reporting events once this method has
 * been invoked.
 *
 * @param e warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (always does in our case).
 */
@Override
public void fatalError(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                        e.getMessageAndLocation()));
    }
    throw e;
}
 
源代码11 项目: jdk8u60   文件: ProcessingInstruction.java
public void parseContents(Parser parser) {
    final String name  = getAttribute("name");

    if (name.length() > 0) {
        _isLiteral = Util.isLiteral(name);
        if (_isLiteral) {
            if (!XML11Char.isXML11ValidNCName(name)) {
                ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_NCNAME_ERR, name, this);
                parser.reportError(Constants.ERROR, err);
            }
        }
        _name = AttributeValue.create(this, name, parser);
    }
    else
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name");

    if (name.equals("xml")) {
        reportError(this, parser, ErrorMsg.ILLEGAL_PI_ERR, "xml");
    }
    parseChildren(parser);
}
 
源代码12 项目: openjdk-jdk9   文件: Parser.java
private QName getQName(final String stringRep, boolean reportError,
    boolean ignoreDefaultNs)
{
    // parse and retrieve namespace
    final int colon = stringRep.lastIndexOf(':');
    if (colon != -1) {
        final String prefix = stringRep.substring(0, colon);
        final String localname = stringRep.substring(colon + 1);
        String namespace = null;

        // Get the namespace uri from the symbol table
        if (prefix.equals(XMLNS_PREFIX) == false) {
            namespace = _symbolTable.lookupNamespace(prefix);
            if (namespace == null && reportError) {
                final int line = getLineNumber();
                ErrorMsg err = new ErrorMsg(ErrorMsg.NAMESPACE_UNDEF_ERR,
                                            line, prefix);
                reportError(ERROR, err);
            }
        }
        return getQName(namespace, prefix, localname);
    }
    else {
        if (stringRep.equals(XMLNS_PREFIX)) {
            ignoreDefaultNs = true;
        }
        final String defURI = ignoreDefaultNs ? null
                              : _symbolTable.lookupNamespace(EMPTYSTRING);
        return getQName(defURI, null, stringRep);
    }
}
 
源代码13 项目: TencentKona-8   文件: Sort.java
/**
 * Parse the attributes of the xsl:sort element
 */
public void parseContents(Parser parser) {

    final SyntaxTreeNode parent = getParent();
    if (!(parent instanceof ApplyTemplates) &&
        !(parent instanceof ForEach)) {
        reportError(this, parser, ErrorMsg.STRAY_SORT_ERR, null);
        return;
    }

    // Parse the select expression (node string value if no expression)
    _select = parser.parseExpression(this, "select", "string(.)");

    // Get the sort order; default is 'ascending'
    String val = getAttribute("order");
    if (val.length() == 0) val = "ascending";
    _order = AttributeValue.create(this, val, parser);

    // Get the sort data type; default is text
    val = getAttribute("data-type");
    if (val.length() == 0) {
        try {
            final Type type = _select.typeCheck(parser.getSymbolTable());
            if (type instanceof IntType)
                val = "number";
            else
                val = "text";
        }
        catch (TypeCheckError e) {
            val = "text";
        }
    }
    _dataType = AttributeValue.create(this, val, parser);

    val =  getAttribute("lang");
    _lang = AttributeValue.create(this, val, parser);
    // Get the case order; default is language dependant
    val = getAttribute("case-order");
    _caseOrder = AttributeValue.create(this, val, parser);
}
 
源代码14 项目: hottub   文件: TransformerImpl.java
/**
 * Receive notification of a warning.
 * Transformers can use this method to report conditions that are not
 * errors or fatal errors. The default behaviour is to take no action.
 * After invoking this method, the Transformer must continue with the
 * transformation. It should still be possible for the application to
 * process the document through to the end.
 *
 * @param e The warning information encapsulated in a transformer
 * exception.
 * @throws TransformerException if the application chooses to discontinue
 * the transformation (never does in our case).
 */
@Override
public void warning(TransformerException e)
    throws TransformerException
{
    Throwable wrapped = e.getException();
    if (wrapped != null) {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
                                        e.getMessageAndLocation(),
                                        wrapped.getMessage()));
    } else {
        System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG,
                                        e.getMessageAndLocation()));
    }
}
 
源代码15 项目: openjdk-jdk8u   文件: TransformerFactoryImpl.java
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Set the error event listener for the TransformerFactory, which is used
 * for the processing of transformation instructions, and not for the
 * transformation itself.
 *
 * @param listener The error listener to use with the TransformerFactory
 * @throws IllegalArgumentException
 */
@Override
public void setErrorListener(ErrorListener listener)
    throws IllegalArgumentException
{
    if (listener == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR,
                                    "TransformerFactory");
        throw new IllegalArgumentException(err.toString());
    }
    _errorListener = listener;
}
 
源代码16 项目: openjdk-jdk9   文件: VariableBase.java
/**
 * Parse the contents of the <xsl:decimal-format> element.
 */
public void parseContents(Parser parser) {
    // Get the 'name attribute
    String name = getAttribute("name");

    if (name.length() > 0) {
        if (!XML11Char.isXML11ValidQName(name)) {
            ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this);
            parser.reportError(Constants.ERROR, err);
        }
        setName(parser.getQNameIgnoreDefaultNs(name));
    }
    else
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name");

    // Check whether variable/param of the same name is already in scope
    VariableBase other = parser.lookupVariable(_name);
    if ((other != null) && (other.getParent() == getParent())) {
        reportError(this, parser, ErrorMsg.VARIABLE_REDEF_ERR, name);
    }

    select = getAttribute("select");
    if (select.length() > 0) {
        _select = getParser().parseExpression(this, "select", null);
        if (_select.isDummy()) {
            reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "select");
            return;
        }
    }

    // Children must be parsed first -> static scoping
    parseChildren(parser);
}
 
源代码17 项目: jdk8u60   文件: ForEach.java
public void parseContents(Parser parser) {
    _select = parser.parseExpression(this, "select", null);

    parseChildren(parser);

    // make sure required attribute(s) have been set
    if (_select.isDummy()) {
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "select");
    }
}
 
源代码18 项目: openjdk-jdk8u-backup   文件: TransformerImpl.java
/**
 * Implements JAXP's Transformer.getOutputProperty().
 * Get an output property that is in effect for the transformation. The
 * property specified may be a property that was set with setOutputProperty,
 * or it may be a property specified in the stylesheet.
 *
 * @param name A non-null string that contains the name of the property
 * @throws IllegalArgumentException if the property name is not known
 */
@Override
public String getOutputProperty(String name)
    throws IllegalArgumentException
{
    if (!validOutputProperty(name)) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
        throw new IllegalArgumentException(err.toString());
    }
    return _properties.getProperty(name);
}
 
源代码19 项目: jdk1.8-source-analysis   文件: TransformerImpl.java
/**
 * Implements JAXP's Transformer.getOutputProperty().
 * Get an output property that is in effect for the transformation. The
 * property specified may be a property that was set with setOutputProperty,
 * or it may be a property specified in the stylesheet.
 *
 * @param name A non-null string that contains the name of the property
 * @throws IllegalArgumentException if the property name is not known
 */
@Override
public String getOutputProperty(String name)
    throws IllegalArgumentException
{
    if (!validOutputProperty(name)) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
        throw new IllegalArgumentException(err.toString());
    }
    return _properties.getProperty(name);
}
 
源代码20 项目: openjdk-8-source   文件: Variable.java
/**
 * Parse the contents of the variable
 */
public void parseContents(Parser parser) {
    // Parse 'name' and 'select' attributes plus parameter contents
    super.parseContents(parser);

    // Add a ref to this var to its enclosing construct
    SyntaxTreeNode parent = getParent();
    if (parent instanceof Stylesheet) {
        // Mark this as a global variable
        _isLocal = false;
        // Check if a global variable with this name already exists...
        Variable var = parser.getSymbolTable().lookupVariable(_name);
        // ...and if it does we need to check import precedence
        if (var != null) {
            final int us = this.getImportPrecedence();
            final int them = var.getImportPrecedence();
            // It is an error if the two have the same import precedence
            if (us == them) {
                final String name = _name.toString();
                reportError(this, parser, ErrorMsg.VARIABLE_REDEF_ERR,name);
            }
            // Ignore this if previous definition has higher precedence
            else if (them > us) {
                _ignore = true;
                copyReferences(var);
                return;
            }
            else {
                var.copyReferences(this);
                var.disable();
            }
            // Add this variable if we have higher precedence
        }
        ((Stylesheet)parent).addVariable(this);
        parser.getSymbolTable().addVariable(this);
    }
    else {
        _isLocal = true;
    }
}
 
源代码21 项目: Bytecoder   文件: TransformerImpl.java
/**
 * Implements JAXP's Transformer.getOutputProperty().
 * Get an output property that is in effect for the transformation. The
 * property specified may be a property that was set with setOutputProperty,
 * or it may be a property specified in the stylesheet.
 *
 * @param name A non-null string that contains the name of the property
 * @throws IllegalArgumentException if the property name is not known
 */
@Override
public String getOutputProperty(String name)
    throws IllegalArgumentException
{
    if (!validOutputProperty(name)) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
        throw new IllegalArgumentException(err.toString());
    }
    return _properties.getProperty(name);
}
 
源代码22 项目: JDKSourceCode1.8   文件: TransformerFactoryImpl.java
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Set the error event listener for the TransformerFactory, which is used
 * for the processing of transformation instructions, and not for the
 * transformation itself.
 *
 * @param listener The error listener to use with the TransformerFactory
 * @throws IllegalArgumentException
 */
@Override
public void setErrorListener(ErrorListener listener)
    throws IllegalArgumentException
{
    if (listener == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR,
                                    "TransformerFactory");
        throw new IllegalArgumentException(err.toString());
    }
    _errorListener = listener;
}
 
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Set the error event listener for the TransformerFactory, which is used
 * for the processing of transformation instructions, and not for the
 * transformation itself.
 *
 * @param listener The error listener to use with the TransformerFactory
 * @throws IllegalArgumentException
 */
@Override
public void setErrorListener(ErrorListener listener)
    throws IllegalArgumentException
{
    if (listener == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR,
                                    "TransformerFactory");
        throw new IllegalArgumentException(err.toString());
    }
    _errorListener = listener;
}
 
源代码24 项目: jdk1.8-source-analysis   文件: Variable.java
/**
 * Parse the contents of the variable
 */
public void parseContents(Parser parser) {
    // Parse 'name' and 'select' attributes plus parameter contents
    super.parseContents(parser);

    // Add a ref to this var to its enclosing construct
    SyntaxTreeNode parent = getParent();
    if (parent instanceof Stylesheet) {
        // Mark this as a global variable
        _isLocal = false;
        // Check if a global variable with this name already exists...
        Variable var = parser.getSymbolTable().lookupVariable(_name);
        // ...and if it does we need to check import precedence
        if (var != null) {
            final int us = this.getImportPrecedence();
            final int them = var.getImportPrecedence();
            // It is an error if the two have the same import precedence
            if (us == them) {
                final String name = _name.toString();
                reportError(this, parser, ErrorMsg.VARIABLE_REDEF_ERR,name);
            }
            // Ignore this if previous definition has higher precedence
            else if (them > us) {
                _ignore = true;
                copyReferences(var);
                return;
            }
            else {
                var.copyReferences(this);
                var.disable();
            }
            // Add this variable if we have higher precedence
        }
        ((Stylesheet)parent).addVariable(this);
        parser.getSymbolTable().addVariable(this);
    }
    else {
        _isLocal = true;
    }
}
 
源代码25 项目: openjdk-jdk8u   文件: CopyOf.java
public void parseContents(Parser parser) {
    _select = parser.parseExpression(this, "select", null);
    // make sure required attribute(s) have been set
    if (_select.isDummy()) {
        reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "select");
        return;
    }
}
 
源代码26 项目: openjdk-8   文件: TransformerImpl.java
/**
 * Implements JAXP's Transformer.setOutputProperty().
 * Get an output property that is in effect for the transformation. The
 * property specified may be a property that was set with
 * setOutputProperty(), or it may be a property specified in the stylesheet.
 *
 * @param name The name of the property to set
 * @param value The value to assign to the property
 * @throws IllegalArgumentException Never, errors are ignored
 */
@Override
public void setOutputProperty(String name, String value)
    throws IllegalArgumentException
{
    if (!validOutputProperty(name)) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
        throw new IllegalArgumentException(err.toString());
    }
    _properties.setProperty(name, value);
}
 
源代码27 项目: jdk8u60   文件: Parser.java
/**
 * Common error/warning message handler
 */
public void reportError(final int category, final ErrorMsg error) {
    switch (category) {
    case Constants.INTERNAL:
        // Unexpected internal errors, such as null-ptr exceptions, etc.
        // Immediately terminates compilation, no translet produced
        _errors.addElement(error);
        break;
    case Constants.UNSUPPORTED:
        // XSLT elements that are not implemented and unsupported ext.
        // Immediately terminates compilation, no translet produced
        _errors.addElement(error);
        break;
    case Constants.FATAL:
        // Fatal error in the stylesheet input (parsing or content)
        // Immediately terminates compilation, no translet produced
        _errors.addElement(error);
        break;
    case Constants.ERROR:
        // Other error in the stylesheet input (parsing or content)
        // Does not terminate compilation, no translet produced
        _errors.addElement(error);
        break;
    case Constants.WARNING:
        // Other error in the stylesheet input (content errors only)
        // Does not terminate compilation, a translet is produced
        _warnings.addElement(error);
        break;
    }
}
 
源代码28 项目: hottub   文件: AttributeValueTemplate.java
public AttributeValueTemplate(String value, Parser parser,
    SyntaxTreeNode parent)
{
    setParent(parent);
    setParser(parser);

    try {
        parseAVTemplate(value, parser);
    }
    catch (NoSuchElementException e) {
        reportError(parent, parser,
                    ErrorMsg.ATTR_VAL_TEMPLATE_ERR, value);
    }
}
 
源代码29 项目: openjdk-8   文件: Parser.java
/**
 * Create an instance of the <code>Stylesheet</code> class,
 * and then parse, typecheck and compile the instance.
 * Must be called after <code>parse()</code>.
 */
public Stylesheet makeStylesheet(SyntaxTreeNode element)
    throws CompilerException {
    try {
        Stylesheet stylesheet;

        if (element instanceof Stylesheet) {
            stylesheet = (Stylesheet)element;
        }
        else {
            stylesheet = new Stylesheet();
            stylesheet.setSimplified();
            stylesheet.addElement(element);
            stylesheet.setAttributes((AttributesImpl) element.getAttributes());

            // Map the default NS if not already defined
            if (element.lookupNamespace(EMPTYSTRING) == null) {
                element.addPrefixMapping(EMPTYSTRING, EMPTYSTRING);
            }
        }
        stylesheet.setParser(this);
        return stylesheet;
    }
    catch (ClassCastException e) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.NOT_STYLESHEET_ERR, element);
        throw new CompilerException(err.toString());
    }
}
 
源代码30 项目: Bytecoder   文件: XPathParser.java
public RelativeLocationPath insertStep(Step step, RelativeLocationPath rlp) {
    if (rlp instanceof Step) {
        return new ParentLocationPath(step, (Step) rlp);
    } else if (rlp instanceof ParentLocationPath) {
        final ParentLocationPath plp = (ParentLocationPath) rlp;
        final RelativeLocationPath newrlp = insertStep(step, plp.getPath());
        return new ParentLocationPath(newrlp, plp.getStep());
    } else {
        addError(new ErrorMsg(ErrorMsg.INTERNAL_ERR, "XPathParser.insertStep"));
        return rlp;
    }
}