本文整理汇总了Java中org.apache.xerces.xs.XSElementDeclaration.getNamespace方法的典型用法代码示例。如果您正苦于以下问题:Java XSElementDeclaration.getNamespace方法的具体用法?Java XSElementDeclaration.getNamespace怎么用?Java XSElementDeclaration.getNamespace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xs.XSElementDeclaration
的用法示例。
在下文中一共展示了XSElementDeclaration.getNamespace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: XbrlTaxonomy
import org.apache.xerces.xs.XSElementDeclaration; //导入方法依赖的package包/类
public XbrlTaxonomy(XSElementDeclaration elementDec, NamedNodeMap attributes){
this.namespace = elementDec.getNamespace();
this.name = elementDec.getName();
this.isAbstract = elementDec.getAbstract();
this.isNillable = elementDec.getNillable();
//this.type = elementDec.getTypeDefinition();
this.substitutionGroupNamespace = elementDec.getSubstitutionGroupAffiliation().getNamespace();
this.substitutionGroupName = elementDec.getSubstitutionGroupAffiliation().getName();
this.typeNamespace = elementDec.getTypeDefinition().getNamespace();
this.typeName = elementDec.getTypeDefinition().getName();
//this.substitutionGroup = elementDec.getSubstitutionGroupAffiliation();
//this.hasBalanceType = false;
//this.hasPeriodType = false;
for(int i = 0; i < attributes.getLength(); i++){
Node attrNode = attributes.item(i);
//String attrNS = attrNode.getNamespaceURI();
String attrName = attrNode.getNodeName().toLowerCase();
String attrValue = attrNode.getNodeValue();
if(attrName.equals("xbrli:periodtype")){
//this.hasPeriodType = true;
periodType = PeriodType.valueOf(attrValue.toLowerCase());
}
else if(attrName.equals("xbrli:balance")){
//this.hasBalanceType = true;
balanceType = BalanceType.valueOf(attrValue.toLowerCase());
}
}
}
示例3: preProcess
import org.apache.xerces.xs.XSElementDeclaration; //导入方法依赖的package包/类
@Override
public boolean preProcess(XSElementDeclaration elem, Path path){
appendCompositor(path);
String uri = elem.getNamespace()==null ? "" : elem.getNamespace();
doc.declarePrefix(uri);
buff.append(doc.toQName(uri, elem.getName()));
appendCardinality(path);
return false;
}
示例4: findNamespaceForName
import org.apache.xerces.xs.XSElementDeclaration; //导入方法依赖的package包/类
public String findNamespaceForName(String name) throws SAXException {
XSElementDeclaration elementDeclaration=findElementDeclarationForName(null,name);
if (elementDeclaration==null) {
return null;
}
return elementDeclaration.getNamespace();
}
示例5: processElement
import org.apache.xerces.xs.XSElementDeclaration; //导入方法依赖的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;
}
示例6: handleElement
import org.apache.xerces.xs.XSElementDeclaration; //导入方法依赖的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);
// }
}