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


Java Element.removeChild方法代码示例

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


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

示例1: recurseForOutput

import org.kxml2.kdom.Element; //导入方法依赖的package包/类
private void recurseForOutput(Element e){
	if(e.getChildCount() == 0) return;

	for(int i=0;i<e.getChildCount();i++){
		int kidType = e.getType(i);
		if(kidType == Node.TEXT) { continue; }
		if(e.getChild(i) instanceof String) { continue; }
		Element kid = (Element)e.getChild(i);

			//is just text
		if(kidType == Node.ELEMENT && XFormUtils.isOutput(kid)){
			String s = "${"+parseOutput(kid)+"}";
			e.removeChild(i);
			e.addChild(i, Node.TEXT, s);

			//has kids? Recurse through them and swap output tag for parsed version
		}else if(kid.getChildCount() !=0){
			recurseForOutput(kid);
			//is something else
		}else{
			continue;
		}
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:25,代码来源:XFormParser.java

示例2: recurseForOutput

import org.kxml2.kdom.Element; //导入方法依赖的package包/类
private void recurseForOutput(Element e) {
    if (e.getChildCount() == 0) return;

    for (int i = 0; i < e.getChildCount(); i++) {
        int kidType = e.getType(i);
        if (kidType == Node.TEXT) {
            continue;
        }
        if (e.getChild(i) instanceof String) {
            continue;
        }
        Element kid = (Element)e.getChild(i);

        //is just text
        if (kidType == Node.ELEMENT && XFormUtils.isOutput(kid)) {
            String s = "${" + parseOutput(kid) + "}";
            e.removeChild(i);
            e.addChild(i, Node.TEXT, s);

            //has kids? Recurse through them and swap output tag for parsed version
        } else if (kid.getChildCount() != 0) {
            recurseForOutput(kid);
            //is something else
        } else {
            continue;
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:29,代码来源:XFormParser.java

示例3: parseTranslation

import org.kxml2.kdom.Element; //导入方法依赖的package包/类
private void parseTranslation (Localizer l, Element trans) {
	/////for warning message
     List<String> usedAtts = new ArrayList<String>();
	usedAtts.add("lang");
	usedAtts.add("default");
	/////////////////////////

	String lang = trans.getAttributeValue("", "lang");
	if (lang == null || lang.length() == 0) {
		throw new XFormParseException("no language specified for <translation>",trans);
	}
	String isDefault = trans.getAttributeValue("", "default");

	if (!l.addAvailableLocale(lang)) {
		throw new XFormParseException("duplicate <translation> for language '" + lang + "'",trans);
	}

	if (isDefault != null) {
		if (l.getDefaultLocale() != null)
			throw new XFormParseException("more than one <translation> set as default",trans);
		l.setDefaultLocale(lang);
	}

	TableLocaleSource source = new TableLocaleSource();

	//source.startEditing();
	for (int j = 0; j < trans.getChildCount(); j++) {
		Element text = trans.getElement(j);
		if (text == null || !text.getName().equals("text")) {
			continue;
		}

		parseTextHandle(source, text);
		//Clayton Sims - Jun 17, 2009 - This code is used when the stinginess flag
		//is set for the build. It dynamically wipes out old model nodes once they're
		//used. This is sketchy if anything else plans on touching the nodes.
		//This code can be removed once we're pull-parsing
		//#if org.javarosa.xform.stingy
		trans.removeChild(j);
		--j;
		//#endif
	}

	//print unused attribute warning message for parent element
	if(XFormUtils.showUnusedAttributeWarning(trans, usedAtts)){
		reporter.warning(XFormParserReporter.TYPE_UNKNOWN_MARKUP, XFormUtils.unusedAttWarning(trans, usedAtts), getVagueLocation(trans));
	}

	//source.stopEditing();
	l.registerLocaleResource(lang, source);
}
 
开发者ID:medic,项目名称:javarosa,代码行数:52,代码来源:XFormParser.java

示例4: parseTranslation

import org.kxml2.kdom.Element; //导入方法依赖的package包/类
private void parseTranslation(Localizer l, Element trans) {
    /////for warning message
    Vector<String> usedAtts = new Vector<String>();
    usedAtts.addElement("lang");
    usedAtts.addElement("default");
    /////////////////////////

    String lang = trans.getAttributeValue("", "lang");
    if (lang == null || lang.length() == 0) {
        throw new XFormParseException("no language specified for <translation>", trans);
    }
    String isDefault = trans.getAttributeValue("", "default");

    if (!l.addAvailableLocale(lang)) {
        throw new XFormParseException("duplicate <translation> for language '" + lang + "'", trans);
    }

    if (isDefault != null) {
        if (l.getDefaultLocale() != null)
            throw new XFormParseException("more than one <translation> set as default", trans);
        l.setDefaultLocale(lang);
    }

    TableLocaleSource source = new TableLocaleSource();

    //source.startEditing();
    for (int j = 0; j < trans.getChildCount(); j++) {
        Element text = trans.getElement(j);
        if (text == null || !text.getName().equals("text")) {
            continue;
        }

        parseTextHandle(source, text);
        //Clayton Sims - Jun 17, 2009 - This code is used when the stinginess flag
        //is set for the build. It dynamically wipes out old model nodes once they're
        //used. This is sketchy if anything else plans on touching the nodes.
        //This code can be removed once we're pull-parsing
        //#if org.javarosa.xform.stingy
        trans.removeChild(j);
        --j;
        //#endif
    }

    //print unused attribute warning message for parent element
    if (XFormUtils.showUnusedAttributeWarning(trans, usedAtts)) {
        reporter.warning(XFormParserReporter.TYPE_UNKNOWN_MARKUP, XFormUtils.unusedAttWarning(trans, usedAtts), getVagueLocation(trans));
    }

    //source.stopEditing();
    l.registerLocaleResource(lang, source);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:52,代码来源:XFormParser.java

示例5: parseTranslation

import org.kxml2.kdom.Element; //导入方法依赖的package包/类
private void parseTranslation(Localizer l, Element trans) {
    /////for warning message
    Vector<String> usedAtts = new Vector<>();
    usedAtts.addElement("lang");
    usedAtts.addElement("default");
    /////////////////////////

    String lang = trans.getAttributeValue("", "lang");
    if (lang == null || lang.length() == 0) {
        throw new XFormParseException("no language specified for <translation>", trans);
    }
    String isDefault = trans.getAttributeValue("", "default");

    if (!l.addAvailableLocale(lang)) {
        throw new XFormParseException("duplicate <translation> for language '" + lang + "'", trans);
    }

    if (isDefault != null) {
        if (l.getDefaultLocale() != null)
            throw new XFormParseException("more than one <translation> set as default", trans);
        l.setDefaultLocale(lang);
    }

    TableLocaleSource source = new TableLocaleSource();

    //source.startEditing();
    for (int j = 0; j < trans.getChildCount(); j++) {
        Element text = trans.getElement(j);
        if (text == null || !text.getName().equals("text")) {
            continue;
        }

        parseTextHandle(source, text);
        //Clayton Sims - Jun 17, 2009 - This code is used when the stinginess flag
        //is set for the build. It dynamically wipes out old model nodes once they're
        //used. This is sketchy if anything else plans on touching the nodes.
        //This code can be removed once we're pull-parsing
        //#if org.javarosa.xform.stingy
        trans.removeChild(j);
        --j;
        //#endif
    }

    //print unused attribute warning message for parent element
    if (XFormUtils.showUnusedAttributeWarning(trans, usedAtts)) {
        reporter.warning(XFormParserReporter.TYPE_UNKNOWN_MARKUP, XFormUtils.unusedAttWarning(trans, usedAtts), getVagueLocation(trans));
    }

    //source.stopEditing();
    l.registerLocaleResource(lang, source);
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:52,代码来源:XFormParser.java


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