• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XSAttributeUse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: checkComplexType

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
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,代码行数:27,代码来源:XSDModelLoader.java


示例2: processPSVIAttributeUses

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
private void processPSVIAttributeUses(XSObjectList uses) {
    if (uses == null || uses.getLength() == 0) {
        sendElementEvent("psv:attributeUses");
    }
    else {
        sendIndentedElement("psv:attributeUses");
        for (int i = 0; i < uses.getLength(); i++) {
            XSAttributeUse use = (XSAttributeUse)uses.item(i);
            sendIndentedElement("psv:attributeUse");
            sendElementEvent("psv:required", String.valueOf(use.getRequired()));
            processPSVIAttributeDeclarationOrRef(use.getAttrDeclaration());
            processPSVIValueConstraint(use.getConstraintType(), use.getConstraintValue());
            sendUnIndentedElement("psv:attributeUse");
        }
        sendUnIndentedElement("psv:attributeUses");
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:18,代码来源:PSVIWriter.java


示例3: processAttribute

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
private void processAttribute(Path parent, String path, XSAttributeUse xsAttribute) throws BagriException {
  	
   path += "/@" + xsAttribute.getAttrDeclaration().getName();
   XSSimpleTypeDefinition std = xsAttribute.getAttrDeclaration().getTypeDefinition();
   Occurrence occurrence = Occurrence.getOccurrence(
   		xsAttribute.getRequired() ? 1 : 0,
   		std.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST ? -1 : 1);
Path xp = modelMgr.translatePath(parent.getRoot(), path, NodeKind.attribute, parent.getPathId(), getBaseType(std), occurrence);
logger.trace("processAttribute; attribute: {}; type: {}; got XDMPath: {}", path, std, xp); 
  }
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:11,代码来源:XmlModeler.java


示例4: expandRelatedAttributeUsesComponents

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
private void expandRelatedAttributeUsesComponents(XSObjectList attrUses, Vector componentList,
        String namespace, Hashtable dependencies) {
    final int attrUseSize = (attrUses == null) ? 0 : attrUses.size();
    for (int i=0; i<attrUseSize; i++) {
        expandRelatedAttributeUseComponents((XSAttributeUse)attrUses.item(i), componentList, namespace, dependencies);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:8,代码来源:XSDHandler.java


示例5: replaceAttributeUse

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
public void replaceAttributeUse(XSAttributeUse oldUse, XSAttributeUseImpl newUse) {
    for (int i=0; i<fAttrUseNum; i++) {
        if (fAttributeUses[i] == oldUse) {
            fAttributeUses[i] = newUse;
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:8,代码来源:XSAttributeGroupDecl.java


示例6: getAttributeUse

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
public XSAttributeUse getAttributeUse(String namespace, String name) {
    for (int i=0; i<fAttrUseNum; i++) {
        if ( (fAttributeUses[i].fAttrDecl.fTargetNamespace == namespace) &&
             (fAttributeUses[i].fAttrDecl.fName == name) )
            return fAttributeUses[i];
    }

    return null;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:10,代码来源:XSAttributeGroupDecl.java


示例7: getAttributeUseNoProhibited

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
public XSAttributeUse getAttributeUseNoProhibited(String namespace, String name) {
    for (int i=0; i<fAttrUseNum; i++) {
        if ( (fAttributeUses[i].fAttrDecl.fTargetNamespace == namespace) &&
             (fAttributeUses[i].fAttrDecl.fName == name) &&
             (fAttributeUses[i].fUse != SchemaSymbols.USE_PROHIBITED))
            return fAttributeUses[i];
    }

    return null;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:11,代码来源:XSAttributeGroupDecl.java


示例8: parseXSObject

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
/**
 * Parse a schema element and attach the result to the given node.
 * 
 * @param schemaElem the schema element.
 * @param nodeContext the Node where the xml instance is generated.
 * @return the generated DOM node.
 */
protected Node parseXSObject(XSObject schemaElem,
                             Node nodeContext) throws Exception {
   Element contentElem = null;
   if (!(schemaElem instanceof XSSimpleTypeDefinition)) {
      // create the element
      contentElem = DocumentHelper.createElement(generatedDoc, schemaElem.getNamespace(), schemaElem.getName());
   }
   XSTypeDefinition tDefinition = null;
   if (schemaElem instanceof XSElementDeclaration) {
      tDefinition = ((XSElementDeclaration) schemaElem).getTypeDefinition();
      nodeContext.appendChild(contentElem);
   }
   else if (schemaElem instanceof XSTypeDefinition) {
      tDefinition = ((XSTypeDefinition) schemaElem);
   }
   else {
      tDefinition = ((XSTypeDefinition) schemaElem);
   }

   if (tDefinition instanceof XSComplexTypeDefinition) {
      XSComplexTypeDefinition ctDef = (XSComplexTypeDefinition) tDefinition;

      XSObjectList attList = ctDef.getAttributeUses();
      for (int i = 0; i < attList.getLength(); i++) {
         XSAttributeUse attrUseObject = (XSAttributeUse) attList.item(i);
         String attribname = attrUseObject.getAttrDeclaration().getName();
         if (sampleXML) {
            parseXSObject(attrUseObject.getAttrDeclaration().getTypeDefinition(),
                          DocumentHelper.createElement(generatedDoc, null, attribname));
         }
         assignAttributeValue(attribname, contentElem);
      }

      XSParticle particle = ((XSComplexTypeDefinition) tDefinition).getParticle();

      String typeDefName = tDefinition.getName();
      if (null != typeDefName) {
         processXSParticle(particle, contentElem);
      }
      else {
         processXSParticle(particle, contentElem);
      }
   }
   else {
      if (sampleXML) {
         StringList enumeration = ((XSSimpleTypeDefinition) tDefinition).getLexicalEnumeration();
         if (0 < enumeration.getLength()) {
            String name;
            if (null == nodeContext.getParentNode()) {
               name = "'" + nodeContext.getNodeName() + "' attribute";
            }
            else {
               name = "'" + schemaElem.getName() + "' node";
            }
            ArrayList<String> enumList = enumerationMap.get(name);
            if (null == enumList) {
               enumList = new ArrayList<String>();
               enumerationMap.put(name, enumList);
            }
            for (int i = 0; i < enumeration.getLength(); i++) {
               enumList.add(enumeration.item(i));
            }
         }
      }
   }
   if (!(schemaElem instanceof XSSimpleTypeDefinition)) {
      assignNodeValue(contentElem);
   }
   return contentElem;
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:78,代码来源:SchemaLoader.java


示例9: process

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
@SuppressWarnings({"UnusedDeclaration"})
protected Color process(XSAttributeUse attrUse){
    return COLOR_ATTRIBUTE;
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:5,代码来源:XSColorVisitor.java


示例10: processElement

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
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;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:68,代码来源:XmlModeler.java


示例11: expandRelatedAttributeUseComponents

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
private void expandRelatedAttributeUseComponents(XSAttributeUse component, Vector componentList,
        String namespace, Hashtable dependencies) {
    addRelatedAttribute(component.getAttrDeclaration(), componentList, namespace, dependencies);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:5,代码来源:XSDHandler.java


示例12: mergeAttributes

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
private void mergeAttributes(XSAttributeGroupDecl fromAttrGrp,
        XSAttributeGroupDecl toAttrGrp,
        String typeName,
        boolean extension,
        Element elem)
throws ComplexTypeRecoverableError {
    
    XSObjectList attrUseS = fromAttrGrp.getAttributeUses();
    XSAttributeUseImpl oneAttrUse = null;
    int attrCount = attrUseS.getLength();
    for (int i=0; i<attrCount; i++) {
        oneAttrUse = (XSAttributeUseImpl)attrUseS.item(i);
        XSAttributeUse existingAttrUse = toAttrGrp.getAttributeUse(oneAttrUse.fAttrDecl.getNamespace(),
                oneAttrUse.fAttrDecl.getName());
        if (existingAttrUse == null) {
            
            String idName = toAttrGrp.addAttributeUse(oneAttrUse);
            if (idName != null) {
                throw new ComplexTypeRecoverableError("ct-props-correct.5",
                        new Object[]{typeName, idName, oneAttrUse.fAttrDecl.getName()},
                        elem);
            }
        }
        else if (existingAttrUse != oneAttrUse) {
            if (extension) {
                reportSchemaError("ct-props-correct.4",
                        new Object[]{typeName, oneAttrUse.fAttrDecl.getName()},
                        elem);
                // Recover by using the attribute use from the base type,
                // to make the resulting schema "more valid".
                toAttrGrp.replaceAttributeUse(existingAttrUse, oneAttrUse);
            }
        }
    }
    // For extension, the wildcard must be formed by doing a union of the wildcards
    if (extension) {
        if (toAttrGrp.fAttributeWC==null) {
            toAttrGrp.fAttributeWC = fromAttrGrp.fAttributeWC;
        }
        else if (fromAttrGrp.fAttributeWC != null) {
            toAttrGrp.fAttributeWC = toAttrGrp.fAttributeWC.performUnionWith(fromAttrGrp.fAttributeWC, toAttrGrp.fAttributeWC.fProcessContents);
            if (toAttrGrp.fAttributeWC == null) {
                // REVISIT: XML Schema 1.0 2nd edition doesn't actually specify this constraint. It's a bug in the spec
                // which will eventually be fixed. We're just guessing what the error code will be. If it turns out to be
                // something else we'll need to change it. -- mrglavas
                throw new ComplexTypeRecoverableError("src-ct.5", new Object[]{typeName}, elem);
            }
        }
        
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:52,代码来源:XSDComplexTypeTraverser.java


示例13: getAttributeUse

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
public XSAttributeUse getAttributeUse(String namespace, String name) {
     return fAttrGrp.getAttributeUse(namespace, name);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:4,代码来源:XSComplexTypeDecl.java


示例14: startElement

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
	boolean xmlArrayContainer=aligner.isParentOfSingleMultipleOccurringChildElement();
	boolean repeatedElement=aligner.isMultipleOccurringChildInParentElement(localName);
	XSTypeDefinition typeDefinition=aligner.getTypeDefinition();
	if (!localName.equals(topElement)) {
		if (topElement!=null) {
			if (DEBUG) log.debug("endElementGroup ["+topElement+"]");
			documentContainer.endElementGroup(topElement);	
		}
		if (DEBUG) log.debug("startElementGroup ["+localName+"]");
		documentContainer.startElementGroup(localName, xmlArrayContainer, repeatedElement, typeDefinition);	
		topElement=localName;			
	}
	element.push(topElement);
	topElement=null;
	if (DEBUG) log.debug("startElement ["+localName+"] xml array container ["+aligner.isParentOfSingleMultipleOccurringChildElement()+"] repeated element ["+aligner.isMultipleOccurringChildInParentElement(localName)+"]");
	documentContainer.startElement(localName,xmlArrayContainer,repeatedElement, typeDefinition);
	super.startElement(uri, localName, qName, atts);
	if (aligner.isNil(atts)) {
		documentContainer.setNull();
	} else {
		if (writeAttributes) {
			XSObjectList attributeUses=aligner.getAttributeUses();
			if (attributeUses==null) {
				if (atts.getLength()>0) {
					log.warn("found ["+atts.getLength()+"] attributes, but no declared AttributeUses");
				}
			} else {
				for (int i=0;i<attributeUses.getLength(); i++) {
					XSAttributeUse attributeUse=(XSAttributeUse)attributeUses.item(i);
					XSAttributeDeclaration attributeDeclaration=attributeUse.getAttrDeclaration();
					XSSimpleTypeDefinition attTypeDefinition=attributeDeclaration.getTypeDefinition();
					String attName=attributeDeclaration.getName();
					String attNS=attributeDeclaration.getNamespace();
					if (DEBUG) log.debug("startElement ["+localName+"] searching attribute ["+attNS+":"+attName+"]");
					int attIndex=attNS!=null? atts.getIndex(attNS, attName):atts.getIndex(attName);
					if (attIndex>=0) {
						String value=atts.getValue(attIndex);
						if (DEBUG) log.debug("startElement ["+localName+"] attribute ["+attNS+":"+attName+"] value ["+value+"]");
						if (StringUtils.isNotEmpty(value)) {
							documentContainer.setAttribute(attName, value, attTypeDefinition);
						}
					}
				}
			}
		}
	}
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:50,代码来源:XmlTo.java


示例15: handleElement

import org.apache.xerces.xs.XSAttributeUse; //导入依赖的package包/类
public void handleElement(XSElementDeclaration elementDeclaration, N node) throws SAXException {
		String name = elementDeclaration.getName();
		String elementNamespace=elementDeclaration.getNamespace();
		String qname=getQName(elementNamespace, name);
		if (DEBUG) log.debug("handleNode() name ["+name+"] elementNamespace ["+elementNamespace+"]");
		newLine();
		AttributesImpl attributes=new AttributesImpl();
		Map<String,String> nodeAttributes = getAttributes(elementDeclaration, node);
		if (DEBUG) log.debug("node ["+name+"] search for attributeDeclaration");
		XSTypeDefinition typeDefinition=elementDeclaration.getTypeDefinition();
		XSObjectList attributeUses=getAttributeUses(typeDefinition);
		if (attributeUses==null || attributeUses.getLength()==0) {
			if (nodeAttributes!=null && nodeAttributes.size()>0) {
				log.warn("node ["+name+"] found ["+nodeAttributes.size()+"] attributes, but no declared AttributeUses");
			} else {
				if (DEBUG) log.debug("node ["+name+"] no attributeUses, no attributes");
			}
		} else {
			if (nodeAttributes==null || nodeAttributes.isEmpty()) {
				log.warn("node ["+name+"] declared ["+attributeUses.getLength()+"] attributes, but no attributes found");
			} else {
				for (int i=0;i<attributeUses.getLength(); i++) {
					XSAttributeUse attributeUse=(XSAttributeUse)attributeUses.item(i);
					//if (DEBUG) log.debug("startElement ["+localName+"] attributeUse ["+ToStringBuilder.reflectionToString(attributeUse)+"]");
					XSAttributeDeclaration attributeDeclaration=attributeUse.getAttrDeclaration();
					if (DEBUG) log.debug("node ["+name+"] attributeDeclaration ["+ToStringBuilder.reflectionToString(attributeDeclaration)+"]");
					XSSimpleTypeDefinition attTypeDefinition=attributeDeclaration.getTypeDefinition();
					if (DEBUG) log.debug("node ["+name+"] attTypeDefinition ["+ToStringBuilder.reflectionToString(attTypeDefinition)+"]");
					String attName=attributeDeclaration.getName();
					if (nodeAttributes.containsKey(attName)) {
						String value=nodeAttributes.remove(attName);
						String uri=attributeDeclaration.getNamespace();
						String attqname=getQName(uri,attName);
						String type=null;
						if (DEBUG) log.debug("node ["+name+"] adding attribute ["+attName+"] value ["+value+"]");
						attributes.addAttribute(uri, attName, attqname, type, value);
					}
				}
			}
		}
		if (isNil(elementDeclaration, node)) {
			validatorHandler.startPrefixMapping(XSI_PREFIX_MAPPING, XML_SCHEMA_INSTANCE_NAMESPACE);
			attributes.addAttribute(XML_SCHEMA_INSTANCE_NAMESPACE, XML_SCHEMA_NIL_ATTRIBUTE, XSI_PREFIX_MAPPING+":"+XML_SCHEMA_NIL_ATTRIBUTE, "xs:boolean", "true");
			validatorHandler.startElement(elementNamespace, name, qname, attributes);
			validatorHandler.endElement(elementNamespace, name, qname);
			validatorHandler.endPrefixMapping(XSI_PREFIX_MAPPING);
		} else {
			validatorHandler.startElement(elementNamespace, name, qname, attributes);
			handleElementContents(elementDeclaration, node);
			validatorHandler.endElement(elementNamespace, name, qname);
		}
//		if (createdPrefix!=null) {
//			validatorHandler.endPrefixMapping(createdPrefix);
//		}
	}
 
开发者ID:ibissource,项目名称:iaf,代码行数:56,代码来源:ToXml.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PropertiesContainer类代码示例发布时间:2022-05-22
下一篇:
Java ElasticsearchSecurityException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap