cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sukkary" <Sukk...@imkenberg.net>
Subject Document Object Handling
Date Thu, 19 Oct 2000 01:46:10 GMT

 Hi all,
 My main task is to traverse a Document object's DOM tree and print its TEXT
node values
 in xml file using xsp processor
 I tried to create and traverse a Document object as follows :

 <xsp:logic>

 public Document getDoc(){

  Document doc = xspParser.createEmptyDocument();
    doc.createElement("Article");
    doc.appendChild(doc.createElement("Article_No"));
    doc.createTextNode("Hello From Amin");


    return doc;
}

public String PrintArt(Document doc){
   NodeList Art = doc.getElementsByTagName("Article");
   Node node = Art.item(0);
   NodeList Art_text = node.getChildNodes();
   node = Art_text.item(0);

return node.getNodeValue();
}

</xsp:logic>

 !!!!!!........ but when i tried to present the text node's
contents..................!!!!!!
 ??????........ i surprised that cocoon raise a null pointer
exception...............???????
 which means that my created document object is empty, why?
 can any one tell me how can i create a document object that contain this
document fragment and
 present its text node contents in xml ?

Thanks,
M. Amin


Mime
View raw message