org.apache.xml.utils.XML11Char.isXML11ValidNCName()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.apache.xml.utils.XML11Char.isXML11ValidNCName()方法的一些代码示例,展示了XML11Char.isXML11ValidNCName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XML11Char.isXML11ValidNCName()方法的具体详情如下:
包路径:org.apache.xml.utils.XML11Char
类名称:XML11Char
方法名:isXML11ValidNCName

XML11Char.isXML11ValidNCName介绍

[英]Check to see if a string is a valid NCName according to [4] from the XML Namespaces 1.1 Recommendation
[中]根据XML名称空间1.1建议中的[4],检查字符串是否为有效的NCName

代码示例

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Simple check to determine if qname is legal. If it returns false
  3. * then <param>str</param> is illegal; if it returns true then
  4. * <param>str</param> is legal.
  5. */
  6. public static boolean isXML11ValidQName(String str) {
  7. final int colon = str.indexOf(':');
  8. if (colon == 0 || colon == str.length() - 1) {
  9. return false;
  10. }
  11. if (colon > 0) {
  12. final String prefix = str.substring(0,colon);
  13. final String localPart = str.substring(colon+1);
  14. return isXML11ValidNCName(prefix) && isXML11ValidNCName(localPart);
  15. }
  16. else {
  17. return isXML11ValidNCName(str);
  18. }
  19. }

代码示例来源:origin: xalan/xalan

  1. /**
  2. * Simple check to determine if qname is legal. If it returns false
  3. * then <param>str</param> is illegal; if it returns true then
  4. * <param>str</param> is legal.
  5. */
  6. public static boolean isXML11ValidQName(String str) {
  7. final int colon = str.indexOf(':');
  8. if (colon == 0 || colon == str.length() - 1) {
  9. return false;
  10. }
  11. if (colon > 0) {
  12. final String prefix = str.substring(0,colon);
  13. final String localPart = str.substring(colon+1);
  14. return isXML11ValidNCName(prefix) && isXML11ValidNCName(localPart);
  15. }
  16. else {
  17. return isXML11ValidNCName(str);
  18. }
  19. }

代码示例来源:origin: xalan/xalan

  1. /**
  2. * Utility function to check if a name is a valid ncname
  3. * This method should only be invoked if the attribute value is an AVT
  4. */
  5. public static void checkNCName(String name) {
  6. if (!XML11Char.isXML11ValidNCName(name)) {
  7. runTimeError(INVALID_NCNAME_ERR,name);
  8. }
  9. }

