本文整理汇总了Java中org.apache.xerces.xs.XSTypeDefinition.COMPLEX_TYPE属性的典型用法代码示例。如果您正苦于以下问题:Java XSTypeDefinition.COMPLEX_TYPE属性的具体用法?Java XSTypeDefinition.COMPLEX_TYPE怎么用?Java XSTypeDefinition.COMPLEX_TYPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.xerces.xs.XSTypeDefinition
的用法示例。
在下文中一共展示了XSTypeDefinition.COMPLEX_TYPE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkComplexType
public static boolean checkComplexType(XSTypeDefinition td) {
if (td.getTypeCategory() != XSTypeDefinition.COMPLEX_TYPE) {
return false;
}
XSComplexTypeDefinition ctd = (XSComplexTypeDefinition) td;
if (ctd.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_ELEMENT) {
return true;
}
if ((td instanceof XSComplexTypeDecl) && ((XSComplexTypeDecl) td).getAbstract()) {
return true;
}
if (TEXT_ELEMENTS_ARE_COMPLEX) {
return true;
}
if (ctd.getAttributeUses() != null) {
for (int i = 0; i < ctd.getAttributeUses().getLength(); i++) {
XSSimpleTypeDefinition xsstd = ((XSAttributeUse) ctd.getAttributeUses().item(i)).getAttrDeclaration()
.getTypeDefinition();
if ("ID".equals(xsstd.getName())) {
continue;
}
return true;
}
}
return false;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:XSDModelLoader.java
示例2: getDBMethods
private boolean getDBMethods(XSTypeDefinition typed, XSTypeDefinition typeb,
OneSubGroup methods) {
short dMethod = 0, bMethod = 0;
while (typed != typeb && typed != SchemaGrammar.fAnyType) {
if (typed.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
dMethod |= ((XSComplexTypeDecl)typed).fDerivedBy;
else
dMethod |= XSConstants.DERIVATION_RESTRICTION;
typed = typed.getBaseType();
// type == null means the current type is anySimpleType,
// whose base type should be anyType
if (typed == null)
typed = SchemaGrammar.fAnyType;
if (typed.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
bMethod |= ((XSComplexTypeDecl)typed).fBlock;
}
// No derivation relation, or blocked, return false
if (typed != typeb || (dMethod & bMethod) != 0)
return false;
// Remember the derivation methods and blocks, return true.
methods.dMethod = dMethod;
methods.bMethod = bMethod;
return true;
}
示例3: checkSimpleDerivationOk
/**
* check whether simple type derived is valid derived from base,
* given a subset of {restriction, extension}.
*/
public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
// 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 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);
}
示例4: 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);
}
示例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: characterData
public boolean characterData(String data, Augmentations augs) {
fSawText = fSawText || data.length() > 0;
// REVISIT: this methods basically duplicates implementation of
// handleCharacters(). We should be able to reuse some code
// if whitespace == -1 skip normalization, because it is a complexType
// or a union type.
if (fNormalizeData && fWhiteSpace != -1 && fWhiteSpace != XSSimpleType.WS_PRESERVE) {
// normalize data
normalizeWhitespace(data, fWhiteSpace == XSSimpleType.WS_COLLAPSE);
fBuffer.append(fNormalizedStr.ch, fNormalizedStr.offset, fNormalizedStr.length);
} else {
if (fAppendBuffer)
fBuffer.append(data);
}
// When it's a complex type with element-only content, we need to
// find out whether the content contains any non-whitespace character.
boolean allWhiteSpace = true;
if (fCurrentType != null
&& fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
// data outside of element content
for (int i = 0; i < data.length(); i++) {
if (!XMLChar.isSpace(data.charAt(i))) {
allWhiteSpace = false;
fSawCharacters = true;
break;
}
}
}
}
return allWhiteSpace;
}
示例7: handleCharacters
XMLString handleCharacters(XMLString text) {
if (fSkipValidationDepth >= 0)
return text;
fSawText = fSawText || text.length > 0;
// Note: data in EntityRef and CDATA is normalized as well
// if whitespace == -1 skip normalization, because it is a complexType
// or a union type.
if (fNormalizeData && fWhiteSpace != -1 && fWhiteSpace != XSSimpleType.WS_PRESERVE) {
// normalize data
normalizeWhitespace(text, fWhiteSpace == XSSimpleType.WS_COLLAPSE);
text = fNormalizedStr;
}
if (fAppendBuffer)
fBuffer.append(text.ch, text.offset, text.length);
// When it's a complex type with element-only content, we need to
// find out whether the content contains any non-whitespace character.
if (fCurrentType != null
&& fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
// data outside of element content
for (int i = text.offset; i < text.offset + text.length; i++) {
if (!XMLChar.isSpace(text.ch[i])) {
fSawCharacters = true;
break;
}
}
}
}
return text;
}
示例8: handleContent
protected void handleContent(XSTypeDefinition type, boolean nillable, Object actualValue, short valueType, ShortList itemValueType) {
if (type == null ||
type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE &&
((XSComplexTypeDefinition) type).getContentType()
!= XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) {
// the content must be simpleType content
fStore.reportError( "cvc-id.3", new Object[] {
fIdentityConstraint.getName(),
fIdentityConstraint.getElementName()});
}
fMatchedString = actualValue;
matched(fMatchedString, valueType, itemValueType, nillable);
}
示例9: 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());
}
}
示例10: 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()+"]");
}
}
示例11: processElement
private Path processElement(Path parent, String path, XSElementDeclaration xsElement,
Map<String, List<XSElementDeclaration>> substitutions,
List<XSElementDeclaration> parents, int minOccurs, int maxOccurs) throws BagriException {
Path element = parent;
if (!xsElement.getAbstract()) {
path += xsElement.getNamespace() == null ? "/" + xsElement.getName() : "/{" + xsElement.getNamespace() + "}" + xsElement.getName();
element = modelMgr.translatePath(parent.getRoot(), path, NodeKind.element, parent.getPathId(), XQItemType.XQBASETYPE_ANYTYPE,
Occurrence.getOccurrence(minOccurs, maxOccurs));
logger.trace("processElement; element: {}; type: {}; got XDMPath: {}", path, xsElement.getTypeDefinition(), element);
}
List<XSElementDeclaration> subs = substitutions.get(xsElement.getName());
logger.trace("processElement; got {} substitutions for element: {}", subs == null ? 0 : subs.size(), xsElement.getName());
if (subs != null) {
for (XSElementDeclaration sub: subs) {
processElement(parent, path, sub, substitutions, parents, minOccurs, maxOccurs);
}
}
if (parents.contains(xsElement)) {
return element;
}
parents.add(xsElement);
Path text = null;
if (xsElement.getTypeDefinition().getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
XSComplexTypeDefinition ctd = (XSComplexTypeDefinition) xsElement.getTypeDefinition();
// TODO: process derivations..?
// element's attributes
XSObjectList xsAttrList = ctd.getAttributeUses();
for (int i = 0; i < xsAttrList.getLength(); i ++) {
processAttribute(element, path, (XSAttributeUse) xsAttrList.item(i));
}
element = processParticle(element, path, ctd.getParticle(), substitutions, parents);
if (ctd.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE ||
ctd.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_MIXED) {
path += "/text()";
text = modelMgr.translatePath(element.getRoot(), path, NodeKind.text, element.getPathId(), getBaseType(ctd.getSimpleType()),
Occurrence.getOccurrence(minOccurs, maxOccurs));
logger.trace("processElement; complex text: {}; type: {}; got XDMPath: {}", path, ctd.getBaseType(), text);
}
} else { //if (xsElementDecl.getTypeDefinition().getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
XSSimpleTypeDefinition std = (XSSimpleTypeDefinition) xsElement.getTypeDefinition();
path += "/text()";
text = modelMgr.translatePath(element.getRoot(), path, NodeKind.text, element.getPathId(), getBaseType(std),
Occurrence.getOccurrence(minOccurs, maxOccurs));
logger.trace("processElement; simple text: {}; type: {}; got XDMPath: {}", path, std, text);
}
if (text != null) {
element.setPostId(text.getPathId());
modelMgr.updatePath(element);
}
if (parent.getPostId() < element.getPostId()) {
parent.setPostId(element.getPostId());
modelMgr.updatePath(parent);
}
parents.remove(xsElement);
return element;
}
示例12: 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;
}
示例13: 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];
}
示例14: 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];
}
示例15: 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;
}