Java Code Examples for com.sun.org.apache.xml.internal.utils.XML11Char#isXML11ValidNCName()

The following examples show how to use com.sun.org.apache.xml.internal.utils.XML11Char#isXML11ValidNCName() . 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: ProcessingInstruction.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 2
Source File: ProcessingInstruction.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: ProcessingInstruction.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 4
Source File: ProcessingInstruction.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 5
Source File: ProcessingInstruction.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
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);
}
 
Example 6
Source File: ProcessingInstruction.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 7
Source File: BasisLibrary.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility function to check if xsl:attribute has a valid qname
 * This method should only be invoked if the name attribute is an AVT
 */
public static void checkAttribQName(String name) {
    final int firstOccur = name.indexOf(":");
    final int lastOccur = name.lastIndexOf(":");
    final String localName = name.substring(lastOccur + 1);

    if (firstOccur > 0) {
        final String newPrefix = name.substring(0, firstOccur);

        if (firstOccur != lastOccur) {
           final String oriPrefix = name.substring(firstOccur+1, lastOccur);
            if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
                // even though the orignal prefix is ignored, it should still get checked for valid NCName
                runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName);
            }
        }

        // prefix must be a valid NCName
        if (!XML11Char.isXML11ValidNCName(newPrefix)) {
            runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
        }
    }

    // local name must be a valid NCName and must not be XMLNS
    if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
        runTimeError(INVALID_QNAME_ERR,localName);
    }
}
 
Example 8
Source File: BasisLibrary.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility function to check if xsl:attribute has a valid qname
 * This method should only be invoked if the name attribute is an AVT
 */
public static void checkAttribQName(String name) {
    final int firstOccur = name.indexOf(':');
    final int lastOccur = name.lastIndexOf(':');
    final String localName = name.substring(lastOccur + 1);

    if (firstOccur > 0) {
        final String newPrefix = name.substring(0, firstOccur);

        if (firstOccur != lastOccur) {
           final String oriPrefix = name.substring(firstOccur+1, lastOccur);
            if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
                // even though the orignal prefix is ignored, it should still get checked for valid NCName
                runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName);
            }
        }

        // prefix must be a valid NCName
        if (!XML11Char.isXML11ValidNCName(newPrefix)) {
            runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
        }
    }

    // local name must be a valid NCName and must not be XMLNS
    if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
        runTimeError(INVALID_QNAME_ERR,localName);
    }
}
 
Example 9
Source File: BasisLibrary.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Utility function to check if xsl:attribute has a valid qname
 * This method should only be invoked if the name attribute is an AVT
 */
public static void checkAttribQName(String name) {
    final int firstOccur = name.indexOf(':');
    final int lastOccur = name.lastIndexOf(':');
    final String localName = name.substring(lastOccur + 1);

    if (firstOccur > 0) {
        final String newPrefix = name.substring(0, firstOccur);

        if (firstOccur != lastOccur) {
           final String oriPrefix = name.substring(firstOccur+1, lastOccur);
            if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
                // even though the orignal prefix is ignored, it should still get checked for valid NCName
                runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName);
            }
        }

        // prefix must be a valid NCName
        if (!XML11Char.isXML11ValidNCName(newPrefix)) {
            runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
        }
    }

    // local name must be a valid NCName and must not be XMLNS
    if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
        runTimeError(INVALID_QNAME_ERR,localName);
    }
}
 
Example 10
Source File: BasisLibrary.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility function to check if xsl:attribute has a valid qname
 * This method should only be invoked if the name attribute is an AVT
 */
public static void checkAttribQName(String name) {
    final int firstOccur = name.indexOf(":");
    final int lastOccur = name.lastIndexOf(":");
    final String localName = name.substring(lastOccur + 1);

    if (firstOccur > 0) {
        final String newPrefix = name.substring(0, firstOccur);

        if (firstOccur != lastOccur) {
           final String oriPrefix = name.substring(firstOccur+1, lastOccur);
            if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
                // even though the orignal prefix is ignored, it should still get checked for valid NCName
                runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName);
            }
        }

        // prefix must be a valid NCName
        if (!XML11Char.isXML11ValidNCName(newPrefix)) {
            runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
        }
    }

    // local name must be a valid NCName and must not be XMLNS
    if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
        runTimeError(INVALID_QNAME_ERR,localName);
    }
}
 
Example 11
Source File: BasisLibrary.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Utility function to check if xsl:attribute has a valid qname
 * This method should only be invoked if the name attribute is an AVT
 */
public static void checkAttribQName(String name) {
    final int firstOccur = name.indexOf(":");
    final int lastOccur = name.lastIndexOf(":");
    final String localName = name.substring(lastOccur + 1);

    if (firstOccur > 0) {
        final String newPrefix = name.substring(0, firstOccur);

        if (firstOccur != lastOccur) {
           final String oriPrefix = name.substring(firstOccur+1, lastOccur);
            if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
                // even though the orignal prefix is ignored, it should still get checked for valid NCName
                runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName);
            }
        }

        // prefix must be a valid NCName
        if (!XML11Char.isXML11ValidNCName(newPrefix)) {
            runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
        }
    }

    // local name must be a valid NCName and must not be XMLNS
    if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
        runTimeError(INVALID_QNAME_ERR,localName);
    }
}
 
Example 12
Source File: BasisLibrary.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Utility function to check if xsl:attribute has a valid qname
 * This method should only be invoked if the name attribute is an AVT
 */
public static void checkAttribQName(String name) {
    final int firstOccur = name.indexOf(":");
    final int lastOccur = name.lastIndexOf(":");
    final String localName = name.substring(lastOccur + 1);

    if (firstOccur > 0) {
        final String newPrefix = name.substring(0, firstOccur);

        if (firstOccur != lastOccur) {
           final String oriPrefix = name.substring(firstOccur+1, lastOccur);
            if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
                // even though the orignal prefix is ignored, it should still get checked for valid NCName
                runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName);
            }
        }

        // prefix must be a valid NCName
        if (!XML11Char.isXML11ValidNCName(newPrefix)) {
            runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
        }
    }

    // local name must be a valid NCName and must not be XMLNS
    if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
        runTimeError(INVALID_QNAME_ERR,localName);
    }
}
 
Example 13
Source File: BasisLibrary.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility function to check if xsl:attribute has a valid qname
 * This method should only be invoked if the name attribute is an AVT
 */
public static void checkAttribQName(String name) {
    final int firstOccur = name.indexOf(':');
    final int lastOccur = name.lastIndexOf(':');
    final String localName = name.substring(lastOccur + 1);

    if (firstOccur > 0) {
        final String newPrefix = name.substring(0, firstOccur);

        if (firstOccur != lastOccur) {
           final String oriPrefix = name.substring(firstOccur+1, lastOccur);
            if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
                // even though the orignal prefix is ignored, it should still get checked for valid NCName
                runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName);
            }
        }

        // prefix must be a valid NCName
        if (!XML11Char.isXML11ValidNCName(newPrefix)) {
            runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
        }
    }

    // local name must be a valid NCName and must not be XMLNS
    if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
        runTimeError(INVALID_QNAME_ERR,localName);
    }
}
 
Example 14
Source File: BasisLibrary.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Utility function to check if xsl:attribute has a valid qname
 * This method should only be invoked if the name attribute is an AVT
 */
public static void checkAttribQName(String name) {
    final int firstOccur = name.indexOf(":");
    final int lastOccur = name.lastIndexOf(":");
    final String localName = name.substring(lastOccur + 1);

    if (firstOccur > 0) {
        final String newPrefix = name.substring(0, firstOccur);

        if (firstOccur != lastOccur) {
           final String oriPrefix = name.substring(firstOccur+1, lastOccur);
            if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
                // even though the orignal prefix is ignored, it should still get checked for valid NCName
                runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName);
            }
        }

        // prefix must be a valid NCName
        if (!XML11Char.isXML11ValidNCName(newPrefix)) {
            runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
        }
    }

    // local name must be a valid NCName and must not be XMLNS
    if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
        runTimeError(INVALID_QNAME_ERR,localName);
    }
}
 
Example 15
Source File: BasisLibrary.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Utility function to check if a name is a valid ncname
 * This method should only be invoked if the attribute value is an AVT
 */
public static void checkNCName(String name) {
    if (!XML11Char.isXML11ValidNCName(name)) {
        runTimeError(INVALID_NCNAME_ERR,name);
    }
}
 
Example 16
Source File: BasisLibrary.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Utility function to check if a name is a valid ncname
 * This method should only be invoked if the attribute value is an AVT
 */
public static void checkNCName(String name) {
    if (!XML11Char.isXML11ValidNCName(name)) {
        runTimeError(INVALID_NCNAME_ERR,name);
    }
}
 
Example 17
Source File: BasisLibrary.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Utility function to check if a name is a valid ncname
 * This method should only be invoked if the attribute value is an AVT
 */
public static void checkNCName(String name) {
    if (!XML11Char.isXML11ValidNCName(name)) {
        runTimeError(INVALID_NCNAME_ERR,name);
    }
}
 
Example 18
Source File: BasisLibrary.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Utility function to check if a name is a valid ncname
 * This method should only be invoked if the attribute value is an AVT
 */
public static void checkNCName(String name) {
    if (!XML11Char.isXML11ValidNCName(name)) {
        runTimeError(INVALID_NCNAME_ERR,name);
    }
}
 
Example 19
Source File: BasisLibrary.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Utility function to check if a name is a valid ncname
 * This method should only be invoked if the attribute value is an AVT
 */
public static void checkNCName(String name) {
    if (!XML11Char.isXML11ValidNCName(name)) {
        runTimeError(INVALID_NCNAME_ERR,name);
    }
}
 
Example 20
Source File: BasisLibrary.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Utility function to check if a name is a valid ncname
 * This method should only be invoked if the attribute value is an AVT
 */
public static void checkNCName(String name) {
    if (!XML11Char.isXML11ValidNCName(name)) {
        runTimeError(INVALID_NCNAME_ERR,name);
    }
}