My xsd file contains:
<xs:sequence>
<xs:element name="Book">
<xs:complexType>
<xs:attribute name="author" type="xs:string" />
<xs:attribute name="title" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
With xmlbeans, I can set the attributes easily using:
Book book= books.addNewBook();
book.setTitle("The Lady and a Little Dog");
I know that I can use newCursor() to set the content of the element, but is this the best way?
object.newCursor().setTextValue(builer.toString());
I don’t quite understand your question.
I think your XSD will give you Java classes to produce XML like this:
Do you mean you want to set the “inner” text within an XML element, so you end up with XML like this?
If so, change your XSD to this, to use nested elements rather than attributes:
Then you’ll simply be able to do:
UPDATE
OK – I understand now.
Try this:
And then:
Which should give XML like this, which I think is what you want: