Thank you very much Maarten, this works fine for me. Michael > Michael Wirz wrote: > >> Hello List, >> I am using xmlbeans to create an xml document, the bean is named >> RequestDocument >> as below: >> >> RequestDocument reqDoc = RequestDocument.Factory.newInstance(); >> RequestType request = reqDoc.addNewRequest(); >> >> I then fill all the members and do a >> >> String dataString = reqDoc.xmlText(); >> >> The document element shows up as >> >> <mpc:Request xmlns:mpc="http://www.xyz.de/test"> >> >> I'd like it to show up as >> >> <mpc:Request xmlns:mpc="http://www.xyz.de/test" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xsi:schemaLocation="http://www.xyz.de/test >> http://www.xyz.de/test2/mpcdta_1.0.xsd "> >> >> How do I do this with the XMLBeans API ? >> At the moment it is some ugly string/substring/indexof stuff... >> >> Thanks a lot for help! >> Michael Wirz >> from near Munich, Germany >> >> >> >> > This should go into the FAQ: > > protected void addSchemaLocation(XmlObject xmlObject, String location) { > XmlCursor cursor = xmlObject.newCursor(); > if (cursor.toFirstChild()) { > cursor.setAttributeText( > new > QName("http://www.w3.org/2001/XMLSchema-instance","schemaLocation"), > location); > } > } > > Maarten > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >
-- abs IT Service GmbH abs gruppe Michael Wirz Entwicklung Landsberger Straße 57 82266 Stegen am Ammersee Telefon: +49 (0)8143 999 43 Telefax: +49 (0)8143 999 49 [EMAIL PROTECTED] www.eFonds24.de --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

