本文整理匯總了Java中org.apache.xerces.util.DOMUtil.getFirstChildElement方法的典型用法代碼示例。如果您正苦於以下問題:Java DOMUtil.getFirstChildElement方法的具體用法?Java DOMUtil.getFirstChildElement怎麽用?Java DOMUtil.getFirstChildElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.xerces.util.DOMUtil
的用法示例。
在下文中一共展示了DOMUtil.getFirstChildElement方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processPSVIAnnotation
import org.apache.xerces.util.DOMUtil; //導入方法依賴的package包/類
private void processPSVIAnnotation(XSAnnotation ann) {
if (ann == null) {
sendElementEvent("psv:annotation");
}
else {
sendIndentedElement("psv:annotation");
// We can't get all the information from DOM, but I've outputed what
// we can get -- PJM
Node dom = new DocumentImpl();
ann.writeAnnotation(dom, XSAnnotation.W3C_DOM_DOCUMENT);
// this child will be the annotation element
Element annot = DOMUtil.getFirstChildElement(dom);
processDOMElement(
annot,
SchemaSymbols.ELT_APPINFO,
"psv:applicationInformation");
processDOMElement(
annot,
SchemaSymbols.ELT_DOCUMENTATION,
"psv:userInformation");
processDOMAttributes(annot);
sendUnIndentedElement("psv:annotation");
}
}
示例2: changeRedefineGroup
import org.apache.xerces.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;
}
示例3: nonAnnotationContent
import org.apache.xerces.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;
}
示例4: processDOMElement
import org.apache.xerces.util.DOMUtil; //導入方法依賴的package包/類
private void processDOMElement(
Node node,
String elementName,
String tagName) {
if (node == null)
return;
boolean foundElem = false;
for (Element child = DOMUtil.getFirstChildElement(node);
child != null;
child = DOMUtil.getNextSiblingElement(child)) {
if (DOMUtil.getLocalName(child).equals(elementName)) {
if (!foundElem) {
sendIndentedElement(tagName);
foundElem = true;
}
sendIndentedElement("element");
sendElementEvent(
"namespaceName",
DOMUtil.getNamespaceURI(child));
sendElementEvent("localName", DOMUtil.getLocalName(child));
sendElementEvent("prefix", child.getPrefix());
sendIndentedElement("children");
sendIndentedElement("character");
sendElementEvent("textContent", DOMUtil.getChildText(child));
sendUnIndentedElement("character");
sendUnIndentedElement("children");
//Create XMLAttributes from DOM
Attr[] atts = (Element) child == null ? null : DOMUtil.getAttrs((Element) child);
XMLAttributes attrs = new XMLAttributesImpl();
for (int i=0; i<atts.length; i++) {
Attr att = (Attr)atts[i];
attrs.addAttribute(
new QName(att.getPrefix(), att.getLocalName(), att.getName(), att.getNamespaceURI()),
"CDATA" ,att.getValue()
);
}
processAttributes(attrs);
sendUnIndentedElement("element");
}
}
if (foundElem) {
sendUnIndentedElement(tagName);
}
else {
sendEmptyElementEvent(tagName);
}
}