本文整理汇总了Java中org.apache.xerces.xs.XSTypeDefinition.SIMPLE_TYPE属性的典型用法代码示例。如果您正苦于以下问题:Java XSTypeDefinition.SIMPLE_TYPE属性的具体用法?Java XSTypeDefinition.SIMPLE_TYPE怎么用?Java XSTypeDefinition.SIMPLE_TYPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.xerces.xs.XSTypeDefinition
的用法示例。
在下文中一共展示了XSTypeDefinition.SIMPLE_TYPE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkBooleanType
private static boolean checkBooleanType(XSTypeDefinition td) {
if (td.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) {
return false;
}
final XSSimpleTypeDefinition st = ((XSSimpleTypeDefinition) td);
final XSObjectList facets = st.getFacets();
for (int i = 0; i < facets.getLength(); i++) {
final XSFacet facet = (XSFacet) facets.item(i);
if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_LENGTH) {
if ("0".equals(facet.getLexicalFacetValue())) {
return true;
}
}
}
return false;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:16,代码来源:XSDModelLoader.java
示例2: processPSVITypeDefinitionRef
private void processPSVITypeDefinitionRef(
String enclose,
XSTypeDefinition type) {
if (type == null) {
sendElementEvent(enclose);
return;
}
sendIndentedElement(enclose);
if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
processPSVIElementRef("psv:complexTypeDefinition", type);
}
else if (type.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
processPSVIElementRef("psv:simpleTypeDefinition", type);
}
else {
throw new IllegalArgumentException(
"Unknown type definition value: " + type.getTypeCategory());
}
sendUnIndentedElement(enclose);
}
示例3: analyzeType
private void analyzeType(IXSDNode currentNode, XSParticleDecl fatherParticle, XSElementDecl currentElementDeclaration) {
if (currentElementDeclaration.getTypeDefinition().getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
manageSimpleTypeElement(currentNode, fatherParticle, currentElementDeclaration);
} else {
manageComplexTypeElement(currentNode, fatherParticle, currentElementDeclaration);
}
}
示例4: checkNotationType
/**
* Element/Attribute traversers call this method to check whether
* the type is NOTATION without enumeration facet
*/
void checkNotationType(String refName, XSTypeDefinition typeDecl, Element elem) {
if (typeDecl.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE &&
((XSSimpleType)typeDecl).getVariety() == XSSimpleType.VARIETY_ATOMIC &&
((XSSimpleType)typeDecl).getPrimitiveKind() == XSSimpleType.PRIMITIVE_NOTATION) {
if ((((XSSimpleType)typeDecl).getDefinedFacets() & XSSimpleType.FACET_ENUMERATION) == 0) {
reportSchemaError("enumeration-required-notation", new Object[]{typeDecl.getName(), refName, DOMUtil.getLocalName(elem)}, elem);
}
}
}
示例5: checkTypeDerivationOk
/**
* check whether derived is valid derived from base, given a subset
* of {restriction, extension}.B
*/
public static boolean checkTypeDerivationOk(XSTypeDefinition derived, XSTypeDefinition base, short block) {
// if derived is anyType, then it's valid only if base is anyType too
if (derived == SchemaGrammar.fAnyType)
return derived == base;
// if derived is anySimpleType, then it's valid only if the base
// is ur-type
if (derived == SchemaGrammar.fAnySimpleType) {
return (base == SchemaGrammar.fAnyType ||
base == SchemaGrammar.fAnySimpleType);
}
// if derived is simple type
if (derived.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
// if base is complex type
if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
// if base is anyType, change base to anySimpleType,
// otherwise, not valid
if (base == SchemaGrammar.fAnyType)
base = SchemaGrammar.fAnySimpleType;
else
return false;
}
return checkSimpleDerivation((XSSimpleType)derived,
(XSSimpleType)base, block);
}
else {
return checkComplexDerivation((XSComplexTypeDecl)derived, base, block);
}
}
示例6: elementLocallyValidType
Object elementLocallyValidType(QName element, Object textContent) {
if (fCurrentType == null)
return null;
Object retValue = null;
// Element Locally Valid (Type)
// 3 The appropriate case among the following must be true:
// 3.1 If the type definition is a simple type definition, then all of the following must be true:
if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
// 3.1.2 The element information item must have no element information item [children].
if (fSubElement)
reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
// 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
if (!fNil) {
XSSimpleType dv = (XSSimpleType) fCurrentType;
try {
if (!fNormalizeData || fUnionType) {
fValidationState.setNormalizationRequired(true);
}
retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
} catch (InvalidDatatypeValueException e) {
reportSchemaError(e.getKey(), e.getArgs());
reportSchemaError(
"cvc-type.3.1.3",
new Object[] { element.rawname, textContent });
}
}
} else {
// 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
retValue = elementLocallyValidComplexType(element, textContent);
}
return retValue;
}
示例7: processPSVITypeDefinition
private void processPSVITypeDefinition(XSTypeDefinition type) {
if (type == null)
return;
if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
processPSVIComplexTypeDefinition((XSComplexTypeDefinition)type);
}
else if (type.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
processPSVISimpleTypeDefinition((XSSimpleTypeDefinition)type);
}
else {
throw new IllegalArgumentException(
"Unknown type definition value: " + type.getType());
}
}
示例8: handleElementContents
public void handleElementContents(XSElementDeclaration elementDeclaration, N node) throws SAXException {
XSTypeDefinition typeDefinition = elementDeclaration.getTypeDefinition();
if (typeDefinition==null) {
log.warn("handleElementContents typeDefinition is null");
handleSimpleTypedElement(elementDeclaration, null, node);
return;
}
switch (typeDefinition.getTypeCategory()) {
case XSTypeDefinition.SIMPLE_TYPE:
if (DEBUG) log.debug("handleElementContents typeDefinition.typeCategory is SimpleType, no child elements");
handleSimpleTypedElement(elementDeclaration, (XSSimpleTypeDefinition)typeDefinition, node);
return;
case XSTypeDefinition.COMPLEX_TYPE:
XSComplexTypeDefinition complexTypeDefinition=(XSComplexTypeDefinition)typeDefinition;
switch (complexTypeDefinition.getContentType()) {
case XSComplexTypeDefinition.CONTENTTYPE_EMPTY:
if (DEBUG) log.debug("handleElementContents complexTypeDefinition.contentType is Empty, no child elements");
return;
case XSComplexTypeDefinition.CONTENTTYPE_SIMPLE:
if (DEBUG) log.debug("handleElementContents complexTypeDefinition.contentType is Simple, no child elements (only characters)");
return;
case XSComplexTypeDefinition.CONTENTTYPE_ELEMENT:
case XSComplexTypeDefinition.CONTENTTYPE_MIXED:
handleComplexTypedElement(elementDeclaration,node);
return;
default:
throw new IllegalStateException("handleElementContents complexTypeDefinition.contentType is not Empty,Simple,Element or Mixed, but ["+complexTypeDefinition.getContentType()+"]");
}
default:
throw new IllegalStateException("handleElementContents typeDefinition.typeCategory is not SimpleType or ComplexType, but ["+typeDefinition.getTypeCategory()+"] class ["+typeDefinition.getClass().getName()+"]");
}
}
示例9: dumpElement
private static void dumpElement(String path, XSElementDeclaration element)
{
String output_path = "" + path + "/" + element.getName();
XSTypeDefinition type = element.getTypeDefinition();
if (type.getName().endsWith("Array"))
{
// System.err.println(element.getName() + " - " + type.getName()
// + " SKIPPED !");
return;
}
if (((type.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE)
|| ((XSComplexTypeDefinition) type)
.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE))
{
if (includesBaseType(type, "string")
|| includesBaseType(type, "integer")
|| includesBaseType(type, "boolean"))
{
// System.out.println(" <metadata name=\"" +
// element.getName() + "\" type=\"text/plain\" category=\"\">");
// System.out.println(" " +
// indexedName(element.getName())
// + " { local:values($doc" + output_path + ") }");
// System.out.println(" </metadata>,");
System.out.println(" local:getMetadata('" +
element.getName() + "', '" +
indexedName(element.getName()) + "',");
System.out.println(" $doc" + output_path + "),");
}
}
else
{
dumpParticle(output_path,
((XSComplexTypeDefinition)type).getParticle());
}
}
示例10: typeDerivationOK
private boolean typeDerivationOK(XSTypeDefinition derived, XSTypeDefinition base, short blockingConstraint) {
short devMethod = 0, blockConstraint = blockingConstraint;
// "derived" should be derived from "base"
// add derivation methods of derived types to devMethod;
// add block of base types to blockConstraint.
XSTypeDefinition type = derived;
while (type != base && type != SchemaGrammar.fAnyType) {
if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
devMethod |= ((XSComplexTypeDecl)type).fDerivedBy;
}
else {
devMethod |= XSConstants.DERIVATION_RESTRICTION;
}
type = type.getBaseType();
// type == null means the current type is anySimpleType,
// whose base type should be anyType
if (type == null) {
type = SchemaGrammar.fAnyType;
}
if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
blockConstraint |= ((XSComplexTypeDecl)type).fBlock;
}
}
if (type != base) {
// If the base is a union, check if "derived" is allowed through any of the member types.
if (base.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) base;
if (st.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
XSObjectList memberTypes = st.getMemberTypes();
final int length = memberTypes.getLength();
for (int i = 0; i < length; ++i) {
if (typeDerivationOK(derived, (XSTypeDefinition) memberTypes.item(i), blockingConstraint)) {
return true;
}
}
}
}
return false;
}
if ((devMethod & blockConstraint) != 0) {
return false;
}
return true;
}
示例11: findDTValidator
private XSSimpleType findDTValidator(Element elm, String refName,
QName baseTypeStr, short baseRefContext,
XSDocumentInfo schemaDoc) {
if (baseTypeStr == null)
return null;
XSTypeDefinition baseType = (XSTypeDefinition)fSchemaHandler.getGlobalDecl(schemaDoc, XSDHandler.TYPEDECL_TYPE, baseTypeStr, elm);
if (baseType == null) {
return null;
}
if (baseType.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) {
reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
return null;
}
// if it's a complex type, or if its restriction of anySimpleType
if (baseType == SchemaGrammar.fAnySimpleType &&
baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
// if the base type is anySimpleType and the current type is
// a S4S built-in type, return null. (not an error).
if (checkBuiltIn(refName, schemaDoc.fTargetNamespace)) {
return null;
}
reportSchemaError("cos-st-restricts.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
return null;
}
if ((baseType.getFinal() & baseRefContext) != 0) {
if (baseRefContext == XSConstants.DERIVATION_RESTRICTION) {
reportSchemaError("st-props-correct.3", new Object[]{refName, baseTypeStr.rawname}, elm);
}
else if (baseRefContext == XSConstants.DERIVATION_LIST) {
reportSchemaError("cos-st-restricts.2.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
}
else if (baseRefContext == XSConstants.DERIVATION_UNION) {
reportSchemaError("cos-st-restricts.3.3.1.1", new Object[]{baseTypeStr.rawname, refName}, elm);
}
return null;
}
return (XSSimpleType)baseType;
}
示例12: getComponents
/**
* [schema components]: a list of top-level components, i.e. element
* declarations, attribute declarations, etc.
* @param objectType The type of the declaration, i.e.
* <code>ELEMENT_DECLARATION</code>. Note that
* <code>XSTypeDefinition.SIMPLE_TYPE</code> and
* <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the
* <code>objectType</code> to retrieve only complex types or simple
* types, instead of all types.
* @return A list of top-level definition of the specified type in
* <code>objectType</code> or an empty <code>XSNamedMap</code> if no
* such definitions exist.
*/
public synchronized XSNamedMap getComponents(short objectType) {
if (objectType <= 0 || objectType > MAX_COMP_IDX ||
!GLOBAL_COMP[objectType]) {
return XSNamedMapImpl.EMPTY_MAP;
}
if (fComponents == null)
fComponents = new XSNamedMap[MAX_COMP_IDX+1];
// get the hashtable for this type of components
if (fComponents[objectType] == null) {
SymbolHash table = null;
switch (objectType) {
case XSConstants.TYPE_DEFINITION:
case XSTypeDefinition.COMPLEX_TYPE:
case XSTypeDefinition.SIMPLE_TYPE:
table = fGlobalTypeDecls;
break;
case XSConstants.ATTRIBUTE_DECLARATION:
table = fGlobalAttrDecls;
break;
case XSConstants.ELEMENT_DECLARATION:
table = fGlobalElemDecls;
break;
case XSConstants.ATTRIBUTE_GROUP:
table = fGlobalAttrGrpDecls;
break;
case XSConstants.MODEL_GROUP_DEFINITION:
table = fGlobalGroupDecls;
break;
case XSConstants.NOTATION_DECLARATION:
table = fGlobalNotationDecls;
break;
case XSConstants.IDENTITY_CONSTRAINT:
table = this.fGlobalIDConstraintDecls;
break;
}
// for complex/simple types, create a special implementation,
// which take specific types out of the hash table
if (objectType == XSTypeDefinition.COMPLEX_TYPE ||
objectType == XSTypeDefinition.SIMPLE_TYPE) {
fComponents[objectType] = new XSNamedMap4Types(fTargetNamespace, table, objectType);
}
else {
fComponents[objectType] = new XSNamedMapImpl(fTargetNamespace, table);
}
}
return fComponents[objectType];
}
示例13: getComponentsExt
public synchronized ObjectList getComponentsExt(short objectType) {
if (objectType <= 0 || objectType > MAX_COMP_IDX ||
!GLOBAL_COMP[objectType]) {
return ObjectListImpl.EMPTY_LIST;
}
if (fComponentsExt == null)
fComponentsExt = new ObjectList[MAX_COMP_IDX+1];
// get the hashtable for this type of components
if (fComponentsExt[objectType] == null) {
SymbolHash table = null;
switch (objectType) {
case XSConstants.TYPE_DEFINITION:
case XSTypeDefinition.COMPLEX_TYPE:
case XSTypeDefinition.SIMPLE_TYPE:
table = fGlobalTypeDeclsExt;
break;
case XSConstants.ATTRIBUTE_DECLARATION:
table = fGlobalAttrDeclsExt;
break;
case XSConstants.ELEMENT_DECLARATION:
table = fGlobalElemDeclsExt;
break;
case XSConstants.ATTRIBUTE_GROUP:
table = fGlobalAttrGrpDeclsExt;
break;
case XSConstants.MODEL_GROUP_DEFINITION:
table = fGlobalGroupDeclsExt;
break;
case XSConstants.NOTATION_DECLARATION:
table = fGlobalNotationDeclsExt;
break;
case XSConstants.IDENTITY_CONSTRAINT:
table = this.fGlobalIDConstraintDeclsExt;
break;
}
Object[] entries = table.getEntries();
fComponentsExt[objectType] = new ObjectListImpl(entries, entries.length);
}
return fComponentsExt[objectType];
}
示例14: checkComplexDerivation
/**
* Note: this will be a private method, and it assumes that derived is not
* anyType. Another method will be introduced for public use,
* which will call this method.
*/
private static boolean checkComplexDerivation(XSComplexTypeDecl derived, XSTypeDefinition base, short block) {
// 2.1 B and D must be the same type definition.
if (derived == base)
return true;
// 1 If B and D are not the same type definition, then the {derivation method} of D must not be in the subset.
if ((derived.fDerivedBy & block) != 0)
return false;
// 2 One of the following must be true:
XSTypeDefinition directBase = derived.fBaseType;
// 2.2 B must be D's {base type definition}.
if (directBase == base)
return true;
// 2.3 All of the following must be true:
// 2.3.1 D's {base type definition} must not be the ur-type definition.
if (directBase == SchemaGrammar.fAnyType ||
directBase == SchemaGrammar.fAnySimpleType) {
return false;
}
// 2.3.2 The appropriate case among the following must be true:
// 2.3.2.1 If D's {base type definition} is complex, then it must be validly derived from B given the subset as defined by this constraint.
if (directBase.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
return checkComplexDerivation((XSComplexTypeDecl)directBase, base, block);
// 2.3.2.2 If D's {base type definition} is simple, then it must be validly derived from B given the subset as defined in Type Derivation OK (Simple) (3.14.6).
if (directBase.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
// if base is complex type
if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
// if base is anyType, change base to anySimpleType,
// otherwise, not valid
if (base == SchemaGrammar.fAnyType)
base = SchemaGrammar.fAnySimpleType;
else
return false;
}
return checkSimpleDerivation((XSSimpleType)directBase,
(XSSimpleType)base, block);
}
return false;
}
示例15: getComponents
/**
* Returns a list of top-level components, i.e. element declarations,
* attribute declarations, etc.
* @param objectType The type of the declaration, i.e.
* <code>ELEMENT_DECLARATION</code>. Note that
* <code>XSTypeDefinition.SIMPLE_TYPE</code> and
* <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the
* <code>objectType</code> to retrieve only complex types or simple
* types, instead of all types.
* @return A list of top-level definitions of the specified type in
* <code>objectType</code> or an empty <code>XSNamedMap</code> if no
* such definitions exist.
*/
public synchronized XSNamedMap getComponents(short objectType) {
if (objectType <= 0 || objectType > MAX_COMP_IDX ||
!GLOBAL_COMP[objectType]) {
return XSNamedMapImpl.EMPTY_MAP;
}
SymbolHash[] tables = new SymbolHash[fGrammarCount];
// get all hashtables from all namespaces for this type of components
if (fGlobalComponents[objectType] == null) {
for (int i = 0; i < fGrammarCount; i++) {
switch (objectType) {
case XSConstants.TYPE_DEFINITION:
case XSTypeDefinition.COMPLEX_TYPE:
case XSTypeDefinition.SIMPLE_TYPE:
tables[i] = fGrammarList[i].fGlobalTypeDecls;
break;
case XSConstants.ATTRIBUTE_DECLARATION:
tables[i] = fGrammarList[i].fGlobalAttrDecls;
break;
case XSConstants.ELEMENT_DECLARATION:
tables[i] = fGrammarList[i].fGlobalElemDecls;
break;
case XSConstants.ATTRIBUTE_GROUP:
tables[i] = fGrammarList[i].fGlobalAttrGrpDecls;
break;
case XSConstants.MODEL_GROUP_DEFINITION:
tables[i] = fGrammarList[i].fGlobalGroupDecls;
break;
case XSConstants.NOTATION_DECLARATION:
tables[i] = fGrammarList[i].fGlobalNotationDecls;
break;
case XSConstants.IDENTITY_CONSTRAINT:
tables[i] = fGrammarList[i].fGlobalIDConstraintDecls;
break;
}
}
// for complex/simple types, create a special implementation,
// which take specific types out of the hash table
if (objectType == XSTypeDefinition.COMPLEX_TYPE ||
objectType == XSTypeDefinition.SIMPLE_TYPE) {
fGlobalComponents[objectType] = new XSNamedMap4Types(fNamespaces, tables, fGrammarCount, objectType);
}
else {
fGlobalComponents[objectType] = new XSNamedMapImpl(fNamespaces, tables, fGrammarCount);
}
}
return fGlobalComponents[objectType];
}