Hi, Can anyone please help me in this regard? Its very very critical for my current project.
Thanks in advance. Regards, Siddharth -----Original Message----- From: Siddharth Ranjan Patnaik [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 26, 2007 11:56 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [email protected] Subject: RE: Schema 2 Instance Generation Hi Guys, Still I have problem.Let me just clarify if I understood you guys correctly. Assume I have the following XML : <cust:city xmlns:cust="http://customer"> "<cust:name>anyType</cust:name> "<cust:population>anyType</cust:population> </cust:city> Now what I want is I wan't to provide my own prefix ( mycust in place of cust).So the result xml I am looking for is : <mycust:city xmlns:mycust="http://customer"> "<mycust:name>anyType</mycust:name> "<mycust:population>anyType</mycust:population> </mycust:city> I used the following code for the same.I could not get the expected output.i got the same xml without any change. private static void m1() { String xml = "<cust:city xmlns:cust=\"http://customer\">" + "<cust:name>anyType</cust:name>" + "<cust:population>anyType</cust:population>" + "</cust:city>"; try { XmlOptions opts = new XmlOptions(); opts.setUseDefaultNamespace(); opts.setSavePrettyPrint(); Map ns = new Hashtable(); ns.put("http://customer", "mycust"); opts.setSaveSuggestedPrefixes(ns); XmlObject xobj = XmlObject.Factory.parse(xml); System.out.println(xobj.xmlText(opts)); } catch (Exception e) { e.printStackTrace(); } } Regards, Siddhath -----Original Message----- From: Jacob Danner [mailto:[EMAIL PROTECTED] Sent: Monday, June 25, 2007 10:22 PM To: [email protected] Subject: Re: Schema 2 Instance Generation Hi Siddharth, It looks like you want the SampleXmlUtil.createSampleForTypes() method to allow you to specify a prefix. Unfortunately for you this is a not a feature of the class, however there are other options you can use to specify the prefix. String genDoc = SampleXmlUtil.createSampleForType(target) XmlOptions opts = new XmlOptions(); opts.setUseDefaultNamespace(); opts.setSavePrettyPrint(); Map ns = new Hashtable(); // YOUR NAMESPACE AND PREFIX ns.put("Namespace", "prefix"); opts.setSaveSuggestedPrefixes(ns); ... System.out.println(target); System.out.println("\n \n Result : " + genDoc.xmlText(opts)); Hope this helps, -Jacobd On 6/25/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hi Siddharth, > > I looked at your programm, but I couldn't find the problem. > Unfortunately I have no experience with XML schemas passed > as Strings and with the programmatic compilation af XSD. > Therefore, try to put your schema in a file first (.xsd) and write a minimum > code to make it work. When it works you can try to migrate step by > step to your solution and you'll find out where the problem comes from. > > Good luck, > > Alioum > > > > > > -----Ursprüngliche Nachricht----- > > Von: [email protected] > > Gesendet: 25.06.07 14:58:00 > > An: <[EMAIL PROTECTED]> > > CC: "Adisesha Rao R" <[EMAIL PROTECTED]> > > Betreff: RE: Schema 2 Instance Generation > > > > > > HI , > > Thanks a lot for u'r quick reply.Unfortunately the suggestion did not work > > for me.May be I am missing something.Can u provide some more information on > > this please ? > > I am attaching the test program that I used to test. > > > > > > Regards, > > Siddharth > > > > -----Original Message----- > > From: Boudigué Alioum [mailto:[EMAIL PROTECTED] > > Sent: Monday, June 25, 2007 4:05 PM > > To: [email protected] > > Subject: Re: Schema 2 Instance Generation > > > > > > > > Hi Siddhath, > > > > please try this: > > > > XmlOptions opts = new XmlOptions(); > > opts.setUseDefaultNamespace(); > > opts.setSavePrettyPrint(); > > > > Map ns = new Hashtable(); > > > > ns.put("urn:iso:std:iso:20022:tech:xsd:SCLSCTpacs.004.001.01", "sw4"); > > > > ns.put("urn:iso:std:iso:20022:tech:xsd:SCLSCTpacs.008.001.01", "sw8"); > > > > opts.setSaveSuggestedPrefixes(ns); > > > > //standard output > > System.out.println(doc.xmlText(opts)); > > > > // output to test.xml > > doc.save(new File("test.xml"),opts); > > > > > > I had the same problem and I solved it that way. > > hope it will help you > > best regards, > > > > Alioum > > > > > > > -----Ursprüngliche Nachricht----- > > > Von: [email protected] > > > Gesendet: 25.06.07 11:52:15 > > > An: <[email protected]> > > > CC: "Siddharth Ranjan Patnaik" <[EMAIL PROTECTED]> > > > Betreff: Schema 2 Instance Generation > > > > > > > > > > > > > HI > > > All, > > > > > > > > > I am > > > using Schema to Instance generation functionality of XMLBeans.While doing > > > so , > > > the prefix used in the instance is decided by the framework.(it picks the > > > first > > > 3 or 4 letters of the last token from the URL). > > > > > > > > > Example > > > : > > > > > > > > > > > > > > > > > > "<schema > > > xmlns=\"http://www.w3.org/2001/XMLSchema\" > > > targetNamespace=\"http://mycomp/city\">" + > > > > > > > > > > > > "<element name=\"city\">" + > > > > > > > > > > > > "<complexType>" + > > > > > > > > > "<all>" > > > + > > > > > > > > > > > > "<element name=\"name\"/>" + > > > > > > > > > > > > "<element name=\"population\"/>" + > > > > > > > > > "</all>" > > > + > > > > > > > > > > > > "</complexType>" + > > > > > > > > > > > > "</element>" + > > > > > > > > > "</schema> > > > > > > > > > > > > > > > > > > The > > > instance generated for this Schema is as below : > > > > > > > > > > > > > > > > > > <city:city xmlns:city="http://mycomp/city"> > > > > > > > > > <name>anyType</name> > > > > > > > > > <population>anyType</population> > > > > > > > > > </city:city> > > > > > > > > > > > > > > > > > > > > > > > > > > > My question > > > is "Is it possible to specify the prefix while generating the > > > instance from the schema" ? For example as a user I want mycity to be > > > used as the prefix iso city . > > > > > > > > > > > > > > > > > > > > > > > > > > > Regards, > > > > > > > > > Siddhath > > > > > > > > > > > > > > > > > > > > > > > > > > > *********************************************************************** > > > The information in this message is confidential and may be legally > > > privileged. It is intended solely for the addressee. Access to this > > > message by anyone else is unauthorized. If you are not the > > > intended recipient, any disclosure, copying, or distribution of the > > > message, or any action or omission taken by you in reliance on > > > it is prohibited and may be unlawful. Please immediately contact > > > > > > > > > the sender if you have received this message in error. This email > > > does not constitute any commitment from Cordys Holding BV or > > > any of its subsidiaries except when expressly agreed in a written > > > agreement between the intended recipient and > > > Cordys Holding BV or its subsidiaries. > > > *********************************************************************** > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _____________________________________________________________________ > > Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! > > http://smartsurfer.web.de/?mc=100071&distributionid=000000000066 > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > <hr> > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > __________________________________________________________________________ > Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach! > Mehr Infos unter http://produkte.web.de/club/?mc=021131 > > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

