本文整理汇总了Java中com.sun.org.apache.xerces.internal.util.DOMUtil类的典型用法代码示例。如果您正苦于以下问题:Java DOMUtil类的具体用法?Java DOMUtil怎么用?Java DOMUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DOMUtil类属于com.sun.org.apache.xerces.internal.util包,在下文中一共展示了DOMUtil类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: element2Locator
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
/**
* Extract location information from an Element node, store such
* information in the passed-in SimpleLocator object, then return
* true. Returning false means can't extract or store such information.
*/
public boolean element2Locator(Element e, SimpleLocator l) {
if (l == null)
return false;
if (e instanceof ElementImpl) {
ElementImpl ele = (ElementImpl)e;
// get system id from document object
Document doc = ele.getOwnerDocument();
String sid = (String)fDoc2SystemId.get(DOMUtil.getRoot(doc));
// line/column numbers are stored in the element node
int line = ele.getLineNumber();
int column = ele.getColumnNumber();
l.setValues(sid, sid, line, column, ele.getCharacterOffset());
return true;
}
return false;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:XSDHandler.java
示例2: resolveNamespace
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的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
示例3: element2Locator
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
/**
* Extract location information from an Element node, store such
* information in the passed-in SimpleLocator object, then return
* true. Returning false means can't extract or store such information.
*/
public boolean element2Locator(Element e, SimpleLocator l) {
if (l == null)
return false;
if (e instanceof ElementImpl) {
ElementImpl ele = (ElementImpl)e;
// get system id from document object
Document doc = ele.getOwnerDocument();
String sid = fDoc2SystemId.get(DOMUtil.getRoot(doc));
// line/column numbers are stored in the element node
int line = ele.getLineNumber();
int column = ele.getColumnNumber();
l.setValues(sid, sid, line, column, ele.getCharacterOffset());
return true;
}
return false;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:XSDHandler.java
示例4: genAnonTypeName
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
private String genAnonTypeName(Element simpleTypeDecl) {
// Generate a unique name for the anonymous type by concatenating together the
// names of parent nodes
// The name is quite good for debugging/error purposes, but we may want to
// revisit how this is done for performance reasons (LM).
StringBuffer typeName = new StringBuffer("#AnonType_");
Element node = DOMUtil.getParent(simpleTypeDecl);
while (node != null && (node != DOMUtil.getRoot(DOMUtil.getDocument(node)))) {
typeName.append(node.getAttribute(SchemaSymbols.ATT_NAME));
node = DOMUtil.getParent(node);
}
return typeName.toString();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XSDSimpleTypeTraverser.java
示例5: resolveKeyRefs
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
protected void resolveKeyRefs() {
for (int i=0; i<fKeyrefStackPos; i++) {
XSDocumentInfo keyrefSchemaDoc = fKeyrefsMapXSDocumentInfo[i];
keyrefSchemaDoc.fNamespaceSupport.makeGlobal();
keyrefSchemaDoc.fNamespaceSupport.setEffectiveContext( fKeyrefNamespaceContext[i] );
SchemaGrammar keyrefGrammar = fGrammarBucket.getGrammar(keyrefSchemaDoc.fTargetNamespace);
// need to set <keyref> to hidden before traversing it,
// because it has global scope
DOMUtil.setHidden(fKeyrefs[i], fHiddenNodes);
fKeyrefTraverser.traverse(fKeyrefs[i], fKeyrefElems[i], keyrefSchemaDoc, keyrefGrammar);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:XSDHandler.java
示例6: storeKeyRef
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
protected void storeKeyRef (Element keyrefToStore, XSDocumentInfo schemaDoc,
XSElementDecl currElemDecl) {
String keyrefName = DOMUtil.getAttrValue(keyrefToStore, SchemaSymbols.ATT_NAME);
if (keyrefName.length() != 0) {
String keyrefQName = schemaDoc.fTargetNamespace == null?
"," + keyrefName: schemaDoc.fTargetNamespace+","+keyrefName;
checkForDuplicateNames(keyrefQName, IDENTITYCONSTRAINT_TYPE, fUnparsedIdentityConstraintRegistry, fUnparsedIdentityConstraintRegistrySub, keyrefToStore, schemaDoc);
}
// now set up all the registries we'll need...
// check array sizes
if (fKeyrefStackPos == fKeyrefs.length) {
Element [] elemArray = new Element [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT];
System.arraycopy(fKeyrefs, 0, elemArray, 0, fKeyrefStackPos);
fKeyrefs = elemArray;
XSElementDecl [] declArray = new XSElementDecl [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT];
System.arraycopy(fKeyrefElems, 0, declArray, 0, fKeyrefStackPos);
fKeyrefElems = declArray;
String[][] stringArray = new String [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT][];
System.arraycopy(fKeyrefNamespaceContext, 0, stringArray, 0, fKeyrefStackPos);
fKeyrefNamespaceContext = stringArray;
XSDocumentInfo [] xsDocumentInfo = new XSDocumentInfo [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT];
System.arraycopy(fKeyrefsMapXSDocumentInfo, 0, xsDocumentInfo, 0, fKeyrefStackPos);
fKeyrefsMapXSDocumentInfo = xsDocumentInfo;
}
fKeyrefs[fKeyrefStackPos] = keyrefToStore;
fKeyrefElems[fKeyrefStackPos] = currElemDecl;
fKeyrefNamespaceContext[fKeyrefStackPos] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext();
fKeyrefsMapXSDocumentInfo[fKeyrefStackPos++] = schemaDoc;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:XSDHandler.java
示例7: changeRedefineGroup
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
private int changeRedefineGroup(String originalQName, String elementSought,
String newName, Element curr, XSDocumentInfo schemaDoc) {
int result = 0;
for (Element child = DOMUtil.getFirstChildElement(curr);
child != null; child = DOMUtil.getNextSiblingElement(child)) {
String name = DOMUtil.getLocalName(child);
if (!name.equals(elementSought))
result += changeRedefineGroup(originalQName, elementSought, newName, child, schemaDoc);
else {
String ref = child.getAttribute( SchemaSymbols.ATT_REF );
if (ref.length() != 0) {
String processedRef = findQName(ref, schemaDoc);
if (originalQName.equals(processedRef)) {
String prefix = XMLSymbols.EMPTY_STRING;
int colonptr = ref.indexOf(":");
if (colonptr > 0) {
prefix = ref.substring(0,colonptr);
child.setAttribute(SchemaSymbols.ATT_REF, prefix + ":" + newName);
}
else
child.setAttribute(SchemaSymbols.ATT_REF, newName);
result++;
if (elementSought.equals(SchemaSymbols.ELT_GROUP)) {
String minOccurs = child.getAttribute( SchemaSymbols.ATT_MINOCCURS );
String maxOccurs = child.getAttribute( SchemaSymbols.ATT_MAXOCCURS );
if (!((maxOccurs.length() == 0 || maxOccurs.equals("1"))
&& (minOccurs.length() == 0 || minOccurs.equals("1")))) {
reportSchemaError("src-redefine.6.1.2", new Object [] {ref}, child);
}
}
}
} // if ref was null some other stage of processing will flag the error
}
}
return result;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:XSDHandler.java
示例8: setSchemasVisible
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
private void setSchemasVisible(XSDocumentInfo startSchema) {
if (DOMUtil.isHidden(startSchema.fSchemaElement, fHiddenNodes)) {
// make it visible
DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes);
Vector dependingSchemas = (Vector)fDependencyMap.get(startSchema);
for (int i = 0; i < dependingSchemas.size(); i++) {
setSchemasVisible((XSDocumentInfo)dependingSchemas.elementAt(i));
}
}
// if it's visible already than so must be its children
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:XSDHandler.java
示例9: isAttrOrAttrGroup
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
private boolean isAttrOrAttrGroup(Element e) {
String elementName = DOMUtil.getLocalName(e);
if (elementName.equals(SchemaSymbols.ELT_ATTRIBUTE) ||
elementName.equals(SchemaSymbols.ELT_ATTRIBUTEGROUP) ||
elementName.equals(SchemaSymbols.ELT_ANYATTRIBUTE))
return true;
else
return false;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:XSDComplexTypeTraverser.java
示例10: genAnonTypeName
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
private String genAnonTypeName(Element complexTypeDecl) {
// Generate a unique name for the anonymous type by concatenating together the
// names of parent nodes
// The name is quite good for debugging/error purposes, but we may want to
// revisit how this is done for performance reasons (LM).
StringBuffer typeName = new StringBuffer("#AnonType_");
Element node = DOMUtil.getParent(complexTypeDecl);
while (node != null && (node != DOMUtil.getRoot(DOMUtil.getDocument(node)))) {
typeName.append(node.getAttribute(SchemaSymbols.ATT_NAME));
node = DOMUtil.getParent(node);
}
return typeName.toString();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XSDComplexTypeTraverser.java
示例11: checkNotationType
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
/**
* Element/Attribute traversers call this method to check whether
* the type is NOTATION without enumeration facet
*/
void checkNotationType(String refName, XSTypeDefinition typeDecl, Element elem) {
if (typeDecl.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE &&
((XSSimpleType)typeDecl).getVariety() == XSSimpleType.VARIETY_ATOMIC &&
((XSSimpleType)typeDecl).getPrimitiveKind() == XSSimpleType.PRIMITIVE_NOTATION) {
if ((((XSSimpleType)typeDecl).getDefinedFacets() & XSSimpleType.FACET_ENUMERATION) == 0) {
reportSchemaError("enumeration-required-notation", new Object[]{typeDecl.getName(), refName, DOMUtil.getLocalName(elem)}, elem);
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:XSDAbstractTraverser.java
示例12: nonAnnotationContent
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
private boolean nonAnnotationContent(Element elem) {
for(Element child = DOMUtil.getFirstChildElement(elem); child != null;
child = DOMUtil.getNextSiblingElement(child)) {
if(!(DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION))) return true;
}
return false;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:XSDHandler.java
示例13: setSchemasVisible
import com.sun.org.apache.xerces.internal.util.DOMUtil; //导入依赖的package包/类
private void setSchemasVisible(XSDocumentInfo startSchema) {
if (DOMUtil.isHidden(startSchema.fSchemaElement, fHiddenNodes)) {
// make it visible
DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes);
Vector<XSDocumentInfo> dependingSchemas = fDependencyMap.get(startSchema);
for (int i = 0; i < dependingSchemas.size(); i++) {
setSchemasVisible(dependingSchemas.elementAt(i));
}
}
// if it's visible already than so must be its children
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:XSDHandler.java
注:本文中的com.sun.org.apache.xerces.internal.util.DOMUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论