s ithu

Greenhorn
+ Follow
since Apr 10, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by s ithu

HI guys ,
I am building a dom handler for handling xml file ,in core java .
I did the following methods
  • createxml :Create xml file from a database and save in local machine
  • parser method : give parser out put of xml file
  • Display:display xml file in a Jsp page as well as in IDE output terminal
  • Deletenode: delete node whose name is passed
  • insertnode: append a child node at the end of file
  • searchnode : search node whose name is passed and display its count

  • I have doubt in delete and insert methods.should i delete all nodes in the file or only first node?
    should i put provision to insert more child node?
    I do nt knw the requirements of the project.
    But I intend to build a standard Dom Handler so that it can be used in future also.
    Thank you for your help
    I changed code like this so it is working now.

    Thank you very much for your help.
    The correct code is
    hi guys,

    i am trying to insert a node into a dom using a java method.

    But i get this error
    hierarchy request_err : An attempt was made to insert a node where it is not permitted

    so i changed permission using chmod command but still it is not working ......



    Hi guys,
    I am trying to delete a specified node in xml file using dom parser.It work perfectly alright in IDE output terminal but xml file is not updating.How to solve this problem?

    Thank you guys.....


    I replaced javax.swing.text.Document with DOM

    Now I can use doc to traverse the file right?

    Santhosh ayiappan wrote:Execute the code and share the output/errors if any....







    When I run this code I got this error.

    run: Exception in thread "main" java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl cannot be cast to javax.swing.text.Document at common.parseXmlFile.parseXmlFile(parseXmlFile.java:28) at common.parseXmlFile.main(parseXmlFile.java:59) Java Result: 1

    Santhosh ayiappan wrote:Below is the method that would return the String by taking the Document object as input.



    Regards
    Santhosh




    Thank you again
    In oder to run above method we need variable doc isn't it?
    But i am getting null value in variable doc .


    Santhosh ayiappan wrote:You cant directly print the Document object. You have to use StringWriter to convert it to String.

    Regards
    Santhosh




    Thanks Santhosh for your answer.
    But still why variable doc getting a null value?
    How can I correct it?
    What is wrong with this code? java-xml-dom..






    getting output as
    [#document: null]


    Additional Details
    I am new in xml .Actually i am trying to build DOM Object of a file whose path is given .So that it can be used in display ,edit, traverse functions...
    Problem is that variable doc is getting a null value.Why is it so?