Link to home
Start Free TrialLog in
Avatar of myjobiscoding
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:enrolment", 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:course>
</std1:enrollendCourse>



please advise
ASKER CERTIFIED SOLUTION
Avatar of Manikandan Thiagarajan
Manikandan Thiagarajan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial