あなたの質問がよくわかりません。
あなたの XSD は、次のような XML を生成するための Java クラスを提供すると思います。
<book author="Fred" title="The Lady and a Little Dog" />
XML要素内に「内側」のテキストを設定したいということですか?
<book>
<author>Fred</author>
<title>The Lady and a Little Dog</title>
</book>
その場合は、XSD を次のように変更して、属性ではなくネストされた要素を使用します。
<xs:sequence>
<xs:element name="Book">
<xs:complexType>
<xs:sequence>
<xs:element name="author" type="xs:string" />
<xs:element name="title" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
次に、次のことが簡単にできるようになります。
Book book= books.addNewBook();
book.setAuthor("Fred");
book.setTitle("The Lady and a Little Dog");
アップデート
はい、分かりました。
これを試して:
<xs:element name="Book" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="author" type="xs:string" />
<xs:attribute name="title" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
その後:
Book book1 = books.addNewBook();
book1.setAuthor("Fred");
book1.setTitle("The Lady and a Little Dog");
book1.setStringValue("This is some text");
Book book2 = books.addNewBook();
book2.setAuthor("Jack");
book2.setTitle("The Man and a Little Cat");
book2.setStringValue("This is some more text");
これは、次のような XML を提供する必要があります。これは、あなたが望むものだと思います。
<Book author="Fred" title="The Lady and a Little Dog">This is some text</Book>
<Book author="Jack" title="The Man and a Little Cat">This is some more text</Book>