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


Java XSElementDeclaration类代码示例

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


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

示例1: dumpParticle

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的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");
   }

}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:24,代码来源:SentinelXsdDumpMetadata.java

示例2: getRootNodes

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
/**
 * Gets the qualified root elements from a schema representation. 
 * The root schema element has child elements, but is not itself a child of any element.
 * 
 * @return List - a vector of XSElementDeclaration's Ideally there should be only one element in the vector If the
 *         size is 0, it means no qualifying root found If size > 1, more than one element qualifies as root
 */
public List<XSElementDeclaration> getRootNodes() {
   List<String> allNodes = new ArrayList<String>();
   allNodes.addAll(schemaMap.keySet());
   List<String> childNodes = new ArrayList<String>();
   childNodes.addAll(parentMap.keySet());
   allNodes.removeAll(childNodes);
   List<XSElementDeclaration> rootNodes = new ArrayList<XSElementDeclaration>();
   if (allNodes.size() != 0) {
      for (int i = 0; i < allNodes.size(); i++) {
         String item = (String) allNodes.get(i);
         rootNodes.add(i, getNode(item));
      }
   }
   return rootNodes;
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:23,代码来源:SchemaHelper.java

示例3: getNode

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的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;
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:24,代码来源:SchemaHelper.java

示例4: findReference

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
/**
 * Finds all the element and complexType references for the specified root element and populates a map entry with
 * element names referenced by the element.
 * 
 * @param elementDeclaration XSElementDeclaration : the root element
 */
private void findReference(XSElementDeclaration elementDeclaration) {
   String elemName = elementDeclaration.getName();
   String thisContext = elemName;
   XSTypeDefinition typeDefinition = elementDeclaration.getTypeDefinition();
   if (null != typeDefinition) {
      String typeDefName = typeDefinition.getName();
      currentNodeNames.clear();
      currentNodeNames.add(elementDeclaration.getName());
      if (typeDefinition instanceof XSComplexTypeDefinition) {
         addToSchemaMap(elemName, typeDefName);
         if (null != typeDefName) {
            thisContext = typeDefName;
         }
         XSParticle particle = ((XSComplexTypeDefinition) typeDefinition).getParticle();
         findReferenceInParticle(thisContext, particle);
      }
      else {
         addToSchemaMap(elemName, typeDefName);
         if (null != typeDefName) {
            thisContext = typeDefName;
         }
      }
   }
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:31,代码来源:SchemaHelper.java

示例5: getSchemaElement

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
/**
 * Gets an XSObject representing the named schema element.
 * 
 * @param nodeName the name of the schema element.
 * 
 * @return the named schema element.
 */
protected XSObject getSchemaElement(String nodeName) throws Exception {
   List<XSElementDeclaration> namedNodes = new ArrayList<XSElementDeclaration>();
   namedNodes.add(getNode(nodeName));
   if (0 < namedNodes.size()) {
      if (1 < namedNodes.size()) {
         log.debug("Multiple nodes of the name '" + nodeName
                  + "' found in getSchemaElement() method. Returning the last in the list.");
      }
      return namedNodes.get(namedNodes.size()-1);
   }
   else if (namedNodes.isEmpty()) {
      log.warn("No element named '" + nodeName + "' was found in the schema declaration");
   }
   return null;
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:23,代码来源:SchemaLoader.java

示例6: getNode

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的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;
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:23,代码来源:SchemaLoader.java

示例7: getXbrlTaxonomyByNamespaceAndName

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
public XbrlTaxonomy getXbrlTaxonomyByNamespaceAndName(String namespace, String name) throws XbrlException, IOException{
	
	if(xbrlConceptCache.containsKey(XbrlTaxonomy.getIdentifier(namespace, name)))
		return xbrlConceptCache.get(XbrlTaxonomy.getIdentifier(namespace, name));
	
	XSElementDeclaration elementDec = (XSElementDeclaration)schemaElementDeclarations.itemByName(namespace, name);
	if(elementDec != null){
		XbrlTaxonomy xbrlTaxonomy = parseXbrlTaxonomy(elementDec);
		
		if(xbrlTaxonomy != null){
			xbrlConceptCache.put(xbrlTaxonomy.getIdentifier(), xbrlTaxonomy);
			return xbrlTaxonomy;
		}
	}
	else{
		//if taxonomy doesn't exist, probably means external schema is not imported.  Try loading from known ones
		return loadMissingTaxonomyFromKnownSchemas(namespace, name);
	}
	
	return null;
}
 
开发者ID:chen4119,项目名称:tempeh,代码行数:22,代码来源:XbrlElementHandler.java

示例8: parseXbrlTaxonomy

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
private XbrlTaxonomy parseXbrlTaxonomy(XSElementDeclaration elementDec) throws XbrlException{
	//should only contain the synthetic annotation for the attributes
	XSObjectList list = elementDec.getAnnotations();
	if(list.getLength() != 1)
		throw new XbrlException("element with ns: " + elementDec.getNamespace() + " name: " + elementDec.getName() + " has unexpected number of annotations:" + list.getLength());
	
	try{
		XSAnnotation attributeObj = (XSAnnotation)list.item(0);

		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();
		Document doc = builder.newDocument();
		attributeObj.writeAnnotation(doc, XSAnnotation.W3C_DOM_DOCUMENT);
		NamedNodeMap attributes = doc.getFirstChild().getAttributes();
		XbrlTaxonomy xbrlTaxonomy = new XbrlTaxonomy(elementDec, attributes);
		return xbrlTaxonomy;
	}
	catch(Exception e){
		
	}
	return null;
}
 
开发者ID:chen4119,项目名称:tempeh,代码行数:23,代码来源:XbrlElementHandler.java

示例9: expandRelatedComponents

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的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;
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:25,代码来源:XSDHandler.java

示例10: buildSubGroups_Org

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的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;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:20,代码来源:XSModelImpl.java

示例11: buildSubGroups

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
private SymbolHash buildSubGroups() {
    SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null);
    for (int i = 0 ; i < fGrammarCount; i++) {
        sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups());
    }

    final XSObjectListImpl elements = getGlobalElements();
    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;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:20,代码来源:XSModelImpl.java

示例12: processPSVIElementDeclaration

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
private void processPSVIElementDeclaration(XSElementDeclaration elem) {
    if (elem == null)
        return;
    sendIndentedElementWithID("psv:elementDeclaration", elem);
    sendElementEvent("psv:name", elem.getName());
    sendElementEvent("psv:targetNamespace", elem.getNamespace());
    processPSVITypeDefinitionOrRef(
        "psv:typeDefinition",
        elem.getTypeDefinition());
    processPSVIScope("psv:scope", elem.getEnclosingCTDefinition(), elem.getScope());
    processPSVIValueConstraint(elem.getConstraintType(), elem.getConstraintValue());
    sendElementEvent("psv:nillable", String.valueOf(elem.getNillable()));
    processPSVIIdentityConstraintDefinitions(elem.getIdentityConstraints());
    processPSVISubstitutionGroupAffiliation(elem);

    sendElementEvent(
        "psv:substitutionGroupExclusions",
        this.translateBlockOrFinal(elem.getSubstitutionGroupExclusions()));
    sendElementEvent(
        "psv:disallowedSubstitutions",
        this.translateBlockOrFinal(elem.getDisallowedSubstitutions()));
    sendElementEvent("psv:abstract", String.valueOf(elem.getAbstract()));
    processPSVIAnnotation(elem.getAnnotation());
    sendUnIndentedElement("psv:elementDeclaration");
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:26,代码来源:PSVIWriter.java

示例13: createContentDFA

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
@Nullable
public static XmlContentDFA createContentDFA(@NotNull XmlTag parentTag) {
  final PsiFile file = parentTag.getContainingFile().getOriginalFile();
  if (!(file instanceof XmlFile)) return null;
  XSModel xsModel = ApplicationManager.getApplication().runReadAction(new NullableComputable<XSModel>() {
    @Override
    public XSModel compute() {
      return getXSModel((XmlFile)file);
    }
  });
  if (xsModel == null) {
    return null;
  }

  XSElementDeclaration decl = getElementDeclaration(parentTag, xsModel);
  if (decl == null) {
    return null;
  }
  return new XsContentDFA(decl, parentTag);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:XsContentDFA.java

示例14: getChildrenByName

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
@Override
	public Iterable<String> getChildrenByName(String node, XSElementDeclaration childElementDeclaration) throws SAXException {
		String name = childElementDeclaration.getName();
		List<String> result=new LinkedList<String>();
		if (data.containsKey(name)) {
			String value=data.get(name);
			result.addAll(Arrays.asList(value.split(valueSeparator)));
			if (log.isDebugEnabled()) {
				String elems="";
				for (String elem:result) {
					elems+=", ["+elem+"]";
				}
				log.debug("getChildrenByName returning: "+elems.substring(1));
			}
			return result;
		}
//		for (int i=1;data.containsKey(name+indexSeparator+i);i++) {
//			result.add(data.get(name+indexSeparator+i));
//		}
		return result;
	}
 
开发者ID:ibissource,项目名称:iaf,代码行数:22,代码来源:Properties2Xml.java

示例15: collectChildElements

import org.apache.xerces.xs.XSElementDeclaration; //导入依赖的package包/类
protected void collectChildElements(XSParticle particle, Set<String> elementNames) {
	if (particle==null) {
		log.warn("collectChildElements() particle is null, is this a problem?");	
		return;
	}
	XSTerm term = particle.getTerm();
	if (term==null) {
		throw new IllegalStateException("collectChildElements particle.term is null");
	} 
	if (term instanceof XSModelGroup) {
		XSModelGroup modelGroup = (XSModelGroup)term;
		XSObjectList particles = modelGroup.getParticles();
		for (int i=0;i<particles.getLength();i++) {
			XSParticle childParticle = (XSParticle)particles.item(i);
			collectChildElements(childParticle, elementNames);
		}
		return;
	} 
	if (term instanceof XSElementDeclaration) {
		XSElementDeclaration elementDeclaration=(XSElementDeclaration)term;
		String elementName=elementDeclaration.getName();
		if (DEBUG) log.debug("collectChildElements() ElementDeclaration name ["+elementName+"]");
		elementNames.add(elementName);
	}
	return;
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:27,代码来源:XmlAligner.java


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