JDOM B6 or later http://www.jdom.org Sample code to detatch a fragment: //rng is a variable that "points" at the specific element and can access all recursive information Element fragment = documentRoot.getChild("ElementOne").getChild("ElementTwo"); ... // Return branch as fragment. The detach() method will return the entire tree recursively. return fragment.detach(); enjoy!!! Duane Nickull -- *************************************************** Yellow Dragon Software - http://www.yellowdragonsoft.com Web Services & ebXML Messaging / Registry Downloads Project Team Lead - UN/CEFACT eBusiness Architecture Phone: +1 (604) 738-1051 - Canada: Pacific Standard Time Direct: +1 (604) 726-3329 Chiusano Joseph wrote: >Forwarding from XML-DEV - the original question was: > ><Quote> >I have been asked what tools can extract a part of a schema. The >overall schema is large, complex, and imports five or six other schemas >into several target namespaces. The individual involved wants to create >a smaller subset that contains everything that one project needs, for >the purposes of instruction and training. ></Quote> > >Please see my response below, discussing what our Registry will be able >to do for him in the future. > >Joe > > > ------------------------------------------------------------------------ > > Subject: > Re: [xml-dev] Extract A Subset of a W3C XML Schema? > From: > Joseph Chiusano <Chiusano_Joseph@bah.com> > Date: > Thu, 31 Jul 2003 08:57:09 -0400 > To: > "Thomas B. Passin" <tpassin@comcast.net> > > >Tom, > >This won't help you in the immediate present (don't you like it when a >response starts like that?;) but: > >In the future, my vision is that the OASIS/ebXML Registry will allow one >to do exactly this. The Registry architecture does not yet (explicitly) >allow for the registration of "fine-grained" XML artifacts such as >elements/attributes/datatypes/namespace identifiers, but I am working to >ensure that in the future it will (and am confident that we will reach >this goal within the next year). > >So, referencing your example, my vision is that one would be able to >query the Registry for all elements/attributes/datatypes that belong to >targetNamespace XYZ, and select a subset of those elements to be >included in a new schema that is then assembled using that subset. > >Kind Regards, >Joe Chiusano >Booz | Allen | Hamilton >Member, OASIS/ebXML Registry TC > >"Thomas B. Passin" wrote: > > >>I have been asked what tools can extract a part of a schema. The overall >>schema is large, complex, and imports five or six other schemas into several >>target namespaces. The individual involved wants to create a smaller subset >>that contains everything that one project needs, for the purposes of >>instruction and training. >> >>The problem is how to get all the necessary pieces so that nothing is left >>out that is required for the schema to work. XML Spy can be helpful with >>its graphics, but there is no link from the graphics view to the text view, >>so it is hard to find the pictured piece of the XML for copying. You can >>do some degree of copying and pasting the graphics view blocks between >>schemas, but of course you have to keep track yourself of the bits you have >>already transferred. Also it is hard to be sure you have gotten everything >>you need. >> >>Does anyone know of such a tool? If not, any suggestions based on actual >>experience in doing this kind of task? It seems to me that finding all the >>dependencies within the schema and its imports would be the hardest part. >> >>Cheers, >> >>Tom P >> >>----------------------------------------------------------------- >>The xml-dev list is sponsored by XML.org <http://www.xml.org>, an >>initiative of OASIS <http://www.oasis-open.org> >> >>The list archives are at http://lists.xml.org/archives/xml-dev/ >> >>To subscribe or unsubscribe from this list use the subscription >>manager: <http://lists.xml.org/ob/adm.pl> >> >>You may leave a Technical Committee at any time by visiting http://www.oasis-open.org/apps/org/workgroup/regrep/members/leave_workgrou p.php >> -- *************************************************** Yellow Dragon Software - http://www.yellowdragonsoft.com Web Services & ebXML Messaging / Registry Downloads Project Team Lead - UN/CEFACT eBusiness Architecture Phone: +1 (604) 738-1051 - Canada: Pacific Standard Time Direct: +1 (604) 726-3329
<<attachment: winmail.dat>>