Re: Java - XML question????
Adrian Smaranda <[email protected]>
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
I don't know what operating system you are running there. If you have some kind of unix, the command should be something like this: "chmod 666 yourfile.xml"(for setting write permissions to everybody in your system). If you are running win 2000, right click your file (in my computer, for example), choose Properties and go to Security tab. If you see in the name box a user called IUSR_something, click it, an ckeck "full access" from the box below. If you don't see this user, click add, add it, and than modify its permissions. And if you are running something else, check your documentation. Adi. -----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[email protected]]On Behalf Of Ram Sent: Wednesday, April 30, 2003 6:29 AM To: [email protected] Subject: Re: Java - XML question???? Thank you Adi, But how to check the file permission to write into the xml, Also tell me how to set it... Regards, Ram... ----- Original Message ----- From: Adrian Smaranda To: [email protected] Sent: Tuesday, April 29, 2003 6:28 PM Subject: Re: Java - XML question???? Hi Ram, Check your file permissions. You should have permissions to write into the xml file. Adi. -----Original Message----- From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[email protected]]On Behalf Of Ram Sent: Tuesday, April 29, 2003 3:33 PM To: [email protected] Subject: Java - XML question???? Hi, When I was trying to write into the XML file from my Java program. Everything was fine programatically, my program was not giving any errors and was shoeing the proper results when I run the program but, the same is not effective in the xml file saved in the same directory. Can anybody tell me how to save the same after adding the nodes. Following is my codec: ------ public boolean addElem(String code, String filename) { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(convertToFileURL(filename)); Node rootNode = doc.getDocumentElement(); NodeList list = doc.getElementsByTagName("G010101"); // Loop through the list. for (int i=0; i < list.getLength(); i++) { Node thisNode = list.item(i); Node newNode = doc.createElementNS(convertToFileURL(filename),"G555007"); Node newCodeNode = doc.createElementNS(convertToFileURL(filename),"code"); Text tnNode = doc.createTextNode("Kona"); newCodeNode.appendChild(tnNode); Node newMsgNode = doc.createElementNS(convertToFileURL(filename),"message"); Text tpNode = doc.createTextNode("Newly Inserted Node......"); newMsgNode.appendChild(tpNode); newNode.appendChild(newCodeNode); newNode.appendChild(newMsgNode); rootNode.insertBefore(newNode, thisNode); rootNode.normalize(); rootNode.appendChild(newNode); break; } Thanks and Regards, Ram.... ___________________________________________________________________________ To unsubscribe, send email to [email protected] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html