當前位置: 首頁>>代碼示例>>Java>>正文


Java DOMUtil.getFirstChildElement方法代碼示例

本文整理匯總了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");
    }
}
 
開發者ID:AaronZhangL,項目名稱:SplitCharater,代碼行數:27,代碼來源:PSVIWriter.java

示例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;
}
 
開發者ID:AaronZhangL,項目名稱:SplitCharater,代碼行數:37,代碼來源:XSDHandler.java

示例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;
}
 
開發者ID:AaronZhangL,項目名稱:SplitCharater,代碼行數:7,代碼來源:XSDHandler.java

示例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);
    }
}
 
開發者ID:AaronZhangL,項目名稱:SplitCharater,代碼行數:50,代碼來源:PSVIWriter.java


注:本文中的org.apache.xerces.util.DOMUtil.getFirstChildElement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。