本文整理汇总了Java中com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport类的典型用法代码示例。如果您正苦于以下问题:Java SchemaNamespaceSupport类的具体用法?Java SchemaNamespaceSupport怎么用?Java SchemaNamespaceSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SchemaNamespaceSupport类属于com.sun.org.apache.xerces.internal.impl.xs包,在下文中一共展示了SchemaNamespaceSupport类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: resolveNamespace
import com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport; //导入依赖的package包/类
public void resolveNamespace(Element element, Attr[] attrs,
SchemaNamespaceSupport nsSupport) {
// push the namespace context
nsSupport.pushContext();
// search for new namespace bindings
int length = attrs.length;
Attr sattr = null;
String rawname, prefix, uri;
for (int i = 0; i < length; i++) {
sattr = attrs[i];
rawname = DOMUtil.getName(sattr);
prefix = null;
if (rawname.equals(XMLSymbols.PREFIX_XMLNS))
prefix = XMLSymbols.EMPTY_STRING;
else if (rawname.startsWith("xmlns:"))
prefix = fSymbolTable.addSymbol(DOMUtil.getLocalName(sattr));
if (prefix != null) {
uri = fSymbolTable.addSymbol(DOMUtil.getValue(sattr));
nsSupport.declarePrefix(prefix, uri.length()!=0 ? uri : null);
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:XSAttributeChecker.java
示例2: initNamespaceSupport
import com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport; //导入依赖的package包/类
/**
* Initialize namespace support by collecting all of the namespace
* declarations in the root's ancestors. This is necessary to
* support schemas fragments, i.e. schemas embedded in other
* documents. See,
*
* https://jaxp.dev.java.net/issues/show_bug.cgi?id=43
*
* Requires the DOM to be created with namespace support enabled.
*/
private void initNamespaceSupport(Element schemaRoot) {
fNamespaceSupport = new SchemaNamespaceSupport();
fNamespaceSupport.reset();
Node parent = schemaRoot.getParentNode();
while (parent != null && parent.getNodeType() == Node.ELEMENT_NODE
&& !parent.getNodeName().equals("DOCUMENT_NODE"))
{
Element eparent = (Element) parent;
NamedNodeMap map = eparent.getAttributes();
int length = (map != null) ? map.getLength() : 0;
for (int i = 0; i < length; i++) {
Attr attr = (Attr) map.item(i);
String uri = attr.getNamespaceURI();
// Check if attribute is an ns decl -- requires ns support
if (uri != null && uri.equals("http://www.w3.org/2000/xmlns/")) {
String prefix = attr.getLocalName().intern();
if (prefix == "xmlns") prefix = "";
// Declare prefix if not set -- moving upwards
if (fNamespaceSupport.getURI(prefix) == null) {
fNamespaceSupport.declarePrefix(prefix,
attr.getValue().intern());
}
}
}
parent = parent.getParentNode();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:XSDocumentInfo.java
示例3: findQName
import com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport; //导入依赖的package包/类
private String findQName(String name, XSDocumentInfo schemaDoc) {
SchemaNamespaceSupport currNSMap = schemaDoc.fNamespaceSupport;
int colonPtr = name.indexOf(':');
String prefix = XMLSymbols.EMPTY_STRING;
if (colonPtr > 0)
prefix = name.substring(0, colonPtr);
String uri = currNSMap.getURI(fSymbolTable.addSymbol(prefix));
String localpart = (colonPtr == 0)?name:name.substring(colonPtr+1);
if (prefix == XMLSymbols.EMPTY_STRING && uri == null && schemaDoc.fIsChameleonSchema)
uri = schemaDoc.fTargetNamespace;
if (uri == null)
return ","+localpart;
return uri+","+localpart;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XSDHandler.java
示例4: XSDocumentInfo
import com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport; //导入依赖的package包/类
XSDocumentInfo (Element schemaRoot, XSAttributeChecker attrChecker, SymbolTable symbolTable)
throws XMLSchemaException {
fSchemaElement = schemaRoot;
initNamespaceSupport(schemaRoot);
fIsChameleonSchema = false;
fSymbolTable = symbolTable;
fAttrChecker = attrChecker;
if (schemaRoot != null) {
Element root = schemaRoot;
fSchemaAttrs = attrChecker.checkAttributes(root, true, this);
// schemaAttrs == null means it's not an <xsd:schema> element
// throw an exception, but we don't know the document systemId,
// so we leave that to the caller.
if (fSchemaAttrs == null) {
throw new XMLSchemaException(null, null);
}
fAreLocalAttributesQualified =
((XInt)fSchemaAttrs[XSAttributeChecker.ATTIDX_AFORMDEFAULT]).intValue() == SchemaSymbols.FORM_QUALIFIED;
fAreLocalElementsQualified =
((XInt)fSchemaAttrs[XSAttributeChecker.ATTIDX_EFORMDEFAULT]).intValue() == SchemaSymbols.FORM_QUALIFIED;
fBlockDefault =
((XInt)fSchemaAttrs[XSAttributeChecker.ATTIDX_BLOCKDEFAULT]).shortValue();
fFinalDefault =
((XInt)fSchemaAttrs[XSAttributeChecker.ATTIDX_FINALDEFAULT]).shortValue();
fTargetNamespace =
(String)fSchemaAttrs[XSAttributeChecker.ATTIDX_TARGETNAMESPACE];
if (fTargetNamespace != null)
fTargetNamespace = symbolTable.addSymbol(fTargetNamespace);
fNamespaceSupportRoot = new SchemaNamespaceSupport(fNamespaceSupport);
//set namespace support
fValidationContext.setNamespaceSupport(fNamespaceSupport);
fValidationContext.setSymbolTable(symbolTable);
// pass null as the schema document, so that the namespace
// context is not popped.
// don't return the attribute array yet!
//attrChecker.returnAttrArray(schemaAttrs, null);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:XSDocumentInfo.java
示例5: restoreNSSupport
import com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport; //导入依赖的package包/类
void restoreNSSupport() {
fNamespaceSupport = (SchemaNamespaceSupport)SchemaNamespaceSupportStack.pop();
fValidationContext.setNamespaceSupport(fNamespaceSupport);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:XSDocumentInfo.java
示例6: traverseGlobalDecl
import com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport; //导入依赖的package包/类
protected Object traverseGlobalDecl(int declType, Element decl, XSDocumentInfo schemaDoc, SchemaGrammar grammar) {
Object retObj = null;
DOMUtil.setHidden(decl, fHiddenNodes);
SchemaNamespaceSupport nsSupport = null;
// if the parent is <redefine> use the namespace delcs for it.
Element parent = DOMUtil.getParent(decl);
if (DOMUtil.getLocalName(parent).equals(SchemaSymbols.ELT_REDEFINE))
nsSupport = (fRedefine2NSSupport!=null)?(SchemaNamespaceSupport)fRedefine2NSSupport.get(parent):null;
// back up the current SchemaNamespaceSupport, because we need to provide
// a fresh one to the traverseGlobal methods.
schemaDoc.backupNSSupport(nsSupport);
// traverse the referenced global component
switch (declType) {
case TYPEDECL_TYPE :
if (DOMUtil.getLocalName(decl).equals(SchemaSymbols.ELT_COMPLEXTYPE)) {
retObj = fComplexTypeTraverser.traverseGlobal(decl, schemaDoc, grammar);
}
else {
retObj = fSimpleTypeTraverser.traverseGlobal(decl, schemaDoc, grammar);
}
break;
case ATTRIBUTE_TYPE :
retObj = fAttributeTraverser.traverseGlobal(decl, schemaDoc, grammar);
break;
case ELEMENT_TYPE :
retObj = fElementTraverser.traverseGlobal(decl, schemaDoc, grammar);
break;
case ATTRIBUTEGROUP_TYPE :
retObj = fAttributeGroupTraverser.traverseGlobal(decl, schemaDoc, grammar);
break;
case GROUP_TYPE :
retObj = fGroupTraverser.traverseGlobal(decl, schemaDoc, grammar);
break;
case NOTATION_TYPE :
retObj = fNotationTraverser.traverse(decl, schemaDoc, grammar);
break;
case IDENTITYCONSTRAINT_TYPE :
// identity constraints should have been parsed already...
// we should never get here
break;
}
// restore the previous SchemaNamespaceSupport, so that the caller can get
// proper namespace binding.
schemaDoc.restoreNSSupport();
return retObj;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:XSDHandler.java
注:本文中的com.sun.org.apache.xerces.internal.impl.xs.SchemaNamespaceSupport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论