当前位置: 首页>>代码示例>>Java>>正文


Java Element.ELEMENT属性代码示例

本文整理汇总了Java中org.kxml2.kdom.Element.ELEMENT属性的典型用法代码示例。如果您正苦于以下问题:Java Element.ELEMENT属性的具体用法?Java Element.ELEMENT怎么用?Java Element.ELEMENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.kxml2.kdom.Element的用法示例。


在下文中一共展示了Element.ELEMENT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVagueElementPrintout

public static String getVagueElementPrintout(Element e, int maxDepth) {
	String elementString = "<" + e.getName();
	for(int i = 0; i <  e.getAttributeCount() ; ++i) {
		elementString += " " + e.getAttributeName(i) + "=\"";
		elementString += e.getAttributeValue(i) + "\"";
	}
	if(e.getChildCount() > 0) {
		elementString += ">";
		if(e.getType(0) ==Element.ELEMENT) {
			if(maxDepth > 0) {
				elementString += getVagueElementPrintout((Element)e.getChild(0),maxDepth -1);
			} else {
				elementString += "...";
			}
		}
	} else {
		elementString += "/>";
	}
	return elementString;
}
 
开发者ID:medic,项目名称:javarosa,代码行数:20,代码来源:XFormParser.java

示例2: parseUnregisteredSpecExtension

/**
 * Handle parsing and warning logic for a tag that doesn't have attached
 * logic already, but has been registered as a spec extension.
 *
 * @param namespace String that is usually a url i.e. "http://opendatakit.org/xforms"
 * @param name      String representing tag name i.e. "extra" for an element like <extra ...>
 * @param e         is the current element we are parsing
 * @param parent    is the parent to the element we are parsing
 * @param handlers  maps tags to IElementHandlers, used to perform parsing of that tag
 */
