PetrolHead007
PetrolHead007

Reputation: 105

Assign values to XML variable from Java

How to assign a value to the variable '&message' from a Java program? Is there a simple way to assign a value rather than using DOM parser?

<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>&message;</body>
</note>

Upvotes: 0

Views: 2001

Answers (1)

yairo
yairo

Reputation: 103

your question is missing a lot of info - we can't understand what are your intentions with the generated xml. Most of the times, it's easier to create an Object containing those fields and then using some 3rd party library to convert the object into xml. see here: https://www.mkyong.com/java/jaxb-hello-world-example/

Upvotes: 1

Related Questions