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


Java Element.cloneNode方法代码示例

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


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

示例1: fixupAttrs

import org.w3c.dom.Element; //导入方法依赖的package包/类
private static Element fixupAttrs(Element root) { // #140905
    // #6529766/#6531160: some versions of JAXP reject attributes set using setAttribute
    // (rather than setAttributeNS) even though the schema calls for no-NS attrs!
    // JDK 5 is fine; JDK 6 broken; JDK 6u2+ fixed
    // #146081: xml:base attributes mess up validation too.
    Element copy = (Element) root.cloneNode(true);
    fixupAttrsSingle(copy);
    NodeList nl = copy.getElementsByTagName("*"); // NOI18N
    for (int i = 0; i < nl.getLength(); i++) {
        fixupAttrsSingle((Element) nl.item(i));
    }
    return copy;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:XMLUtil.java

示例2: extendXMLMap

import org.w3c.dom.Element; //导入方法依赖的package包/类
public Element extendXMLMap(Element elt) {
	
	if (elt != null) {
		NodeList childs = elt.getChildNodes();
		int len = childs.getLength();
		if (len > 0) {
			for (int i=0; i<len; i++) {
				Node children = childs.item(i);
				if (children.getNodeType() == Node.ELEMENT_NODE)
					extendXMLMap((Element)children);
			}
			
		}
		String sOccurs = elt.getAttribute("occurs");
		if ((sOccurs != null) && (!sOccurs.equalsIgnoreCase(""))) {
			String aOccurs[] = sOccurs.split(":");
			int j = Integer.parseInt(aOccurs[0],10);
			if (aOccurs.length>1)
				j = Integer.parseInt(aOccurs[1],10);
			int count = 1;
			elt.setAttribute("occurence",""+count);
			while (count++ < j) {
				Element clone = (Element)elt.cloneNode(true);
				clone.setAttribute("occurence",""+count);
				elt.getParentNode().appendChild(clone);
			}
		}
	}
	
	return elt;	
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:32,代码来源:Copybook.java

示例3: expandXMLMap

import org.w3c.dom.Element; //导入方法依赖的package包/类
private void expandXMLMap(Element elt) {
	if (elt != null) {
		NodeList children = elt.getChildNodes();
		Node next = elt.getNextSibling();
		int len = children.getLength();
		if (len > 0) {
			Node child = children.item(0);
			while (child != null) {
				if (child.getNodeType() == Node.ELEMENT_NODE)
					expandXMLMap((Element)child);
				child = child.getNextSibling();
			}
		}
		
		String sOccurs = elt.getAttribute("occurs");
		if ((sOccurs != null) && (!sOccurs.equalsIgnoreCase(""))) {
			String aOccurs[] = sOccurs.split(":");
			int count = 1;
			int j = Integer.parseInt(aOccurs[0],10);
			if (aOccurs.length>1)
				j = Integer.parseInt(aOccurs[1],10);
			
			while (count++ < j) {
				elt.setAttribute("occurs","");
				Element clone = (Element)elt.cloneNode(true);
				clone.setAttribute("occurence",""+count);
				expandXMLElement(elt,clone,count);
				if (next != null)
					elt.getParentNode().insertBefore(clone,next);
				else
					elt.getParentNode().appendChild(clone);
			}
			//elt.setAttribute("occurs",sOccurs);
		}
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:37,代码来源:CicsTransaction.java

示例4: getRegion

import org.w3c.dom.Element; //导入方法依赖的package包/类
private static Element[] getRegion(Element[][][] regions, float lat, float lon, Element parent, Document doc) {
	int x = (int) Math.floor((lon + 180) / LON_PARTITION_N); 
	int y = (int) Math.floor((lat + 90) / LAT_PARTITION_N);

	if (x >= regions.length) x = 0;
	if (y >= regions[0].length) y = regions[0].length - 1;
	if (x < 0) x = 0;
	if (y < 0) y = 0;

	if (regions[x][y][0] == null) { // create the region
		regions[x][y][0] = doc.createElement("Folder");
		regions[x][y][1] = doc.createElement("Folder");
		parent.appendChild(regions[x][y][0]);
		parent.appendChild(regions[x][y][1]);

		Element region = doc.createElement("Region");
		Element latLonBox = doc.createElement("LatLonAltBox");
		region.appendChild(latLonBox);

		int boundX = -180 + LON_PARTITION_N * x;
		int boundY = -90 + LAT_PARTITION_N * y;

		Element leaf = doc.createElement("north");
		leaf.appendChild(doc.createTextNode((boundY + LAT_PARTITION_N) + ""));
		latLonBox.appendChild(leaf);
		leaf = doc.createElement("south");
		leaf.appendChild(doc.createTextNode(boundY + ""));
		latLonBox.appendChild(leaf);
		leaf = doc.createElement("east");
		leaf.appendChild(doc.createTextNode((boundX + LON_PARTITION_N) + ""));
		latLonBox.appendChild(leaf);
		leaf = doc.createElement("west");
		leaf.appendChild(doc.createTextNode(boundX + ""));
		latLonBox.appendChild(leaf);

		Element visibleRegion = (Element) region.cloneNode(true);
		regions[x][y][0].appendChild(region);
		regions[x][y][1].appendChild(visibleRegion);

		Element lod = doc.createElement("Lod");
		region.appendChild(lod);
		leaf = doc.createElement("maxLodPixels");
		leaf.appendChild(doc.createTextNode(LABEL_MIN_PIXELS));
		lod.appendChild(leaf);

		lod = doc.createElement("Lod");
		visibleRegion.appendChild(lod);
		leaf = doc.createElement("minLodPixels");
		leaf.appendChild(doc.createTextNode(LABEL_MIN_PIXELS));
		lod.appendChild(leaf);
	}
	return regions[x][y];
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:54,代码来源:KMLExport.java

示例5: getObjectProviderConfiguration

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Gets a clone of the configuration element for a qualified element. Note that this configuration reflects the
 * state of things as they were when the configuration was loaded, applications may have programmatically removed
 * builder, marshallers, and unmarshallers during runtime.
 * 
 * @param qualifedName the namespace qualifed element name of the schema type of the object provider
 * 
 * @return the object provider configuration element or null if no object provider is configured with that name
 * 
 * @deprecated this method is deprecated with no replacement
 */
public static Element getObjectProviderConfiguration(QName qualifedName) {
    Element configElement = configuredObjectProviders.get(qualifedName);
    if (configElement != null) {
        return (Element) configElement.cloneNode(true);
    }
    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:Configuration.java

示例6: getValidatorSuiteConfiguration

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Gets a clone of the ValidatorSuite configuration element for the ID. Note that this configuration reflects the
 * state of things as they were when the configuration was loaded, applications may have programmatically removed
 * altered the suite during runtime.
 * 
 * @param suiteId the ID of the ValidatorSuite whose configuration is to be retrieved
 * 
 * @return the validator suite configuration element or null if no suite is configured with that ID
 * 
 * @deprecated this method is deprecated with no replacement
 */
public static Element getValidatorSuiteConfiguration(String suiteId) {
    Element configElement = validatorSuiteConfigurations.get(suiteId);
    if (configElement != null) {
        return (Element) configElement.cloneNode(true);
    }

    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:Configuration.java


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