Hi , Thank u very much . It works now.U know why I did this mistake ? The LSInputSource (JDK5.0) takes the schema as a String in the constructor.I had worked with LSInputSource earlier so when I started assuming that here also the same case.This depicts the importance of standardized APIs across the products :-)
Thanks once more... Regards, Siddharth -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of VP Sent: Wednesday, March 21, 2007 6:56 AM To: [email protected] Subject: Re: Help required wrt EntityResolver Hi Siddarth, The problem is within your EntityResolver. When a String instance gets passed to InputSource, the InputSource treats it as a systemId. So, the right solution is to wrapped the string in StringReader(): new InputSource(new StringReader(schema)); I hope this helps. --m On 3/17/07, Siddharth Ranjan Patnaik < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Hi Jacob, Thanks for the quick reply. Please see my comments inline. Regards, Siddharth -----Original Message----- From: Jacob Danner [mailto:[EMAIL PROTECTED] Sent: Saturday, March 17, 2007 1:42 PM To: [email protected] Subject: Re: Help required wrt EntityResolver Hi Siddharth, A couple of things. First, this functionality (generating an instance from a schema) is already available in XMLBeans. If you look int he bin directory there is even a cmd/sh script for it where you pass in the name of the type you want to generate an instance for, etc. That might save you some time. [Siddharth] I had a look into this tool.I cannot use this as my schemas may contain imported schemas which means I need to use a custom resolver. Second, I think the reason you are getting this error is because you are compiling a string vs a file. I think (I do not know for certain) that xmlbeans uses the value of org.apache.xmlbeans.XmlDocumentProperties.getSourceName() to resolve the URI. When you build from a Schema from a string this value is null. [Siddharth] To my understanding custom resolvers are invoked so that they can download the imprted schema.This is a very important requirement as in our product (Cordys) we support Custom URIs.in our case the imported schemas are stored in DB.So the custom resolver reads the improted schemas for DB and returns back. The same approach I have used in the java 1.5 schema validator.My custom resolver resolves the imprted schema and it works perfect. In this case, the error you are receiving appears to be correct. I like to think of URI resolution as if it were a URL or file path. As in, How would I refer to this file if I were accessing it via the web. In the code you attached how do you give a URI to this other java string? ie, how would you navigate to it via your filesystem or the web. [Siddharth] As explained below, File is not a solution for me as the imported schemas are stored in DB in our case. I'm curious why you don't just add the String product schema to the schemaArray that you use to compile, or reference both schemas from the file system . [Siddharth] How can I do this ? u mean I should parse the schema to get all the imported schemas (recursively) upfront and prepare the array and use it for compiling ? but that's the whole idea of having a Custom resolver right ? Hope this helps, -Jacobd On 3/17/07, Siddharth Ranjan Patnaik <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > My aim is to get an instance XML from a schema. > > When the schema contains an import it gives following problem.(Though I have > a EntityResolver) > > > > org.apache.xmlbeans.XmlException: error: URL "prod.xsd" is > not well-formed > > at > org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaT ypeSystemCompiler.java :225) > > at > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown > Source) > > at java.lang.reflect.Method.invoke(Unknown Source) > > at > org.apache.xmlbeans.XmlBeans.compileXmlBeans (XmlBeans.java:667) > > at > org.apache.xmlbeans.XmlBeans.compileXsd(XmlBeans.java:553) > > at > com.Schema2Instance.printSchema2Instance(Schema2Instance.java:75) > > at com.Schema2Instance.main(Schema2Instance.java:30) > > > > > > What I feel is , though my entity resolver is able to resolve the imported > schema and correctly returns , still it tries to make a URL object for the > schema location and subsiquently it fails. > > > > I am attahing the test program which u can simply run and the error will get > printed to console. > > > > Please help me.Its yrgent for me. > > > > Regards, > > Siddharth > > *********************************************************************** > > 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. > > *********************************************************************** > > > > > > > --------------------------------------------------------------------- > 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]

