myjobiscoding
asked on
java - add an element to XML documnet
I know how to remove the element using xpath like below, but dont know how to add an new element. Please advise
For example, I use the following to remove the element using xpath
elem = getElements("./student:enr olment", std);
elem.detach();
Now I want to add the enrolled course to the element <./student:enrolment", std);
i want to add the following element
<std1:enrollendCourse>
<std1:course>Law</std1:cou rse>
</std1:enrollendCourse>
please advise
For example, I use the following to remove the element using xpath
elem = getElements("./student:enr
elem.detach();
Now I want to add the enrolled course to the element <./student:enrolment", std);
i want to add the following element
<std1:enrollendCourse>
<std1:course>Law</std1:cou
</std1:enrollendCourse>
please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.