org.w3c.dom.Element.getNodeValue()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中org.w3c.dom.Element.getNodeValue()方法的一些代码示例,展示了Element.getNodeValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getNodeValue()方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:getNodeValue

Element.getNodeValue介绍

暂无

代码示例

代码示例来源:origin: groovy/groovy-core

/**
 * Returns the list of any direct String nodes of this node.
 *
 * @return the list of String values from this node
 * @since 2.3.0
 */
public static List<String> localText(Element self) {
  List<String> result = new ArrayList<String>();
  if (self.getNodeType() == Node.TEXT_NODE || self.getNodeType() == Node.CDATA_SECTION_NODE) {
    result.add(self.getNodeValue());
  } else if (self.hasChildNodes()) {
    NodeList nodeList = self.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
      Node item = nodeList.item(i);
      if (item.getNodeType() == Node.TEXT_NODE || item.getNodeType() == Node.CDATA_SECTION_NODE) {
        result.add(item.getNodeValue());
      }
    }
  }
  return result;
}

代码示例来源:origin: rhuss/jolokia

/** {@inheritDoc} */
  public Object extract(Element element) { return element.getNodeValue(); }
}

代码示例来源:origin: haraldk/TwelveMonkeys

pOut.println(">");
else if (pNode.getNodeValue() != null) {
  pOut.print(pNode.getNodeValue());
  pOut.print("</");
  pOut.print(pNode.getTagName());

代码示例来源:origin: apache/pdfbox

annot.getNodeValue() + "]. Annotation ignored", e);

代码示例来源:origin: org.codehaus.izpack/izpack-api

@Override
public String toString()
{
  return element.getNodeName() + " " + element.getNodeValue();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc

public static String getElementText(Element element) throws DOMException{
 for (Node child = element.getFirstChild(); child != null;
  child = child.getNextSibling()) {
  if(child.getNodeType() == Node.TEXT_NODE)
 return child.getNodeValue();      
 }
 return element.getNodeValue();
}

代码示例来源:origin: sun-jaxb/jaxb-xjc

public static String getElementText(Element element) throws DOMException{
 for (Node child = element.getFirstChild(); child != null;
  child = child.getNextSibling()) {
  if(child.getNodeType() == Node.TEXT_NODE)
 return child.getNodeValue();      
 }
 return element.getNodeValue();
}

代码示例来源:origin: org.glassfish.metro/webservices-tools

public static String getElementText(Element element) throws DOMException{
 for (Node child = element.getFirstChild(); child != null;
  child = child.getNextSibling()) {
  if(child.getNodeType() == Node.TEXT_NODE)
 return child.getNodeValue();      
 }
 return element.getNodeValue();
}

代码示例来源:origin: org.andromda.thirdparty.jaxb2_commons/jaxb-xjc

public static String getElementText(Element element) throws DOMException{
 for (Node child = element.getFirstChild(); child != null;
  child = child.getNextSibling()) {
  if(child.getNodeType() == Node.TEXT_NODE)
 return child.getNodeValue();      
 }
 return element.getNodeValue();
}

代码示例来源:origin: stackoverflow.com

InputStream origin = new FileInputStream(url);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(origin);

//Obtain to tag element
Element toTag = originalDoc.getElementsByTagName("to").item(0);

//Obtain Tove value
String value = toTag.getNodeValue();

代码示例来源:origin: apache/servicemix-bundles

public static String getElementText(Element element) throws DOMException{
 for (Node child = element.getFirstChild(); child != null;
  child = child.getNextSibling()) {
  if(child.getNodeType() == Node.TEXT_NODE)
 return child.getNodeValue();      
 }
 return element.getNodeValue();
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.server.tomcat.core

protected static String getElementValue(Element element) {
  String s = element.getNodeValue();
  if (s != null)
    return s;
  NodeList nodelist = element.getChildNodes();
  for (int i = 0; i < nodelist.getLength(); i++)
    if (nodelist.item(i) instanceof Text)
      return ((Text) nodelist.item(i)).getData();

  return null;
}

代码示例来源:origin: org.opensingular/singular-commons

/**
 * @see org.w3c.dom.Node#getNodeValue()
 */
public String getNodeValue() throws DOMException {
  return getCurrentInternal().getNodeValue();
}

代码示例来源:origin: org.opensingular/singular-commons

/**
 * @see org.w3c.dom.Node#getNodeValue()
 */
@Override
public String getNodeValue() {
  return original.get().getNodeValue();
}

代码示例来源:origin: org.opensingular/form-core

/**
 * @see org.w3c.dom.Node#getNodeValue()
 */
@Override
public String getNodeValue() {
  return original.get().getNodeValue();
}

代码示例来源:origin: Geomatys/geotoolkit

@Override
public String getNodeValue() throws DOMException {
  final Element elem = getElement();
  return elem != null ? elem.getNodeValue() : null;
}

代码示例来源:origin: org.opensingular/form-core

/**
 * @see org.w3c.dom.Node#getNodeValue()
 */
public String getNodeValue() throws DOMException {
  return getAtualInterno().getNodeValue();
}

代码示例来源:origin: org.glassfish.external/schema2beans

public void readSchema(org.w3c.dom.Element node) {
  String myName = node.getLocalName();
  String myValue = node.getNodeValue();
  AnyNode el = new AnyNode(myName, myValue);
  // Should read in attributes too.
  //System.out.println("Just read AnyNode: myName="+myName+" myValue="+myValue);
  pushCurrent(el);
  read(node);
  popCurrent();
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

protected void visit(Operation operation)
{
  opInfo = getServiceInfo(portType).addOperation(operation.getName(), null);
  Element docElem = operation.getDocumentationElement();
  if (docElem != null)
  {
    String docText = docElem.getNodeValue();//	TextContent();
    opInfo.setDocumenation(docText);
  }
  wop2op.put(operation, opInfo);
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

protected void visit(Fault fault)
{
  FaultInfo faultInfo = opInfo.addFault(fault.getName());
  faultInfo.setMessageName(fault.getMessage().getQName());
  if(fault.getDocumentationElement()!= null ){
    faultInfo.setDocumentation(fault.getDocumentationElement().getNodeValue());//TextContent());    
  }
  
  wfault2msg.put(fault, faultInfo);
  
  createMessageParts(faultInfo, fault.getMessage());
}

相关文章

微信公众号

最新文章

更多