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


Java Node.getNodeValue方法代碼示例

本文整理匯總了Java中org.w3c.dom.Node.getNodeValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.getNodeValue方法的具體用法?Java Node.getNodeValue怎麽用?Java Node.getNodeValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.w3c.dom.Node的用法示例。


在下文中一共展示了Node.getNodeValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseInsertColumn

import org.w3c.dom.Node; //導入方法依賴的package包/類
void parseInsertColumn(HashMap<Column, AbstractExpression> columns, Node columnNode, Database db, Table table) {
    NamedNodeMap attrs = columnNode.getAttributes();
    Node tableNameAttr = attrs.getNamedItem("table");
    Node columnNameAttr = attrs.getNamedItem("name");
    String tableName = tableNameAttr.getNodeValue();
    String columnName = columnNameAttr.getNodeValue();

    assert(tableName.equalsIgnoreCase(table.getTypeName()));
    Column column = table.getColumns().getIgnoreCase(columnName);

    AbstractExpression expr = null;
    NodeList children = columnNode.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        Node node = children.item(i);
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            expr = parseExpressionTree(node, db);
            ExpressionUtil.assignLiteralConstantTypesRecursively(expr,
                    VoltType.get((byte)column.getType()));
            ExpressionUtil.assignOutputValueTypesRecursively(expr);
        }
    }

    columns.put(column, expr);
}
 
開發者ID:s-store,項目名稱:s-store,代碼行數:25,代碼來源:ParsedInsertStmt.java

示例2: parseTransformation

import org.w3c.dom.Node; //導入方法依賴的package包/類
private static void parseTransformation(SvgTree avg, Node nNode) {
    NamedNodeMap a = nNode.getAttributes();
    int len = a.getLength();

    for (int i = 0; i < len; i++) {
        Node n = a.item(i);
        String name = n.getNodeName();
        String value = n.getNodeValue();
        if (SVG_TRANSFORM.equals(name)) {
            if (value.startsWith("matrix(")) {
                value = value.substring("matrix(".length(), value.length() - 1);
                String[] sp = value.split(" ");
                for (int j = 0; j < sp.length; j++) {
                    avg.matrix[j] = Float.parseFloat(sp[j]);
                }
            }
        } else if (name.equals("y")) {
            Float.parseFloat(value);
        } else if (name.equals("x")) {
            Float.parseFloat(value);
        }

    }
}
 
開發者ID:RaysonYeungHK,項目名稱:Svg2AndroidXml,代碼行數:25,代碼來源:Svg2Vector.java

示例3: getAttribute

import org.w3c.dom.Node; //導入方法依賴的package包/類
private String getAttribute(Node node, String attributeName)
		throws Exception {
	try {
		NamedNodeMap attributes = node.getAttributes();
		for (int i = 0; i < attributes.getLength(); i++) {
			Node attributeNode = attributes.item(i);
			if (attributeNode.getNodeName().equals(attributeName)) {
				return attributeNode.getNodeValue();
			}
		}
		return null;
	} catch (Exception e) {
		log.error(e);
		log.error(e.getStackTrace());
		throw (e);
	}
}
 
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:18,代碼來源:CoTAdapterInbound.java

示例4: mergeStandardTextNode

