Kent, The XmlObject interface always represents the content, it does not represent the node itself as in DOM. There are three different types of XmlObject: 1) content of an element: i.e. attributes, inner elements and inner text, without the element name. 2) simple type content: i.e. text, can be the content of an attribute, or a text only element. The java objects representing this type of content will implement SimpleValue interface. 3) content of a document: i.e. only one root element. The corresponding java type will have the suffix 'Document' in the name.
For 3) XmlObject.toString() will return the entire document representation. But for 1) and 2), because they represent inner parts of a document, XmlObject.toString() will insert the representation of the content inside an <xml-fragment> element, so it can be parsed by any xml parser. There are options to change the name of the 'xml-fragment' name: XmlOptions.setSaveSyntheticDocumentElement(QName name) and XmlOptions.setSaveOuter(). I hope this helps you. Cezar > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 27, 2005 10:06 AM > To: [email protected] > Subject: Re: Creating complexType objects... > > Thanks for the replies - I'll try to address both in this message. > > 1) I was just using print(foo) as short-hand. The xmlText is still > <xml-fragment>...</xml-fragment> ( I was really doing > System.out.println("footext = " + foo) ) > > 2) In xmlbeans 2.0.0 there is no FooDocument.Foo.Factory chain of > objects; at least not for these schemas. (You can find the schema I'm > using at OASIS for DSML - > http://www.oasis-open.org/committees/dsml/docs/DSMLv2.xsd) > > Basically, a DsmlAttr is used in a number of different Request objects, > e.g. AddRequest. So we have AddRequestDocument, and AddRequest, as Java > types, but no DsmlAttrDocument. > > Further, there is no AddRequestDocument.AddRequest.Factory chain in 2.0.0. > > Is there an API changes document from 1.0 to 2.0 document somewhere? > > Thanks again - I really do appreciate the replies. > --Kent > > Caroline Wood wrote: > > I think what you need to do is: > > > > FooDocument fooDocument = FooDocument.Factory.newInstance(); > > FooDocument.Foo foo = FooDocument.Foo.Factory.newInstance(); > > > > foo.setName("blah blah"); > > fooDocument.setFoo(foo); > > print(fooDocument); > > > > Give at a go and let us know what happens! > > > > Best, > > Caroline. > > > > > > -----Original Message----- > > From: Don Stewart [mailto:[EMAIL PROTECTED] > > Sent: 27 July 2005 09:59 > > To: [email protected] > > Subject: RE: Creating complexType objects... > > > > Kent, > > > > In the first example replace print(foo); with print(foo.xmlText()); > > > > Regards > > > > Don > > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: 26 July 2005 19:48 > > To: [email protected] > > Subject: Creating complexType objects... > > > > I've looked over all the doc, and archives, and haven't found if there's > > an easier to do what I'd like in XmlBeans 2.0.0. > > > > It looks like to create an XmlObject that has a name other than > > "xml-fragment" in the first element, you need to go through an object > > type that contains that type. > > > > i.e. If I have Foo defined as a type with just a name attribute: > > > > Foo foo = Foo.Factory.newInstance(); > > foo.setName("name"); > > print(foo); > > > > gives: > > > > <xml-fragment name="name"/> > > > > If I want <foo name="name"/> as the xml - I need to find a type (let's > > call it Bar) that encloses the Foo type and do: > > > > Bar bar = Bar.Factory.newInstance(); > > Foo foo = bar.addNewFoo(); > > foo.setName("name"); > > foo.set(bar); > > > > now foo is: > > > > <foo name="name"/> > > > > Is this really what's required? > > > > If this made no sense; I can send a more concrete example. > > > > Thanks for the help, > > --Kent > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > This is an email from the CPP Group Plc, Holgate Park, York, YO26 4GA; > telephone 01904 544500. > > This message may contain information that is confidential. If you are > not the intended recipient, > > you may not peruse, use, disseminate, distribute or copy this message. > If you have received this > > message in error, please notify the sender immediately by email, > facsimile or telephone and either > > return or destroy the original message. > > The CPP Group Plc accepts no responsibility for any changes made to this > message after it has been > > sent by the original author. This email has been scanned for all > viruses by the MessageLabs Email Security System. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

