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


Java Datatype类代码示例

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


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

示例1: caseValue

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
public Pattern caseValue(ValuePattern p) {
  Datatype dt = p.getDatatype();
  Object value = dt.createValue(str, vc);
  if (value != null && dt.sameValue(p.getValue(), value))
    return builder.makeEmpty();
  if (fail != null) {
    if (value == null) {
      try {
        dt.checkValid(str, vc);
      }
      catch (DatatypeException e) {
        fail.add(new DataDerivFailure(dt, p.getDatatypeName(), e));
      }
    }
    else
      fail.add(new DataDerivFailure(p));
  }
  return builder.makeNotAllowed();
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:20,代码来源:DataDerivFunction.java

示例2: caseAttribute

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
public VoidValue caseAttribute(AttributePattern p) {
  int idType = p.getContent().apply(idTypeFunction);
  if (idType != Datatype.ID_TYPE_NULL) {
    NameClass attributeNameClass = p.getNameClass();
    if (!(attributeNameClass instanceof SimpleNameClass)) {
      error("id_attribute_name_class", p.getLocator());
      return VoidValue.VOID;
    }
    elementNameClass.accept(new ElementNameClassVisitor(((SimpleNameClass)attributeNameClass).getName(),
                                                        locator,
                                                        idType));
  }
  else
    notePossibleConflict(elementNameClass, p.getNameClass(), locator);
  p.getContent().apply(new BuildFunction(null, p.getLocator(), true));
  return VoidValue.VOID;
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:18,代码来源:IdTypeMapBuilder.java

示例3: createDatatype

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
public Datatype createDatatype(String typeLocalName)
  throws DatatypeException
{
  SimpleType type = (SimpleType) byName.get(typeLocalName);
  if (type == null)
    throw new DatatypeException("Unknown type name: " + typeLocalName);
  return type;
}
 
开发者ID:vilie,项目名称:javify,代码行数:9,代码来源:TypeLibrary.java

示例4: makeType

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
static private Type makeType(String typeName, Datatype dt, int index) {
  if (typeName.equals("anyURI"))
    return new UriType(dt, typeName, index);
  if (typeName.equals("boolean"))
    return new BooleanType(dt, typeName, index);
  if (typeName.equals("base64Binary") || typeName.equals("hexBinary"))
    return new BinaryType(dt, typeName, index);
  return new Type(dt, typeName, index);
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:10,代码来源:DatatypeRepertoire.java

示例5: ValuePattern

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
ValuePattern(Datatype dt, Name dtName, Object obj, String stringValue) {
  super(combineHashCode(VALUE_HASH_CODE, dt.valueHashCode(obj)));
  this.dt = dt;
  this.dtName = dtName;
  this.obj = obj;
  this.stringValue = stringValue;
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:8,代码来源:ValuePattern.java

示例6: dataDeriv

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
PatternMemo dataDeriv(ValidatorPatternBuilder builder, Pattern p, String str, ValidationContext vc,
                      List<DataDerivFailure> fail) {
  boolean isValid;
  final Datatype dt = dp.getDatatype();
  DataDerivFailure ddf = null;
  if (fail != null) {
    try {
      dt.checkValid(str, vc);
      isValid = true;
    }
    catch (DatatypeException e) {
      isValid = false;
      ddf = new DataDerivFailure(dp, e);
    }
  }
  else
    isValid = dt.isValid(str, vc);
  if (isValid) {
    if (validMemo == null || (fail != null && validMemo.isNotAllowed()))
      validMemo = super.dataDeriv(builder, p, str, vc, fail);
    return validMemo;
  }
  else {
    if (invalidMemo == null)
      invalidMemo = super.dataDeriv(builder, p, str, vc, fail);
    else if (invalidMemo.isNotAllowed() && ddf != null)
      fail.add(ddf);
    return invalidMemo;
  }
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:31,代码来源:DataDataDerivType.java

示例7: attribute

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
public void attribute(Name elementName, Name attributeName, String value, Locator locator)
        throws SAXException {
  int idType = idTypeMap.getIdType(elementName, attributeName);
  if (idType != Datatype.ID_TYPE_NULL) {
    String[] tokens = StringSplitter.split(value);
    switch (idType) {
    case Datatype.ID_TYPE_ID:
      if (tokens.length == 1)
        id(tokens[0], locator);
      else if (tokens.length == 0)
        error("id_no_tokens", locator);
      else
        error("id_multiple_tokens", locator);
      break;
    case Datatype.ID_TYPE_IDREF:
      if (tokens.length == 1)
        idref(tokens[0], locator);
      else if (tokens.length == 0)
        error("idref_no_tokens", locator);
      else
        error("idref_multiple_tokens", locator);
      break;
    case Datatype.ID_TYPE_IDREFS:
      if (tokens.length > 0) {
        for (int j = 0; j < tokens.length; j++)
          idref(tokens[j], locator);
      }
      else
        error("idrefs_no_tokens", locator);
      break;
    }
  }
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:34,代码来源:IdSoundnessChecker.java

示例8: IdTypeMapBuilder

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
public IdTypeMapBuilder(ErrorHandler eh, Pattern pattern) throws SAXException {
  this.eh = eh;
  try {
    pattern.apply(new BuildFunction(null, null));
    while (elementsToProcess.size() > 0) {
      ElementPattern p = elementsToProcess.pop();
      p.getContent().apply(new BuildFunction(p.getNameClass(), p.getLocator()));
    }
    for (PossibleConflict pc : possibleConflicts) {
      if (pc.elementNameClass instanceof SimpleNameClass
          && pc.attributeNameClass instanceof SimpleNameClass) {
        Name elementName = ((SimpleNameClass)pc.elementNameClass).getName();
        Name attributeName = ((SimpleNameClass)pc.attributeNameClass).getName();
        int idType = idTypeMap.getIdType(elementName,
                                         attributeName);
        if (idType != Datatype.ID_TYPE_NULL)
          error("id_type_conflict", elementName, attributeName, pc.locator);
      }
      else {
        for (ScopedName sn : idTypeMap.table.keySet()) {
          if (pc.elementNameClass.contains(sn.elementName)
              && pc.attributeNameClass.contains(sn.attributeName)) {
            error("id_type_conflict", sn.elementName, sn.attributeName, pc.locator);
            break;
          }
        }
      }
    }
  }
  catch (WrappedSAXException e) {
    throw e.cause;
  }
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:34,代码来源:IdTypeMapBuilder.java

示例9: DataDerivFailure

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
private DataDerivFailure(Datatype datatype, Name datatypeName, List<String> datatypeParams, String message, int index) {
  this.datatype = datatype;
  this.datatypeName = datatypeName;
  this.datatypeParams = datatypeParams;
  this.message = message;
  this.except = null;
  this.index = index == DatatypeException.UNKNOWN ? -1 : index;
  this.stringValue = null;
  this.value = null;
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:11,代码来源:DataDerivFailure.java

示例10: testCreateDatatype

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
@Test
public void testCreateDatatype() throws DatatypeException {
  Datatype dt = lib.createDatatype("integer");
  try {
    dt.checkValid("foo", null);
  }
  catch (DatatypeException e) {
    String message = e.getMessage();
    Assert.assertNotNull(message);
    Assert.assertTrue(message.contains("integer"));
  }
}
 
开发者ID:relaxng,项目名称:jing-trang,代码行数:13,代码来源:DatatypeLibraryImplTest.java

示例11: onID

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
public void onID( Datatype dt, StringToken s ) {
    // ID/IDREF validation will be done by ourselves.
    // so we will not rely on the validator to perform this check.
    // because we will use multiple instances of validators, so 
    // they cannot check global consistency.
    
    // see onID/onIDREF of the ValidationContext.
}
 
开发者ID:nhrdl,项目名称:javacash,代码行数:9,代码来源:MSVValidator.java

示例12: BuiltinDatatypeBuilder

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
BuiltinDatatypeBuilder(Datatype dt) {
  this.dt = dt;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:BuiltinDatatypeBuilder.java

示例13: createDatatype

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
public Datatype createDatatype() {
  return dt;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:BuiltinDatatypeBuilder.java

示例14: createDatatype

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
public Datatype createDatatype(String type) throws DatatypeException {
    return createDatatypeBuilder(type).createDatatype();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:BuiltinDatatypeLibrary.java

示例15: makeData

import org.relaxng.datatype.Datatype; //导入依赖的package包/类
Pattern makeData(Datatype dt) {
  noteDatatype(dt);
  Pattern p = new DataPattern(dt);
  return schemaInterner.intern(p);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:SchemaPatternBuilder.java


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