本文整理汇总了Java中org.apache.xerces.xs.XSConstants类的典型用法代码示例。如果您正苦于以下问题:Java XSConstants类的具体用法?Java XSConstants怎么用?Java XSConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XSConstants类属于org.apache.xerces.xs包,在下文中一共展示了XSConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dumpParticle
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
private static void dumpParticle(String path, XSParticle particle)
{
XSTerm term = particle.getTerm();
switch (term.getType())
{
case XSConstants.ELEMENT_DECLARATION:
dumpElement(path, (XSElementDeclaration) term);
break;
case XSConstants.MODEL_GROUP:
XSModelGroup model_group = (XSModelGroup) term;
final XSObjectList particles = model_group.getParticles();
for (int ipar = 0; ipar < particles.getLength(); ipar++)
{
dumpParticle(path, (XSParticle) particles.item(ipar));
}
break;
default:
System.err.println(path + " - UNKNOWN");
}
}
示例2: getNode
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
/**
* Returns a schema element XSElementDeclaration with the given local name. (This method is not namespace aware).
*
* @param localName the local name of the node to fine.
* @return the schema element or null if there is no such named element.
*/
public XSElementDeclaration getNode(String localName) {
if (null == localName || 0 == localName.trim().length()) {
return null;
}
XSNamedMap map = schemaModel.getComponents(XSConstants.ELEMENT_DECLARATION);
if (null != map) {
for (int i = 0; i < map.getLength(); i++) {
XSObject item = map.item(i);
if (item instanceof XSElementDeclaration) {
if (localName.equals(item.getName())) {
return (XSElementDeclaration) item;
}
}
}
}
return null;
}
示例3: getNode
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
/**
* Get an XSElementDeclaration for a named element.
*
* @param nodeName the name of a node.
*
* @return the element XSElementDeclaration.
*/
protected XSElementDeclaration getNode(String nodeName) {
XSNamedMap map = xsModel.getComponents(XSConstants.ELEMENT_DECLARATION);
if (map.getLength() != 0) {
for (int i = 0; i < map.getLength(); i++) {
XSObject item = map.item(i);
if (item instanceof XSElementDeclaration) {
String nextName = item.getName();
if (nextName.equals(nodeName)) {
return (XSElementDeclaration) item;
}
}
}
}
return null;
}
示例4: analyzeElement
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
private void analyzeElement(IXSDNode currentNode, XSParticleDecl fatherParticle, XSElementDecl elementDeclaration) {
if (logger.isDebugEnabled()) logger.debug("analyzeElement: " + elementDeclaration.getName());
String elementName = elementDeclaration.getName();
IXSDNode element = null;
if (elementDeclaration.getScope() == XSConstants.SCOPE_GLOBAL) {
if (logger.isDebugEnabled()) logger.debug(elementName + " has GLOBAL SCOPE");
element = globalElements.get(elementName);
if (element == null) {
element = createNewElement(elementDeclaration);
globalElements.put(elementName, element);
analyzeType(element, fatherParticle, elementDeclaration);
} else {
element.setNested(true);
element = element.clone();
setCardinality(element, fatherParticle);
}
} else {
element = createNewElement(elementDeclaration);
analyzeType(element, fatherParticle, elementDeclaration);
}
if (currentNode != null) {
currentNode.addChild(element);
}
}
示例5: importFromXsd
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
protected void importFromXsd(String text) throws Exception {
XSModel xsModel = new XSParser().parseString(text, "");
XSInstance xsInstance = new XSInstance();
xsInstance.minimumElementsGenerated = 1;
xsInstance.maximumElementsGenerated = 1;
xsInstance.generateOptionalElements = Boolean.TRUE;
XSNamedMap map = xsModel.getComponents(XSConstants.ELEMENT_DECLARATION);
QName rootElement = new QName(map.item(0).getNamespace(), map.item(0).getName(), XMLConstants.DEFAULT_NS_PREFIX);
StringWriter writer = new StringWriter();
XMLDocument sampleXml = new XMLDocument(new StreamResult(writer), true, 4, null);
xsInstance.generate(xsModel, rootElement, sampleXml);
String xml = writer.toString();
listener.onImport(xml);
}
示例6: XSSimpleTypeDecl
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
protected XSSimpleTypeDecl(String name, String uri, short finalSet, XSSimpleTypeDecl itemType, boolean isImmutable,
XSObjectList annotations) {
fBase = fAnySimpleType;
fTypeName = name;
fTargetNamespace = uri;
fFinalSet = finalSet;
fAnnotations = annotations;
fVariety = VARIETY_LIST;
fItemType = (XSSimpleTypeDecl)itemType;
fValidationDV = DV_LIST;
fFacetsDefined = FACET_WHITESPACE;
fFixedFacet = FACET_WHITESPACE;
fWhiteSpace = WS_COLLAPSE;
//setting fundamental facets
calcFundamentalFacets();
fIsImmutable = isImmutable;
// Values of this type are lists
fBuiltInKind = XSConstants.LIST_DT;
}
示例7: setListValues
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
protected XSSimpleTypeDecl setListValues(String name, String uri, short finalSet, XSSimpleTypeDecl itemType,
XSObjectList annotations) {
//decline to do anything if the object is immutable.
if(fIsImmutable) return null;
fBase = fAnySimpleType;
fAnonymous = false;
fTypeName = name;
fTargetNamespace = uri;
fFinalSet = finalSet;
fAnnotations = annotations;
fVariety = VARIETY_LIST;
fItemType = (XSSimpleTypeDecl)itemType;
fValidationDV = DV_LIST;
fFacetsDefined = FACET_WHITESPACE;
fFixedFacet = FACET_WHITESPACE;
fWhiteSpace = WS_COLLAPSE;
//setting fundamental facets
calcFundamentalFacets();
// Values of this type are lists
fBuiltInKind = XSConstants.LIST_DT;
return this;
}
示例8: convertToPrimitiveKind
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
private short convertToPrimitiveKind(short valueType) {
/** Primitive datatypes. */
if (valueType <= XSConstants.NOTATION_DT) {
return valueType;
}
/** Types derived from string. */
if (valueType <= XSConstants.ENTITY_DT) {
return XSConstants.STRING_DT;
}
/** Types derived from decimal. */
if (valueType <= XSConstants.POSITIVEINTEGER_DT) {
return XSConstants.DECIMAL_DT;
}
/** Other types. */
return valueType;
}
示例9: convertToPrimitiveKind
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
/**
* Returns the primitive type of the given type.
* @param valueType A value type as defined in XSConstants.
* @return The primitive type from which valueType was derived.
*/
private static short convertToPrimitiveKind(short valueType) {
/** Primitive datatypes. */
if (valueType <= XSConstants.NOTATION_DT) {
return valueType;
}
/** Types derived from string. */
if (valueType <= XSConstants.ENTITY_DT) {
return XSConstants.STRING_DT;
}
/** Types derived from decimal. */
if (valueType <= XSConstants.POSITIVEINTEGER_DT) {
return XSConstants.DECIMAL_DT;
}
/** Other types. */
return valueType;
}
示例10: getDBMethods
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
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;
}
示例11: errorType
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
private XSSimpleType errorType(String name, String namespace, short refType) {
XSSimpleType stringType = (XSSimpleType)SchemaGrammar.SG_SchemaNS.getTypeDefinition("string");
switch (refType) {
case XSConstants.DERIVATION_RESTRICTION:
return fSchemaHandler.fDVFactory.createTypeRestriction(name, namespace, (short)0,
stringType, null);
case XSConstants.DERIVATION_LIST:
return fSchemaHandler.fDVFactory.createTypeList(name, namespace, (short)0,
stringType, null);
case XSConstants.DERIVATION_UNION:
return fSchemaHandler.fDVFactory.createTypeUnion(name, namespace, (short)0,
new XSSimpleType[]{stringType}, null);
}
return null;
}
示例12: expandRelatedComponents
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
private void expandRelatedComponents(XSObject component, Vector componentList, Hashtable dependencies) {
short componentType = component.getType();
switch (componentType) {
case XSConstants.TYPE_DEFINITION :
expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
break;
case XSConstants.ATTRIBUTE_DECLARATION :
expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
break;
case XSConstants.ATTRIBUTE_GROUP :
expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
case XSConstants.ELEMENT_DECLARATION :
expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
break;
case XSConstants.MODEL_GROUP_DEFINITION :
expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
case XSConstants.ATTRIBUTE_USE :
//expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
case XSConstants.NOTATION_DECLARATION :
case XSConstants.IDENTITY_CONSTRAINT :
default :
break;
}
}
示例13: reset
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
public void reset(){
fName = null;
fTargetNamespace = null;
fBaseType = null;
fDerivedBy = XSConstants.DERIVATION_RESTRICTION;
fFinal = XSConstants.DERIVATION_NONE;
fBlock = XSConstants.DERIVATION_NONE;
fMiscFlags = 0;
// reset attribute group
fAttrGrp.reset();
fContentType = CONTENTTYPE_EMPTY;
fXSSimpleType = null;
fParticle = null;
fCMValidator = null;
fUPACMValidator = null;
if(fAnnotations != null) {
// help out the garbage collector
fAnnotations.clearXSObjectList();
}
fAnnotations = null;
}
示例14: buildSubGroups_Org
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
private SymbolHash buildSubGroups_Org() {
SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null);
for (int i = 0 ; i < fGrammarCount; i++) {
sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups());
}
final XSNamedMap elements = getComponents(XSConstants.ELEMENT_DECLARATION);
final int len = elements.getLength();
final SymbolHash subGroupMap = new SymbolHash(len*2);
XSElementDecl head;
XSElementDeclaration[] subGroup;
for (int i = 0; i < len; i++) {
head = (XSElementDecl)elements.item(i);
subGroup = sgHandler.getSubstitutionGroup(head);
subGroupMap.put(head, subGroup.length > 0 ?
new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST);
}
return subGroupMap;
}
示例15: reset
import org.apache.xerces.xs.XSConstants; //导入依赖的package包/类
/**
* Reset current element declaration
*/
public void reset(){
fScope = XSConstants.SCOPE_ABSENT;
fName = null;
fTargetNamespace = null;
fType = null;
fUnresolvedTypeName = null;
fMiscFlags = 0;
fBlock = XSConstants.DERIVATION_NONE;
fFinal = XSConstants.DERIVATION_NONE;
fDefault = null;
fAnnotations = null;
fSubGroup = null;
// reset identity constraints
for (int i=0;i<fIDCPos;i++) {
fIDConstraints[i] = null;
}
fIDCPos = 0;
}