RE: SchemaType.getSourceName()
Denis, SchemaType.getSourceName() returns a name of a resource that represents the original xsd file from which the type came from. You can get to the resource by using a SchemaTypeLoader that has access to it. See the following example on how to use it: static void testXbGetSourceName() throws IOException { SchemaType st = SchemaDocument.type; // or any schemaType that is compiled into a jar using scomp InputStream is = st.getTypeSystem().getSourceAsStream(st.getSourceName()); Reader r = new InputStreamReader(is); Writer w = new PrintWriter(System.out); char[] buf = new char[100]; int l; while((l=r.read(buf))>=0) { w.write(buf, 0, l); } w.close(); r.close(); is.close(); } Cezar From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 14, 2008 2:12 AM To: user@xmlbeans.apache.org Subject: SchemaType.getSourceName() Hi, everybody! Doesn anybody know how can I decode the result of SchemaType.getSourceName() method? Regards, Denis. Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.
RE: SchemaType.getSourceName()
Denis, Jacob is correct. When you scomp an xsd, the xsd itself is archived inside the jar that is produced. SchemaType.getSourceName() will return a String containing the path to the xsd (in this jar), relative to schemaorg_apache_xmlbeans/src/. You are not meant to "decode" this string. Perhaps you thought the string is the path on your file system where the original xsd resides, and that if you "decode" it, you would get this path? That is not the intent of the method at all, although it is true that the path in the jar bears a relation to the location of the original xsd, and there is directory hashing going on. E.g., if you use the xmlbean ant task to compile a schema, and the schema is outside the base directory of the ant build file, then in the generated jar, the schema location will be a hashed directory; if the schema is under the base directory of the ant build file, then in the generated jar, the schema location will reflect that subdirectory structure. Using the string returned by SchemaType.getSourceName() to get at the original schema location is not recommended since that is not the purpose of the method. Also, if one xsd imports another xsd using a relative url, then trying to "decode" the paths to the xsd's using the strings may no longer work correctly. Just so you're warned. - Wing Yew -Original Message- From: Jacob Danner [mailto:[EMAIL PROTECTED] Sent: Thursday, February 14, 2008 11:56 PM To: user@xmlbeans.apache.org Subject: Re: SchemaType.getSourceName() Hi Denis, I see what you mean, I think in this case, getSourceName may be returning the path of the file in the scomp'ed jar. I'm on a machine without xmlbeans at the moment so maybe you can try something out for me. Will you open the scomp'ed jar and check in the schema(?)org_apache_xmlbeans\src directory and see if that xsd is present in a path similar to the one listed? As far as trying to decode the value, I think you are on the right track. XmlBeans is just munging the URI value with % being replaced with % for standard URL Encoding. Let me know about the scomp jar / src location -jacobd On Thu, Feb 14, 2008 at 11:14 PM, <[EMAIL PROTECTED]> wrote: > Hi Jacob, > > I know what does this method return. > But the result is encoded. > > Look at the example below: > > file_3A_2FC_3A_2Fmy_5Fxsd/datetime.xsd > > The question is how to decode it? > > For now I do it such a way: > > path = path.replaceAll("_2F", "/"); > path = path.replaceAll("_2E", "."); > path = path.replaceAll("_3A", ":"); > path = path.replaceAll("_5F", "_"); > path = path.replaceAll("file:/", ""); > > But I'm not sure that this is correct. > > Regards, > Denis. > > > > -Original Message- > From: Jacob Danner [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 14, 2008 8:32 PM > To: user@xmlbeans.apache.org > Subject: Re: SchemaType.getSourceName() > > Hi Denis, > From what I remember, SchemaComponent.getSourceName() will return the > path/location of the xsd used to create the type system. > http://xmlbeans.apache.org/docs/2.2.0/reference/org/apache/xmlbeans/Sche > maComponent.html#getSourceName() > > If the schema was built from a string, this method returns null. > > Does this help, or was there something more specific you were looking > for? > -jacobd > > On Thu, Feb 14, 2008 at 12:11 AM, <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi, everybody! > > > > Doesn anybody know how can I decode the result of > > SchemaType.getSourceName() method? > > > > Regards, > > Denis. > > Visit our website at http://www.ubs.com > > > > This message contains confidential information and is intended only > > for the individual named. If you are not the named addressee you > > should not disseminate, distribute or copy this e-mail. Please > > notify the sender immediately by e-mail if you have received this > > e-mail by mistake and delete this e-mail from your system. > > > > E-mails are not encrypted and cannot be guaranteed to be secure or > > error-free as information could be intercepted, corrupted, lost, > > destroyed, arrive late or incomplete, or contain viruses. The sender > > > therefore does not accept liability for any errors or omissions in the > > > contents of this message which arise as a result of e-mail > transmission. > > If verification is required please request a hard-copy version. This > > > message is provided for informational purposes and should not be > > construed as
Re: SchemaType.getSourceName()
Hi Denis, I see what you mean, I think in this case, getSourceName may be returning the path of the file in the scomp'ed jar. I'm on a machine without xmlbeans at the moment so maybe you can try something out for me. Will you open the scomp'ed jar and check in the schema(?)org_apache_xmlbeans\src directory and see if that xsd is present in a path similar to the one listed? As far as trying to decode the value, I think you are on the right track. XmlBeans is just munging the URI value with % being replaced with % for standard URL Encoding. Let me know about the scomp jar / src location -jacobd On Thu, Feb 14, 2008 at 11:14 PM, <[EMAIL PROTECTED]> wrote: > Hi Jacob, > > I know what does this method return. > But the result is encoded. > > Look at the example below: > > file_3A_2FC_3A_2Fmy_5Fxsd/datetime.xsd > > The question is how to decode it? > > For now I do it such a way: > > path = path.replaceAll("_2F", "/"); > path = path.replaceAll("_2E", "."); > path = path.replaceAll("_3A", ":"); > path = path.replaceAll("_5F", "_"); > path = path.replaceAll("file:/", ""); > > But I'm not sure that this is correct. > > Regards, > Denis. > > > > -Original Message- > From: Jacob Danner [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 14, 2008 8:32 PM > To: user@xmlbeans.apache.org > Subject: Re: SchemaType.getSourceName() > > Hi Denis, > From what I remember, SchemaComponent.getSourceName() will return the > path/location of the xsd used to create the type system. > http://xmlbeans.apache.org/docs/2.2.0/reference/org/apache/xmlbeans/Sche > maComponent.html#getSourceName() > > If the schema was built from a string, this method returns null. > > Does this help, or was there something more specific you were looking > for? > -jacobd > > On Thu, Feb 14, 2008 at 12:11 AM, <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi, everybody! > > > > Doesn anybody know how can I decode the result of > > SchemaType.getSourceName() method? > > > > Regards, > > Denis. > > Visit our website at http://www.ubs.com > > > > This message contains confidential information and is intended only > > for the individual named. If you are not the named addressee you > > should not disseminate, distribute or copy this e-mail. Please > > notify the sender immediately by e-mail if you have received this > > e-mail by mistake and delete this e-mail from your system. > > > > E-mails are not encrypted and cannot be guaranteed to be secure or > > error-free as information could be intercepted, corrupted, lost, > > destroyed, arrive late or incomplete, or contain viruses. The sender > > > therefore does not accept liability for any errors or omissions in the > > > contents of this message which arise as a result of e-mail > transmission. > > If verification is required please request a hard-copy version. This > > > message is provided for informational purposes and should not be > > construed as a solicitation or offer to buy or sell any securities or > > > related financial instruments. > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- > I'm competing in a Half-Ironman distance triathlon to raise money for > the fight against cancer! > Please help support my efforts by going to: > http://www.active.com/donate/tntwaak/jacobd > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > Visit our website at http://www.ubs.com > > This message contains confidential information and is intended only > for the individual named. If you are not the named addressee you > should not disseminate, distribute or copy this e-mail. Please > notify the sender immediately by e-mail if you have received this > e-mail by mistake and delete this e-mail from your system. > > E-mails are not encrypted and cannot be guaranteed to be secure or > error-free as information could be intercepted, corrupted, lost, > destroyed, arrive late or incomplete, or contain viruses. The sender > therefore does not accept liability for any errors or omissions in the > contents of this message which arise as a result of e-mail transmission. &
RE: SchemaType.getSourceName()
Hi Jacob, I know what does this method return. But the result is encoded. Look at the example below: file_3A_2FC_3A_2Fmy_5Fxsd/datetime.xsd The question is how to decode it? For now I do it such a way: path = path.replaceAll("_2F", "/"); path = path.replaceAll("_2E", "."); path = path.replaceAll("_3A", ":"); path = path.replaceAll("_5F", "_"); path = path.replaceAll("file:/", ""); But I'm not sure that this is correct. Regards, Denis. -Original Message- From: Jacob Danner [mailto:[EMAIL PROTECTED] Sent: Thursday, February 14, 2008 8:32 PM To: user@xmlbeans.apache.org Subject: Re: SchemaType.getSourceName() Hi Denis, >From what I remember, SchemaComponent.getSourceName() will return the path/location of the xsd used to create the type system. http://xmlbeans.apache.org/docs/2.2.0/reference/org/apache/xmlbeans/Sche maComponent.html#getSourceName() If the schema was built from a string, this method returns null. Does this help, or was there something more specific you were looking for? -jacobd On Thu, Feb 14, 2008 at 12:11 AM, <[EMAIL PROTECTED]> wrote: > > > > Hi, everybody! > > Doesn anybody know how can I decode the result of > SchemaType.getSourceName() method? > > Regards, > Denis. > Visit our website at http://www.ubs.com > > This message contains confidential information and is intended only > for the individual named. If you are not the named addressee you > should not disseminate, distribute or copy this e-mail. Please > notify the sender immediately by e-mail if you have received this > e-mail by mistake and delete this e-mail from your system. > > E-mails are not encrypted and cannot be guaranteed to be secure or > error-free as information could be intercepted, corrupted, lost, > destroyed, arrive late or incomplete, or contain viruses. The sender > therefore does not accept liability for any errors or omissions in the > contents of this message which arise as a result of e-mail transmission. > If verification is required please request a hard-copy version. This > message is provided for informational purposes and should not be > construed as a solicitation or offer to buy or sell any securities or > related financial instruments. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- I'm competing in a Half-Ironman distance triathlon to raise money for the fight against cancer! Please help support my efforts by going to: http://www.active.com/donate/tntwaak/jacobd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SchemaType.getSourceName()
Hi Denis, >From what I remember, SchemaComponent.getSourceName() will return the path/location of the xsd used to create the type system. http://xmlbeans.apache.org/docs/2.2.0/reference/org/apache/xmlbeans/SchemaComponent.html#getSourceName() If the schema was built from a string, this method returns null. Does this help, or was there something more specific you were looking for? -jacobd On Thu, Feb 14, 2008 at 12:11 AM, <[EMAIL PROTECTED]> wrote: > > > > Hi, everybody! > > Doesn anybody know how can I decode the result of SchemaType.getSourceName() > method? > > Regards, > Denis. > Visit our website at http://www.ubs.com > > This message contains confidential information and is intended only > for the individual named. If you are not the named addressee you > should not disseminate, distribute or copy this e-mail. Please > notify the sender immediately by e-mail if you have received this > e-mail by mistake and delete this e-mail from your system. > > E-mails are not encrypted and cannot be guaranteed to be secure or > error-free as information could be intercepted, corrupted, lost, > destroyed, arrive late or incomplete, or contain viruses. The sender > therefore does not accept liability for any errors or omissions in the > contents of this message which arise as a result of e-mail transmission. > If verification is required please request a hard-copy version. This > message is provided for informational purposes and should not be > construed as a solicitation or offer to buy or sell any securities > or related financial instruments. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- I'm competing in a Half-Ironman distance triathlon to raise money for the fight against cancer! Please help support my efforts by going to: http://www.active.com/donate/tntwaak/jacobd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SchemaType.getSourceName()
Hi, everybody! Doesn anybody know how can I decode the result of SchemaType.getSourceName() method? Regards, Denis. Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]