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


Java XSElementDecl类代码示例

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


XSElementDecl类属于org.apache.xerces.impl.xs包,在下文中一共展示了XSElementDecl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例9: 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

示例10: 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

示例11: 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

示例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


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