本文整理汇总了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;
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
}
}