import org.w3c.dom.Node; //導入方法依賴的package包/類
private void mergeStandardTextNode(Node node)
    throws IIOInvalidTreeException {
    // Convert to comments.  For the moment ignore the encoding issue.
    // Ignore keywords, language, and encoding (for the moment).
    // If compression tag is present, use only entries with "none".
    NodeList children = node.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        Node child = children.item(i);
        NamedNodeMap attrs = child.getAttributes();
        Node comp = attrs.getNamedItem("compression");
        boolean copyIt = true;
        if (comp != null) {
            String compString = comp.getNodeValue();
            if (!compString.equals("none")) {
                copyIt = false;
            }
        }
        if (copyIt) {
            String value = attrs.getNamedItem("value").getNodeValue();
            COMMarkerSegment com = new COMMarkerSegment(value);
            insertCOMMarkerSegment(com);
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:25,代碼來源:JPEGMetadata.java

示例5: getContent

import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
 * Get the trimmed text content of a node or null if there is no text
 */
public static String getContent(Node n) {
	if (n == null)
		return null;
	Node n1 = DomUtil.getChild(n, Node.TEXT_NODE);

	if (n1 == null)
		return null;

	String s1 = n1.getNodeValue();
	return s1.trim();
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:15,代碼來源:DomUtil.java

示例6: addToScope

import org.w3c.dom.Node; //導入方法依賴的package包/類
@Override
protected void addToScope(Scriptable scope, NodeList nodeList) {
	if (nodeList != null) {
		String nodeValue = null;
		if (nodeList.getLength() > 0) {
			Node node = nodeList.item(0);
			nodeValue = node.getNodeValue();
			if (node instanceof Element)
				nodeValue = ((Element) node).getTextContent();
		}
		scope.put(getVariableName(), scope, nodeValue);
	}
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:14,代碼來源:GetTextStatement.java

示例7: getTextContent

import org.w3c.dom.Node; //導入方法依賴的package包/類
protected static String getTextContent(Node node) {
    Node child = node.getFirstChild();
    if( null == child )
        return null;
    
    return child.getNodeValue();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:RSSFeed.java

示例8: parseMap

import org.w3c.dom.Node; //導入方法依賴的package包/類
private static Request parseMap(Node root) {
	Request request = new Request();

	Node name = root.getAttributes().getNamedItem("name");
	request.name = name != null ? name.getNodeValue() : null;

	Node url = root.getAttributes().getNamedItem("url");
	request.url = url != null ? url.getNodeValue() : null;

	Node srs = root.getAttributes().getNamedItem("srs");
	request.srs = srs != null ? srs.getNodeValue() : null;

	Node wesn = root.getAttributes().getNamedItem("wesn");
	if (wesn != null) {
		String[] s = wesn.getNodeValue().split(",");

		request.wesn = new double[4];
		for (int i = 0; i < 4; i++)
			request.wesn[i] = Double.parseDouble(s[i]);
	}

	List<Node> layers = getElements(root, "wms_layer");
	Iterator<Node> iter = layers.iterator();
	request.layers = new RequestLayer[layers.size()];
	for (int i = 0; i < layers.size(); i++)
		request.layers[i] = parseLayer(iter.next());

	return request;
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:30,代碼來源:XML_Layer.java

示例9: _ProcessNode

import org.w3c.dom.Node; //導入方法依賴的package包/類
private static void _ProcessNode(Node n, int level) throws Exception {
    n.getAttributes();
    n.getChildNodes();

    // At this point, for JVM 1.6 and Xerces <= 1.3.1,
    // Test-XML.xml::mytest:Y's attribute is (already) bad.

    switch (n.getNodeType()) {

        case Node.TEXT_NODE:
            String str = n.getNodeValue().trim();

            /* ...Only print non-empty strings... */
            if (str.length() > 0) {
                String valStr = n.getNodeValue();

                _Println(valStr, level);
            }
            break;

        case Node.COMMENT_NODE:
            break;

        default: {
            String nodeNameStr = n.getNodeName();

            _Println(nodeNameStr + " (" + n.getClass() + "):", level);

            /* ...Print children... */
            _ProcessChildren(n, level);

            /* ...Print optional node attributes... */
            _PrintAttributes(n, level);
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:37,代碼來源:Bug6760982.java

示例10: getBean

import org.w3c.dom.Node; //導入方法依賴的package包/類
public static Object getBean(String path, int i) {
    try {
        //創建文檔對象
        DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = dFactory.newDocumentBuilder();
        Document doc;
        doc = builder.parse(new File(ToolDirFile.getClassesPath(XMLUtil.class) + path));

        //獲取包含類名的文本節點
        NodeList nl = doc.getElementsByTagName("className");
        Node classNode;
        if (0 == i) {
            classNode = nl.item(0).getFirstChild();
        }
        else {
            classNode = nl.item(1).getFirstChild();
        }

        String cName = classNode.getNodeValue();

        //通過類名生成實例對象並將其返回
        Class c = Class.forName(cName);
        Object obj = c.newInstance();
        return obj;
    }
    catch(Exception e){
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:nellochen,項目名稱:springboot-start,代碼行數:31,代碼來源:XMLUtil.java

示例11: VersionInfo

import org.w3c.dom.Node; //導入方法依賴的package包/類
public VersionInfo(Element element) {
	logger.debug("Constructor - entry");

	NodeList nodeList = element.getChildNodes();
	for (int n = 0; n < nodeList.getLength(); n++) {
		Node node = nodeList.item(n);
		if (node.getNodeType() == Node.ELEMENT_NODE) {
			Element childElement = (Element) node;

			if ("VERSION".equals(childElement.getNodeName())) {
				String name = childElement.getAttribute("NAME");
				String revision = childElement.getAttribute("REVISION");
				if ("Compatible index structure version".equals(name)) {
					setIndexStructure(revision);
				} else if ("SES API version".equals(name)) {
					setApi(revision);
				} else if ("SES build".equals(name)) {
					setBuild(revision);
				} else {
					logger.trace("Unexpected version information: " + name + " (" + revision + ")");
				}
			} else {
				logger.trace("Unrecognized child node: '" + childElement.getNodeName() + "'");
			}
		} else if ((node.getNodeType() == Node.TEXT_NODE) && (node.getNodeValue() != null) && (node.getNodeValue().trim().length() > 0)) {
			logger.trace("Unexpected text node (" + this.getClass().getName() + "): '" + node.getNodeValue() + "'");
		}
	}
	NamedNodeMap namedNodeMap = element.getAttributes();
	if (namedNodeMap != null) {
		for (int a = 0; a < namedNodeMap.getLength(); a++) {
			Attr attributeNode = (Attr) namedNodeMap.item(a);
			logger.trace("Unrecognized attribute: '" + attributeNode.getName() + "'");
		}
	}

	logger.debug("Constructor - exit");
}
 
開發者ID:Smartlogic-Semaphore-Limited,項目名稱:Java-APIs,代碼行數:39,代碼來源:VersionInfo.java

示例12: getAttribute

import org.w3c.dom.Node; //導入方法依賴的package包/類
protected static String getAttribute(Node node, String name,
                                     String defaultValue, boolean required)
  throws IIOInvalidTreeException {
    Node attr = node.getAttributes().getNamedItem(name);
    if (attr == null) {
        if (!required) {
            return defaultValue;
        } else {
            fatal(node, "Required attribute " + name + " not present!");
        }
    }
    return attr.getNodeValue();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:14,代碼來源:GIFMetadata.java

示例13: process

import org.w3c.dom.Node; //導入方法依賴的package包/類
@Override
public void process(HyperlinkEnv env) {
    String className = env.getValueString();
    Node n = env.getDocumentContext().getDocRoot().getNode().getAttributes().
            getNamedItem(HibernateMappingXmlConstants.PACKAGE_ATTRIB);//NOI18N
    String pack = n == null ? null : n.getNodeValue();
    if(pack!=null &&  pack.length()>0){
        if(!className.contains(".")){
            className = pack + "." +className;
        }
    }
    HibernateEditorUtil.findAndOpenJavaClass(className, env.getDocument());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:JavaClassHyperlinkProcessor.java

示例14: getContent

import org.w3c.dom.Node; //導入方法依賴的package包/類
/** Get the trimed text content of a node or null if there is no text
 */
public static String getContent(Node n ) {
    if( n==null ) return null;
    Node n1=DomUtil.getChild(n, Node.TEXT_NODE);

    if( n1==null ) return null;

    String s1=n1.getNodeValue();
    return s1.trim();
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:DomUtil.java

示例15: parseSignsNode

import org.w3c.dom.Node; //導入方法依賴的package包/類
/** Analiza el nodo con el listado de firmas.
 * @param signsNode Nodo con el listado de firmas.
 * @return Listado con la informaci&oacute;n de cada operaci&oacute;n de firma. */
private static List<TriSign> parseSignsNode(final Node signsNode) {

	final NodeList childNodes = signsNode.getChildNodes();

	final List<TriSign> signs = new ArrayList<TriSign>();
	int idx = nextNodeElementIndex(childNodes, 0);
	while (idx != -1) {
		final Node currentNode = childNodes.item(idx);

		String id = null;

		final NamedNodeMap nnm = currentNode.getAttributes();
		if (nnm != null) {
			final Node tmpNode = nnm.getNamedItem("Id"); //$NON-NLS-1$
			if (tmpNode != null) {
				id = tmpNode.getNodeValue();
			}
		}
		signs.add(
			new TriSign(
				parseParamsListNode(currentNode),
				id
			)
		);
		idx = nextNodeElementIndex(childNodes, idx + 1);
	}

	return signs;
}
 
開發者ID:MiFirma,項目名稱:mi-firma-android,代碼行數:33,代碼來源:TriphaseData.java


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