当前位置: 首页>>代码示例>>Java>>正文


Java DatatypeException类代码示例

本文整理汇总了Java中org.relaxng.datatype.DatatypeException的典型用法代码示例。如果您正苦于以下问题:Java DatatypeException类的具体用法?Java DatatypeException怎么用?Java DatatypeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DatatypeException类属于org.relaxng.datatype包,在下文中一共展示了DatatypeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDatatypeBuilder

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public DatatypeBuilder createDatatypeBuilder(String type)
    throws DatatypeException {
    if (type.equals("ID")
        || type.equals("IDREF")
        || type.equals("IDREFS")) {
        if (xsdDatatypeLibrary == null) {
            xsdDatatypeLibrary =
                factory.createDatatypeLibrary(
                    WellKnownNamespaces.XML_SCHEMA_DATATYPES);
            if (xsdDatatypeLibrary == null)
                throw new DatatypeException();
        }
        return xsdDatatypeLibrary.createDatatypeBuilder(type);
    }
    throw new DatatypeException();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:CompatibilityDatatypeLibrary.java

示例2: addParam

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public void addParam(String name, String value, Context context, String ns, Location loc, Annotations anno)
        throws BuildException {
    try {
        dtb.addParameter(name, value, new ValidationContextImpl(context, ns));
    } catch (DatatypeException e) {
        String detail = e.getMessage();
        int pos = e.getIndex();
        String displayedParam;
        if (pos == DatatypeException.UNKNOWN) {
            displayedParam = null;
        } else {
            displayedParam = displayParam(value, pos);
        }
        if (displayedParam != null) {
            if (detail != null) {
                error("invalid_param_detail_display", detail, displayedParam, (Locator) loc);
            } else {
                error("invalid_param_display", displayedParam, (Locator) loc);
            }
        } else if (detail != null) {
            error("invalid_param_detail", detail, (Locator) loc);
        } else {
            error("invalid_param", (Locator) loc);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:SchemaBuilderImpl.java

示例3: makeDataPatternBuilder

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, Location loc)
        throws BuildException {
    DatatypeLibrary dl = datatypeLibraryFactory.createDatatypeLibrary(datatypeLibrary);
    if (dl == null) {
        error("unrecognized_datatype_library", datatypeLibrary, (Locator) loc);
    } else {
        try {
            return new DataPatternBuilderImpl(dl.createDatatypeBuilder(type));
        } catch (DatatypeException e) {
            String detail = e.getMessage();
            if (detail != null) {
                error("unsupported_datatype_detail", datatypeLibrary, type, detail, (Locator) loc);
            } else {
                error("unrecognized_datatype", datatypeLibrary, type, (Locator) loc);
            }
        }
    }
    return new DummyDataPatternBuilder();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SchemaBuilderImpl.java

示例4: resolveType

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
Type resolveType(String value)
  throws DatatypeException
{
  QName name = QName.valueOf(value);
  String prefix = name.getPrefix();
  String localName = name.getLocalPart();
  if (prefix != null && prefix.length() > 0)
    {
      String uri = namespaceSupport.getURI(prefix);
      if (!XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(uri))
        return null;
    }
  if ("anyType".equals(localName))
    return Type.ANY_TYPE;
  return (SimpleType) typeLibrary.createDatatype(localName);
}
 
开发者ID:vilie,项目名称:javify,代码行数:17,代码来源:XMLSchemaValidatorHandler.java

示例5: parseWhiteSpaceFacet

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
WhiteSpaceFacet parseWhiteSpaceFacet(String value)
  throws DatatypeException
{
  int si = value.indexOf(' ');
  boolean fixed = false;
  if (si != -1)
    {
      if (!"FIXED".equalsIgnoreCase(value.substring(si + 1)))
        throw new DatatypeException("second argument must be FIXED if present");
      fixed = true;
      value = value.substring(0, si);
    }
  if ("preserve".equals(value))
    return new WhiteSpaceFacet(WhiteSpaceFacet.PRESERVE, fixed, null);
  if ("replace".equals(value))
    return new WhiteSpaceFacet(WhiteSpaceFacet.REPLACE, fixed, null);
  if ("collapse".equals(value))
    return new WhiteSpaceFacet(WhiteSpaceFacet.COLLAPSE, fixed, null);
  throw new DatatypeException("argument must be preserve, replace, or collapse");
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:TypeBuilder.java

示例6: parseTotalDigitsFacet

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
TotalDigitsFacet parseTotalDigitsFacet(String value)
  throws DatatypeException
{
  int si = value.indexOf(' ');
  boolean fixed = false;
  if (si != -1)
    {
      if (!"FIXED".equalsIgnoreCase(value.substring(si + 1)))
        throw new DatatypeException("second argument must be FIXED if present");
      fixed = true;
      value = value.substring(0, si);
    }
  int val = Integer.parseInt(value);
  if (val < 0)
    throw new DatatypeException("value must be a positiveInteger");
  return new TotalDigitsFacet(val, fixed, null);
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:TypeBuilder.java

示例7: parseFractionDigitsFacet

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
FractionDigitsFacet parseFractionDigitsFacet(String value)
  throws DatatypeException
{
  int si = value.indexOf(' ');
  boolean fixed = false;
  if (si != -1)
    {
      if (!"FIXED".equalsIgnoreCase(value.substring(si + 1)))
        throw new DatatypeException("second argument must be FIXED if present");
      fixed = true;
      value = value.substring(0, si);
    }
  int val = Integer.parseInt(value);
  if (val < 0)
    throw new DatatypeException("value must be a positiveInteger");
  return new FractionDigitsFacet(val, fixed, null);
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:TypeBuilder.java

示例8: checkValue

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public void checkValue(String value, ValidationContext context)
  throws DatatypeException
{
  super.checkValid(value, context);
  int len = value.length();
  if (len == 0)
    throw new DatatypeException(0, "invalid negative integer value");
  for (int i = 0; i < len; i++)
    {
      char c = value.charAt(i);
      if (c == '-')
        {
          if (i == 0)
            continue;
        }
      else if (c >= 0x30 && c <= 0x39)
          continue;
      throw new DatatypeException(i, "invalid negative integer value");
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:NegativeIntegerType.java

示例9: checkValid

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public void checkValid(String value, ValidationContext context)
  throws DatatypeException
{
  super.checkValid(value, context);
  int len = value.length();
  if (len == 0)
    throw new DatatypeException(0, "invalid token value");
  if (value.charAt(0) == ' ' || value.charAt(len - 1) == ' ')
    throw new DatatypeException(0, "invalid token value");
  char last = '\u0000';
  for (int i = 0; i < len; i++)
    {
      char c = value.charAt(i);
      if (c == 0x0a || c == 0x0d || c == 0x09)
        throw new DatatypeException(i, "invalid token value");
      if (c == ' ' && last == ' ')
        throw new DatatypeException(i, "invalid token value");
      last = c;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:TokenType.java

示例10: checkValid

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public void checkValid(String value, ValidationContext context)
  throws DatatypeException
{
  super.checkValid(value, context);
  int len = value.length();
  CPStringBuilder buf = new CPStringBuilder();
  for (int i = 0; i < len; i++)
    {
      char c = value.charAt(i);
      if (c == ' ')
        {
          String token = buf.toString();
          if (token.length() > 0)
            checkNmtoken(token, i);
          buf.setLength(0);
        }
      else
        buf.append(c);
    }
  checkNmtoken(buf.toString(), len);
}
 
开发者ID:vilie,项目名称:javify,代码行数:22,代码来源:NMTokensType.java

示例11: checkNmtoken

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
private void checkNmtoken(String text, int i)
  throws DatatypeException
{
  try
    {
      int[] cp = UnicodeReader.toCodePointArray(text);
      if (cp.length == 0)
        throw new DatatypeException("invalid NMTOKEN value");
      for (int j = 0; j < cp.length; j++)
        {
          // XXX XML 1.1 documents?
          if (!XMLParser.isNameCharacter(cp[j], false))
            throw new DatatypeException(i, "invalid NMTOKEN value");
        }
    }
  catch (IOException e)
    {
      DatatypeException e2 = new DatatypeException("invalid NMTOKEN value");
      e2.initCause(e);
      throw e2;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:23,代码来源:NMTokensType.java

示例12: checkValid

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public void checkValid(String value, ValidationContext context)
  throws DatatypeException
{
  super.checkValid(value, context);
  if (SPECIAL.contains(value))
    return;
  try
    {
      Double.parseDouble(value);
    }
  catch (NumberFormatException e)
    {
      DatatypeException e2 = new DatatypeException("invalid double value");
      e2.initCause(e);
      throw e2;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:DoubleType.java

示例13: checkValid

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public void checkValid(String value, ValidationContext context)
  throws DatatypeException
{
  super.checkValid(value, context);
  try
    {
      int[] cp = UnicodeReader.toCodePointArray(value);
      if (cp.length == 0)
        throw new DatatypeException("invalid Name value");
      // XXX XML 1.1 documents?
      if (!XMLParser.isNameStartCharacter(cp[0], false))
        throw new DatatypeException(0, "invalid Name value");
      for (int i = 1; i < cp.length; i++)
        {
          if (!XMLParser.isNameCharacter(cp[i], false))
            throw new DatatypeException(i, "invalid Name value");
        }
    }
  catch (IOException e)
    {
      DatatypeException e2 = new DatatypeException("invalid Name value");
      e2.initCause(e);
      throw e2;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:26,代码来源:NameType.java

示例14: checkValid

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public void checkValid(String value, ValidationContext context)
  throws DatatypeException
{
  super.checkValid(value, context);
  int len = value.length();
  if (len == 0)
    throw new DatatypeException(0, "invalid integer value");
  for (int i = 0; i < len; i++)
    {
      char c = value.charAt(i);
      if (c >= 0x30 && c <= 0x39)
        continue;
      else if (c == '+' && i == 0)
        continue;
      else if (c == '-' && i == 0)
        continue;
      throw new DatatypeException(i, "invalid integer value");
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:20,代码来源:IntegerType.java

示例15: checkValid

import org.relaxng.datatype.DatatypeException; //导入依赖的package包/类
public void checkValid(String value, ValidationContext context)
  throws DatatypeException
{
  super.checkValid(value, context);
  try
    {
      new URI(value);
    }
  catch (URISyntaxException e)
    {
      DatatypeException e2 = new DatatypeException(e.getIndex(),
                                                   e.getReason());
      e2.initCause(e);
      throw e2;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:17,代码来源:AnyURIType.java


注:本文中的org.relaxng.datatype.DatatypeException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。