代码示例来源:origin: xalan/xalan

  1. if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
  2. if (!XML11Char.isXML11ValidNCName(newPrefix)) {
  3. runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
  4. if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
  5. runTimeError(INVALID_QNAME_ERR,localName);

代码示例来源:origin: robovm/robovm

  1. if (!XML11Char.isXML11ValidNCName(localName))
  2. if ((null != prefix) && (!XML11Char.isXML11ValidNCName(prefix)))

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Constructs a new QName with the specified namespace URI and
  3. * local name.
  4. *
  5. * @param namespaceURI The namespace URI if known, or null
  6. * @param localName The local name
  7. * @param validate If true the new QName will be validated and an IllegalArgumentException will
  8. * be thrown if it is invalid.
  9. */
  10. public QName(String namespaceURI, String localName, boolean validate)
  11. {
  12. // This check was already here. So, for now, I will not add it to the validation
  13. // that is done when the validate parameter is true.
  14. if (localName == null)
  15. throw new IllegalArgumentException(XMLMessages.createXMLMessage(
  16. XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null");
  17. if (validate)
  18. {
  19. if (!XML11Char.isXML11ValidNCName(localName))
  20. {
  21. throw new IllegalArgumentException(XMLMessages.createXMLMessage(
  22. XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName");
  23. }
  24. }
  25. _namespaceURI = namespaceURI;
  26. _localName = localName;
  27. m_hashCode = toString().hashCode();
  28. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Construct a QName from a string, without namespace resolution. Good
  3. * for a few odd cases.
  4. *
  5. * @param localName Local part of qualified name
  6. * @param validate If true the new QName will be validated and an IllegalArgumentException will
  7. * be thrown if it is invalid.
  8. */
  9. public QName(String localName, boolean validate)
  10. {
  11. // This check was already here. So, for now, I will not add it to the validation
  12. // that is done when the validate parameter is true.
  13. if (localName == null)
  14. throw new IllegalArgumentException(XMLMessages.createXMLMessage(
  15. XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null");
  16. if (validate)
  17. {
  18. if (!XML11Char.isXML11ValidNCName(localName))
  19. {
  20. throw new IllegalArgumentException(XMLMessages.createXMLMessage(
  21. XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName");
  22. }
  23. }
  24. _namespaceURI = null;
  25. _localName = localName;
  26. m_hashCode = toString().hashCode();
  27. }

代码示例来源:origin: xalan/xalan

  1. if (!XML11Char.isXML11ValidNCName(localName))
  2. if ((null != prefix) && (!XML11Char.isXML11ValidNCName(prefix)))

代码示例来源:origin: xalan/xalan

  1. /**
  2. * Construct a QName from a string, without namespace resolution. Good
  3. * for a few odd cases.
  4. *
  5. * @param localName Local part of qualified name
  6. * @param validate If true the new QName will be validated and an IllegalArgumentException will
  7. * be thrown if it is invalid.
  8. */
  9. public QName(String localName, boolean validate)
  10. {
  11. // This check was already here. So, for now, I will not add it to the validation
  12. // that is done when the validate parameter is true.
  13. if (localName == null)
  14. throw new IllegalArgumentException(XMLMessages.createXMLMessage(
  15. XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null");
  16. if (validate)
  17. {
  18. if (!XML11Char.isXML11ValidNCName(localName))
  19. {
  20. throw new IllegalArgumentException(XMLMessages.createXMLMessage(
  21. XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName");
  22. }
  23. }
  24. _namespaceURI = null;
  25. _localName = localName;
  26. m_hashCode = toString().hashCode();
  27. }

代码示例来源:origin: robovm/robovm

  1. if (!XML11Char.isXML11ValidNCName(prefix))
  2. (!XML11Char.isXML11ValidNCName(localName)))

代码示例来源:origin: xalan/xalan

  1. /**
  2. * Constructs a new QName with the specified namespace URI and
  3. * local name.
  4. *
  5. * @param namespaceURI The namespace URI if known, or null
  6. * @param localName The local name
  7. * @param validate If true the new QName will be validated and an IllegalArgumentException will
  8. * be thrown if it is invalid.
  9. */
  10. public QName(String namespaceURI, String localName, boolean validate)
  11. {
  12. // This check was already here. So, for now, I will not add it to the validation
  13. // that is done when the validate parameter is true.
  14. if (localName == null)
  15. throw new IllegalArgumentException(XMLMessages.createXMLMessage(
  16. XMLErrorResources.ER_ARG_LOCALNAME_NULL, null)); //"Argument 'localName' is null");
  17. if (validate)
  18. {
  19. if (!XML11Char.isXML11ValidNCName(localName))
  20. {
  21. throw new IllegalArgumentException(XMLMessages.createXMLMessage(
  22. XMLErrorResources.ER_ARG_LOCALNAME_INVALID,null )); //"Argument 'localName' not a valid NCName");
  23. }
  24. }
  25. _namespaceURI = namespaceURI;
  26. _localName = localName;
  27. m_hashCode = toString().hashCode();
  28. }

代码示例来源:origin: robovm/robovm

  1. if ((_localName == null) || (!XML11Char.isXML11ValidNCName(_localName)))

代码示例来源:origin: xalan/xalan

  1. if (!XML11Char.isXML11ValidNCName(prefix))
  2. (!XML11Char.isXML11ValidNCName(localName)))

代码示例来源:origin: robovm/robovm

  1. if ((_localName == null) || (!XML11Char.isXML11ValidNCName(_localName)))

代码示例来源:origin: robovm/robovm

  1. if ((_localName == null) || (!XML11Char.isXML11ValidNCName(_localName)))

代码示例来源:origin: robovm/robovm

  1. if ((avt.isSimple()) && (!XML11Char.isXML11ValidNCName(value)))
  2. if (!XML11Char.isXML11ValidNCName(value))

代码示例来源:origin: xalan/xalan

  1. if ((avt.isSimple()) && (!XML11Char.isXML11ValidNCName(value)))
  2. if (!XML11Char.isXML11ValidNCName(value))

代码示例来源:origin: xalan/xalan

  1. public void parseContents(Parser parser) {
  2. final String name = getAttribute("name");
  3. if (name.length() > 0) {
  4. _isLiteral = Util.isLiteral(name);
  5. if (_isLiteral) {
  6. if (!XML11Char.isXML11ValidNCName(name)) {
  7. ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_NCNAME_ERR, name, this);
  8. parser.reportError(Constants.ERROR, err);
  9. }
  10. }
  11. _name = AttributeValue.create(this, name, parser);
  12. }
  13. else
  14. reportError(this, parser, ErrorMsg.REQUIRED_ATTR_ERR, "name");
  15. if (name.equals("xml")) {
  16. reportError(this, parser, ErrorMsg.ILLEGAL_PI_ERR, "xml");
  17. }
  18. parseChildren(parser);
  19. }

代码示例来源:origin: robovm/robovm

  1. else if ((!m_name_atv.isSimple()) && (!XML11Char.isXML11ValidNCName(piName)))

代码示例来源:origin: xalan/xalan

  1. else if ((!m_name_atv.isSimple()) && (!XML11Char.isXML11ValidNCName(piName)))

相关文章