IBM®
跳转到主要内容
    中国 [选择]    使用条款
 
 
Select a scope: Search for:    
    首页    产品    服务与解决方案     支持与下载    个性化服务    
跳转到主要内容

developerWorks 中国  >  XML  >

Building an XML-based message server

An illustrative example of an XML-based message server

developerWorks

Return to article

public String getStatus() {
   NodeList nl = doc.getElementsByTagName("status");
   Node n = nl.item(0).getFirstChild();
   if (n == null) {
      return "";
   } else {
      return n.getNodeValue();
   }
}
public void setStatus(String s) {
   setHeaderElement("status", s);
}
public void setHeaderElement(String elementName, String elementValue) {
   Node elementHeader = getXMLElement("header");
   Element oldElement = getXMLChildElement("header", elementName);
   elementHeader.removeChild(oldElement);
   Element newElement = doc.createElement(elementName);
   elementHeader.appendChild(newElement);
   newElement.appendChild(doc.createTextNode(elementValue));
}

Return to article

    关于 IBM 隐私条约 联系 IBM 使用条款