Return-Path: Delivered-To: apmail-xml-xmlbeans-dev-archive@www.apache.org Received: (qmail 77897 invoked from network); 14 Feb 2004 10:48:11 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 14 Feb 2004 10:48:11 -0000 Received: (qmail 50522 invoked by uid 500); 14 Feb 2004 10:47:45 -0000 Delivered-To: apmail-xml-xmlbeans-dev-archive@xml.apache.org Received: (qmail 50503 invoked by uid 500); 14 Feb 2004 10:47:44 -0000 Mailing-List: contact xmlbeans-dev-help@xml.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: xmlbeans-dev@xml.apache.org Delivered-To: mailing list xmlbeans-dev@xml.apache.org Received: (qmail 50487 invoked from network); 14 Feb 2004 10:47:44 -0000 content-class: urn:content-classes:message Subject: RE: get/set methods for element Date: Sat, 14 Feb 2004 02:47:58 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-ID: <4B2B4C417991364996F035E1EE39E2E11F3455@uskiex01.amer.bea.com> X-MS-Has-Attach: X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 X-MS-TNEF-Correlator: Thread-Topic: get/set methods for element Thread-Index: AcPxwlVWJRK+ZAyMSQuciSkZEm/jSQBJNvGw From: "Cezar Andrei" To: X-OriginalArrivalTime: 14 Feb 2004 10:47:58.0781 (UTC) FILETIME=[02AE2ED0:01C3F2E8] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Another possible solution is to have a helper class for doing all of = this, and we should not forget the attribute wildcards. A helper class = would give us more room to play with usability before we iron it in the = XmlObject API. Anybody interested in contributing this piece? Cezar > -----Original Message----- > From: Wolfgang Hoschek [mailto:whoschek@lbl.gov] > Sent: Thursday, February 12, 2004 5:45 PM > To: xmlbeans-dev@xml.apache.org > Subject: RE: get/set methods for element >=20 >=20 > Hi, just my 5 cents on the issue at hand. >=20 > Although xsd:any with maxOccurs can be manipulated with=20 > XMLCursor this=20 > seems an unnecessary complication to me. > IMHO, xmlbeans should ALSO spit out the highly convenient=20 > array accessor=20 > methods it usually spits out when using concrete elements instead of=20 > xsd:any, as follows: >=20 > getAnyArray() > getAnyArray(int) > insertAny(int, XMLObject) > removeAny(int) > setAnyArray(XMLObject[]) > setAnyArray(int, XMLObject) > sizeOfAnyArray() >=20 > This would mean that things like the example below (which i use in a=20 > great many actual schemas) can be manipulated "as expected"=20 > and with a=20 > minimal learning curve. >=20 > > > maxOccurs=3D"unbounded"> > > >=20 > Am I missing out on something here? >=20 > Wolfgang. >=20 > > If you want to insert an existing XmlObject, then you would first > > position a cursor at the desired destination position (as I showed > > before), then you would create another XmlCursor from the source > > XmlObject and then call moveXml or copyXml on the source=20 > cursor, passing > > as an argument, the target cursor. > >=20 > > If, however, you do not have a source XmlObject, but just want to > > construct some XML at a given position, say > > , you could position a cursor to > > where you want to insert the new XML and: > >=20 > > cursor.beginElement( "anything1" ); > > cursor.insertElement( "anything2" ); > >=20 > > Hope this helps, > > Eric > > =20 > >=20 > > -----Original Message----- > > From: Ganga Sah [mailto:ganga_sah@yahoo.com]=20 > > Sent: Monday, January 05, 2004 11:05 PM > > To: xmlbeans-dev@xml.apache.org > > Subject: RE: get/set methods for element > >=20 > > Hi Eric, > > Thanks for your reply. > > I want to start with XML instance > > "xyx", and insert an > > XmlObject(say, "" > > corresponding to xsd:any element) as the first child > > of FooType object to get say, > > "xyx". > > I am unable to do this using XmlCursor API, as > > XmlCursor.insertElement()/beginElement() methods does > > not take XmlObject as parameter but take only simple > > element(string)?? > > How can I insert XmlObject into an existing XML > > content tree? > > thanks, > > ganga > >=20 > > --- Eric Vasilik wrote: > >> Given an XmlObject (all user generated objects > >> derive from this), you > >> can call newCursor(). This will return an XmlCursor > >> which is positioned > >> at the element or attribute associated with the > >> XmlObject. > >>=20 > >> Thus, in your case, from FooType, you could: > >>=20 > >> FooType ft =3D ....; > >> XmlCursor c =3D ft.newCursor(); // Cursor is at > >> > >> c.toFirstChild(); // Cursor is at > >> > >> c.toNextSibling(); // Cursor it at > >> > >> etc ... > >>=20 > >> You can transition back to XmlObject from an > >> XmlCursor by calling > >> getObject() on the cursor. If this object has a > >> java type, you will be > >> able to cast it appropriately. =20 > >>=20 > >> Does this help? > >>=20 > >> - Eric > >>=20 > >> -----Original Message----- > >> From: Ganga Sah [mailto:ganga_sah@yahoo.com]=20 > >> Sent: Monday, January 05, 2004 12:01 PM > >> To: xmlbeans-dev@xml.apache.org > >> Subject: RE: get/set methods for element > >>=20 > >> Hi Eric, > >> My schema has following pattern: > >> > >> > >>=20 > >> > >> > >> >> namespace=3D"##other"/> =20 > >> > >> > >>=20 > >> > >> > >> =20 > >> > >> > >> > >> > >> =09 > >> > >> > >>=20 > >> Correspong xml-fragment is: > >>=20 > >> > >> > >> some-content > >> > >>=20 > >> I have got content of this XML instance in FooType > >> Java object. > >> How can I use xmlCursor to get(or set) the > >> un-named(xsd:any) element(first child of FooType > >> here)? > >> Could you help me by giving me a code snippet to do > >> this? > >>=20 > >> thanks a lot, > >> ganga > >>=20 > >>=20 > >>=20 > >>=20 > >> --- Eric Vasilik wrote: > >> > We do not generate methods for the any elements.=20 > >> > However, you can use XmlCursor to navigate this > >> > content in an un-typed manner. > >> >=20 > >> > -----Original Message----- > >> > From: Ganga Sah [mailto:ganga_sah@yahoo.com] > >> > Sent: Monday, January 05, 2004 9:47 AM > >> > To: xmlbeans-dev@xml.apache.org > >> > Subject: get/set methods for element > >> >=20 > >> >=20 > >> > I am unable to find/use get(set) methods in > >> xmlbeans > >> > generated Java code for element? > >> >=20 > >> > -ganga >=20 >=20 >=20 > -=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: xmlbeans-dev-unsubscribe@xml.apache.org > For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org > Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/ >=20 >=20 - --------------------------------------------------------------------- To unsubscribe, e-mail: xmlbeans-dev-unsubscribe@xml.apache.org For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/