本文整理汇总了Java中org.apache.xerces.impl.xs.XSElementDecl类的典型用法代码示例。如果您正苦于以下问题:Java XSElementDecl类的具体用法?Java XSElementDecl怎么用?Java XSElementDecl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSElementDecl类属于org.apache.xerces.impl.xs包,在下文中一共展示了XSElementDecl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: analyzeElement
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的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);
}
}
开发者ID:dbunibas,项目名称:spicy,代码行数:25,代码来源:GenerateXSDNodeTree.java
示例2: analyzeAttributes
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
private void analyzeAttributes(IXSDNode currentNode, XSElementDecl currentElementDeclaration) {
XSComplexTypeDefinition complexTypeDefinition = (XSComplexTypeDefinition) currentElementDeclaration.getTypeDefinition();
XSObjectList listOfAttributes = complexTypeDefinition.getAttributeUses();
if (listOfAttributes.getLength() != 0) {
TypeCompositor attList = new TypeCompositor(TypeCompositor.ATTLIST);
for (int i = 0; i < listOfAttributes.getLength(); i++) {
XSAttributeUseImpl xsdAttribute = (XSAttributeUseImpl) listOfAttributes.item(i);
AttributeDeclaration attribute = new AttributeDeclaration(xsdAttribute.getAttrDeclaration().getName());
if (logger.isDebugEnabled()) logger.debug(" --- AttributeName: " + xsdAttribute.getAttrDeclaration().getName() + " type: " + xsdAttribute.getType());
if (xsdAttribute.getRequired()) {
attribute.setMinCardinality(1);
}
int leafType = xsdAttribute.getAttrDeclaration().getTypeDefinition().getBuiltInKind();
attribute.addChild(new SimpleType(getLeafType(leafType)));
attList.addChild(attribute);
}
currentNode.addChild(attList);
}
}
开发者ID:dbunibas,项目名称:spicy,代码行数:20,代码来源:GenerateXSDNodeTree.java
示例3: findMatchingDecl
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
Object findMatchingDecl(QName curElem, SubstitutionGroupHandler subGroupHandler) {
Object matchingDecl = null;
for (int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) {
int type = fElemMapType[elemIndex] ;
if (type == XSParticleDecl.PARTICLE_ELEMENT) {
matchingDecl = subGroupHandler.getMatchingElemDecl(curElem, (XSElementDecl)fElemMap[elemIndex]);
if (matchingDecl != null) {
return matchingDecl;
}
}
else if (type == XSParticleDecl.PARTICLE_WILDCARD) {
if(((XSWildcardDecl)fElemMap[elemIndex]).allowNamespace(curElem.uri))
return fElemMap[elemIndex];
}
}
return null;
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:20,代码来源:XSDFACM.java
示例4: createAllCM
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
XSCMValidator createAllCM(XSParticleDecl particle) {
if (particle.fMaxOccurs == 0)
return null;
// get the model group, and add all children of it to the content model
XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue;
// create an all content model. the parameter indicates whether
// the <all> itself is optional
XSAllCM allContent = new XSAllCM(particle.fMinOccurs == 0, group.fParticleCount);
for (int i = 0; i < group.fParticleCount; i++) {
// add the element decl to the all content model
allContent.addElement((XSElementDecl)group.fParticles[i].fValue,
group.fParticles[i].fMinOccurs == 0);
}
return allContent;
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:17,代码来源:CMBuilder.java
示例5: getPossibleElements
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
@Override
public List<XmlElementDescriptor> getPossibleElements() {
final List vector = myContentModel.whatCanGoHere(myState);
ArrayList<XmlElementDescriptor> list = new ArrayList<XmlElementDescriptor>();
for (Object o : vector) {
if (o instanceof XSElementDecl) {
final XSElementDecl elementDecl = (XSElementDecl)o;
XmlElementDescriptor descriptor = ContainerUtil.find(myElementDescriptors, new Condition<XmlElementDescriptor>() {
@Override
public boolean value(XmlElementDescriptor elementDescriptor) {
return elementDecl.getName().equals(elementDescriptor.getName());
}
});
ContainerUtil.addIfNotNull(descriptor, list);
}
}
return list;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:XsContentDFA.java
示例6: getPossibleElements
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
@Override
public List<XmlElementDescriptor> getPossibleElements()
{
final List vector = myContentModel.whatCanGoHere(myState);
ArrayList<XmlElementDescriptor> list = new ArrayList<XmlElementDescriptor>();
for(Object o : vector)
{
if(o instanceof XSElementDecl)
{
final XSElementDecl elementDecl = (XSElementDecl) o;
XmlElementDescriptor descriptor = ContainerUtil.find(myElementDescriptors, new Condition<XmlElementDescriptor>()
{
@Override
public boolean value(XmlElementDescriptor elementDescriptor)
{
return elementDecl.getName().equals(elementDescriptor.getName());
}
});
ContainerUtil.addIfNotNull(list, descriptor);
}
}
return list;
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:24,代码来源:XsContentDFA.java
示例7: toString
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
@Override
public String toString()
{
StringBuffer rtBuffer=new StringBuffer();
if (getCoreObject()==null)
return null;
if (getCoreObject().getNamespace()!=null)
rtBuffer.append(getCoreObject().getNamespace()+":");
rtBuffer.append(getCoreObject().getName());
if (getCoreObject() instanceof XSElementDecl)
rtBuffer.append(" (Element)");
else if (getCoreObject() instanceof XSComplexTypeDecl)
rtBuffer.append(" (Complex Type)");
else if (getCoreObject() instanceof XSSimpleTypeDecl)
rtBuffer.append(" (Smple Type)");
else
rtBuffer.append(" (Unknown)");
return rtBuffer.toString();
}
开发者ID:NCIP,项目名称:caadapter,代码行数:22,代码来源:CellRenderXSObject.java
示例8: testXercesGrammar
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
public void testXercesGrammar() throws Exception {
XSModel xsModel = getXSModel("test.xml", "test.xsd");
XSElementDeclaration elementDeclaration = xsModel.getElementDeclaration("a", "");
XSComplexTypeDefinition typeDefinition = (XSComplexTypeDefinition)elementDeclaration.getTypeDefinition();
CMBuilder cmBuilder = new CMBuilder(new CMNodeFactory());
XSCMValidator validator = cmBuilder.getContentModel((XSComplexTypeDecl)typeDefinition, true);
int[] ints = validator.startContentModel();
Vector vector = validator.whatCanGoHere(ints);
XSElementDecl o = (XSElementDecl)vector.get(0);
assertEquals("b", o.getName());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:XmlConstraintsTest.java
示例9: testXercesIncomplete
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
public void testXercesIncomplete() throws Exception {
XSModel xsModel = getXSModel("testIncomplete.xml", "test.xsd");
XSElementDeclaration elementDeclaration = xsModel.getElementDeclaration("a", "");
XSComplexTypeDefinition typeDefinition = (XSComplexTypeDefinition)elementDeclaration.getTypeDefinition();
CMBuilder cmBuilder = new CMBuilder(new CMNodeFactory());
XSCMValidator validator = cmBuilder.getContentModel((XSComplexTypeDecl)typeDefinition, true);
int[] ints = validator.startContentModel();
Vector vector = validator.whatCanGoHere(ints);
XSElementDecl o = (XSElementDecl)vector.get(0);
assertEquals("b", o.getName());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:XmlConstraintsTest.java
示例10: generateXSDNodeTree
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
public XSDSchema generateXSDNodeTree(String fileName) throws Exception {
this.xsdSchema = new XSDSchema();
XSModel model = initModel(fileName);
XSNamedMap elements = model.getComponents(XSConstants.ELEMENT_DECLARATION);
for (int i = 0; i < elements.getLength(); i++) {
XSElementDecl element = (XSElementDecl) elements.item(i);
analyzeElement(null, null, element);
}
IXSDNode rootNode = findRoot();
xsdSchema.setRoot(rootNode);
return xsdSchema;
}
开发者ID:dbunibas,项目名称:spicy,代码行数:13,代码来源:GenerateXSDNodeTree.java
示例11: createNewElement
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
private IXSDNode createNewElement(XSElementDecl elementDeclaration) {
String elementName = elementDeclaration.getName();
IXSDNode element = new ElementDeclaration(elementName);
constraintLoader.checkElementConstraints(xsdSchema, elementDeclaration);
element.setNullable(elementDeclaration.getNillable());
return element;
}
开发者ID:dbunibas,项目名称:spicy,代码行数:8,代码来源:GenerateXSDNodeTree.java
示例12: analyzeType
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
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);
}
}
开发者ID:dbunibas,项目名称:spicy,代码行数:8,代码来源:GenerateXSDNodeTree.java
示例13: manageSimpleTypeElement
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
private void manageSimpleTypeElement(IXSDNode currentNode, XSParticleDecl fatherParticle, XSElementDecl currentElementDeclaration) {
XSSimpleTypeDefinition simpleTypeDefinition = (XSSimpleTypeDefinition) currentElementDeclaration.getTypeDefinition();
if (logger.isDebugEnabled()) logger.debug("Found a simple type: " + currentElementDeclaration.getName() + " with type: " + simpleTypeDefinition.getBuiltInKind());
SimpleType simpleType = new SimpleType(getLeafType(simpleTypeDefinition.getBuiltInKind()));
currentNode.addChild(simpleType);
setCardinality(currentNode, fatherParticle);
}
开发者ID:dbunibas,项目名称:spicy,代码行数:8,代码来源:GenerateXSDNodeTree.java
示例14: manageComplexTypeElement
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
private void manageComplexTypeElement(IXSDNode currentNode, XSParticleDecl fatherParticle, XSElementDecl currentElementDeclaration) {
if (logger.isDebugEnabled()) logger.debug("Found a complex type: " + currentElementDeclaration.getName());
setCardinality(currentNode, fatherParticle);
XSComplexTypeDecl complexTypeDefinition = (XSComplexTypeDecl) currentElementDeclaration.getTypeDefinition();
if (checkContentTypeMixed(complexTypeDefinition)) {
currentNode.setMixedContent(true);
if (logger.isDebugEnabled()) logger.debug("Current node: " + currentNode + " with father particle: " + fatherParticle + " and current element declaration: " + currentElementDeclaration);
}
XSParticleDecl currentParticle = (XSParticleDecl) complexTypeDefinition.getParticle();
analyzeAttributes(currentNode, currentElementDeclaration);
if (currentParticle == null){
return;
}
analyzeParticle(currentNode, fatherParticle, currentParticle);
}
开发者ID:dbunibas,项目名称:spicy,代码行数:16,代码来源:GenerateXSDNodeTree.java
示例15: analyzeParticle
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
private void analyzeParticle(IXSDNode currentNode, XSParticleDecl fatherParticle, XSParticleDecl currentParticle) {
if (logger.isDebugEnabled()) logger.debug("analyzing particle: " + currentParticle);
XSTerm currentTerm = currentParticle.getTerm();
if (currentTerm instanceof XSWildcard) {
throw new IllegalSchemaException("Term is a wildcard: " + currentParticle + " - Current node: " + currentNode + " - Father particle: " + fatherParticle);
}
if (currentTerm instanceof XSElementDecl) {
if (logger.isDebugEnabled()) logger.debug("Found an element: " + currentTerm.toString() + " with scope " + ((XSElementDecl)currentTerm).getScope());
analyzeElement(currentNode, currentParticle, (XSElementDecl) currentTerm);
}
if (currentTerm instanceof XSModelGroupImpl) {
if (logger.isDebugEnabled()) logger.debug("Found a nested group in: " + currentTerm);
analyzeModelGroup(currentNode, currentParticle, (XSModelGroupImpl)currentTerm);
}
}
开发者ID:dbunibas,项目名称:spicy,代码行数:16,代码来源:GenerateXSDNodeTree.java
示例16: addGlobalElementDecl
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
void addGlobalElementDecl(XSElementDecl decl) {
final String namespace = decl.getNamespace();
final String declKey = (namespace == null || namespace.length() == 0)
? "," + decl.getName() : namespace + "," + decl.getName();
if (fGlobalElemDecls.get(declKey) == null) {
fGlobalElemDecls.put(declKey, decl);
}
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:10,代码来源:XSDHandler.java
示例17: storeKeyRef
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
protected void storeKeyRef (Element keyrefToStore, XSDocumentInfo schemaDoc,
XSElementDecl currElemDecl) {
String keyrefName = DOMUtil.getAttrValue(keyrefToStore, SchemaSymbols.ATT_NAME);
if (keyrefName.length() != 0) {
String keyrefQName = schemaDoc.fTargetNamespace == null?
"," + keyrefName: schemaDoc.fTargetNamespace+","+keyrefName;
checkForDuplicateNames(keyrefQName, IDENTITYCONSTRAINT_TYPE, fUnparsedIdentityConstraintRegistry, fUnparsedIdentityConstraintRegistrySub, keyrefToStore, schemaDoc);
}
// now set up all the registries we'll need...
// check array sizes
if (fKeyrefStackPos == fKeyrefs.length) {
Element [] elemArray = new Element [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT];
System.arraycopy(fKeyrefs, 0, elemArray, 0, fKeyrefStackPos);
fKeyrefs = elemArray;
XSElementDecl [] declArray = new XSElementDecl [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT];
System.arraycopy(fKeyrefElems, 0, declArray, 0, fKeyrefStackPos);
fKeyrefElems = declArray;
String[][] stringArray = new String [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT][];
System.arraycopy(fKeyrefNamespaceContext, 0, stringArray, 0, fKeyrefStackPos);
fKeyrefNamespaceContext = stringArray;
XSDocumentInfo [] xsDocumentInfo = new XSDocumentInfo [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT];
System.arraycopy(fKeyrefsMapXSDocumentInfo, 0, xsDocumentInfo, 0, fKeyrefStackPos);
fKeyrefsMapXSDocumentInfo = xsDocumentInfo;
}
fKeyrefs[fKeyrefStackPos] = keyrefToStore;
fKeyrefElems[fKeyrefStackPos] = currElemDecl;
fKeyrefNamespaceContext[fKeyrefStackPos] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext();
fKeyrefsMapXSDocumentInfo[fKeyrefStackPos++] = schemaDoc;
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:34,代码来源:XSDHandler.java
示例18: traverseGlobal
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
/**
* Traverse a globally declared element.
*
* @param elmDecl
* @param schemaDoc
* @param grammar
* @return the element declaration
*/
XSElementDecl traverseGlobal(Element elmDecl,
XSDocumentInfo schemaDoc,
SchemaGrammar grammar) {
// General Attribute Checking'
Object[] attrValues = fAttrChecker.checkAttributes(elmDecl, true, schemaDoc);
XSElementDecl element = traverseNamedElement(elmDecl, attrValues, schemaDoc, grammar, true, null);
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
return element;
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:21,代码来源:XSDElementTraverser.java
示例19: compareTo
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
public int compareTo(Object arg0) {
// TODO Auto-generated method stub
XSObject toCompareObj=((CellRenderXSObject)arg0).getCoreObject();
if (getCoreObject()==null|toCompareObj==null)
return 0;
if (getCoreObject() instanceof XSElementDecl)
{
if (toCompareObj instanceof XSElementDecl)
return this.toString().compareTo(arg0.toString());
else
return -1;
}
else if (getCoreObject() instanceof XSComplexTypeDecl)
{
if (toCompareObj instanceof XSElementDecl)
return 1;
else if (toCompareObj instanceof XSComplexTypeDecl)
return this.toString().compareTo(arg0.toString());
else
return -1;
}
else if (getCoreObject() instanceof XSSimpleTypeDecl)
{
if (toCompareObj instanceof XSSimpleTypeDecl)
return this.toString().compareTo(arg0.toString());
else
return 1;
}
else
return this.toString().compareTo(arg0.toString());
// return 0;
}
开发者ID:NCIP,项目名称:caadapter,代码行数:34,代码来源:CellRenderXSObject.java
示例20: getGlobalElementDecl
import org.apache.xerces.impl.xs.XSElementDecl; //导入依赖的package包/类
private XSElementDecl getGlobalElementDecl(String declKey) {
return (XSElementDecl)fGlobalElemDecls.get(declKey);
}
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XSDHandler.java
注:本文中的org.apache.xerces.impl.xs.XSElementDecl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论