public void parseUnregisteredSpecExtension(String namespace, String name, Element e, Object parent, Hashtable<String, IElementHandler> handlers) {
    if (!XFormParser.suppressSpecExtensionWarnings.contains(namespace)) {
        // raise a warning about not knowing how to parse
        reporter.warning(XFormParserReporter.TYPE_UNKNOWN_MARKUP,
                "Unrecognized element [" + name + "] from namespace " + namespace + ".",
                getVagueLocation(e));
    }

    if (XFormParser.parseSpecExtensionsInnerElements.contains(namespace)) {
        // parse inner elements using default parsing logic.
        for (int i = 0; i < e.getChildCount(); i++) {
            if (e.getType(i) == Element.ELEMENT) {
                parseElement(e.getElement(i), parent, handlers);
            }
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:27,代码来源:XFormParser.java

示例3: getVagueElementPrintout

public static String getVagueElementPrintout(Element e, int maxDepth) {
    String elementString = "<" + e.getName();
    for (int i = 0; i < e.getAttributeCount(); ++i) {
        elementString += " " + e.getAttributeName(i) + "=\"";
        elementString += e.getAttributeValue(i) + "\"";
    }
    if (e.getChildCount() > 0) {
        elementString += ">";
        if (e.getType(0) == Element.ELEMENT) {
            if (maxDepth > 0) {
                elementString += getVagueElementPrintout((Element)e.getChild(0), maxDepth - 1);
            } else {
                elementString += "...";
            }
        }
    } else {
        elementString += "/>";
    }
    return elementString;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:20,代码来源:XFormParser.java

示例4: parseElement

private void parseElement (Element e, Object parent, HashMap<String, IElementHandler> handlers) { //,
//			boolean allowUnknownElements, boolean allowText, boolean recurseUnknown) {
		String name = e.getName();

		String[] suppressWarningArr = {
			"html",
			"head",
			"body",
			"xform",
			"chooseCaption",
			"addCaption",
			"addEmptyCaption",
			"delCaption",
			"doneCaption",
			"doneEmptyCaption",
			"mainHeader",
			"entryHeader",
			"delHeader"
		};
      List<String> suppressWarning = new ArrayList<String>(suppressWarningArr.length);
		for (int i = 0; i < suppressWarningArr.length; i++) {
			suppressWarning.add(suppressWarningArr[i]);
		}

		IElementHandler eh = handlers.get(name);
		if (eh != null) {
			eh.handle(this, e, parent);
		} else {
			if (!suppressWarning.contains(name)) {
				reporter.warning(XFormParserReporter.TYPE_UNKNOWN_MARKUP,
						"Unrecognized element [" + name	+ "]. Ignoring and processing children...",
						getVagueLocation(e));
			}
			for (int i = 0; i < e.getChildCount(); i++) {
				if (e.getType(i) == Element.ELEMENT) {
					parseElement(e.getElement(i), parent, handlers);
				}
			}
		}
	}
 
开发者ID:medic,项目名称:javarosa,代码行数:40,代码来源:XFormParser.java

示例5: parseElement

/**
 * @param e        is the current element we are parsing
 * @param parent   is the parent to the element we are parsing
 * @param handlers maps tags to IElementHandlers, used to perform parsing of that tag
 */
private void parseElement(Element e, Object parent, Hashtable<String, IElementHandler> handlers) {
    String name = e.getName();
    String namespace = e.getNamespace();

    String[] suppressWarningArr = {
            "html",
            "head",
            "body",
            "xform",
            "chooseCaption",
            "addCaption",
            "addEmptyCaption",
            "delCaption",
            "doneCaption",
            "doneEmptyCaption",
            "mainHeader",
            "entryHeader",
            "delHeader"
    };
    Vector<String> suppressWarning = new Vector<String>();
    for (int i = 0; i < suppressWarningArr.length; i++) {
        suppressWarning.addElement(suppressWarningArr[i]);
    }

    // if there is a registered parser, invoke it
    IElementHandler eh = handlers.get(name);
    if (eh != null) {
        eh.handle(this, e, parent);
    } else {
        if (inSpecExtension(namespace, name)) {
            parseUnregisteredSpecExtension(namespace, name, e, parent, handlers);
        } else {
            if (!suppressWarning.contains(name)) {
                reporter.warning(XFormParserReporter.TYPE_UNKNOWN_MARKUP,
                        "Unrecognized element [" + name + "]. Ignoring and processing children...",
                        getVagueLocation(e));
            }
            // parse children
            for (int i = 0; i < e.getChildCount(); i++) {
                if (e.getType(i) == Element.ELEMENT) {
                    parseElement(e.getElement(i), parent, handlers);
                }
            }
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:51,代码来源:XFormParser.java

示例6: parseElement

/**
 * @param e        is the current element we are parsing
 * @param parent   is the parent to the element we are parsing
 * @param handlers maps tags to IElementHandlers, used to perform parsing of that tag
 */
private void parseElement(Element e, Object parent, Hashtable<String, IElementHandler> handlers) {
    String name = e.getName();
    String namespace = e.getNamespace();

    String[] suppressWarningArr = {
            "html",
            "head",
            "body",
            "xform",
            "chooseCaption",
            "addCaption",
            "addEmptyCaption",
            "delCaption",
            "doneCaption",
            "doneEmptyCaption",
            "mainHeader",
            "entryHeader",
            "delHeader"
    };
    Vector<String> suppressWarning = new Vector<>();
    for (String aSuppressWarningArr : suppressWarningArr) {
        suppressWarning.addElement(aSuppressWarningArr);
    }

    // if there is a registered parser, invoke it
    IElementHandler eh = handlers.get(name);
    if (eh != null) {
        eh.handle(this, e, parent);
    } else {
        if (inSpecExtension(namespace, name)) {
            parseUnregisteredSpecExtension(namespace, name, e, parent, handlers);
        } else {
            if (!suppressWarning.contains(name)) {
                reporter.warning(XFormParserReporter.TYPE_UNKNOWN_MARKUP,
                        "Unrecognized element [" + name + "]. Ignoring and processing children...",
                        getVagueLocation(e));
            }
            // parse children
            for (int i = 0; i < e.getChildCount(); i++) {
                if (e.getType(i) == Element.ELEMENT) {
                    parseElement(e.getElement(i), parent, handlers);
                }
            }
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:51,代码来源:XFormParser.java


注:本文中的org.kxml2.kdom.Element.ELEMENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。