Here you can find the source of getNamedItemText(NamedNodeMap map, String name)
Parameter | Description |
---|---|
map | the node map to get the named item from; |
name | the name of the item to get. |
null
in case the named item does not exist, or has no text.
private static String getNamedItemText(NamedNodeMap map, String name)
//package com.java2s; /*//from w ww . ja v a2 s . c o m * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { /** * Gets the actual text from a named item contained in the given node map. * * @param map * the node map to get the named item from; * @param name * the name of the item to get. * @return the text of the named item, can be <code>null</code> in case the named item does not exist, or has no * text. */ private static String getNamedItemText(NamedNodeMap map, String name) { Node namedItem = map.getNamedItem(name); if (namedItem == null) { return null; } else { return namedItem.getTextContent(); } } }