Denis,
when you compile your schema in xmlbeans (using scomp), you get a jar.
Inside this jar, there will be a copy of the xsd file containing your
schema. SchemaType.getSourceName() returns a string which is the path
to this file in the jar. One of the points Radu was making is that you
should not count on using this string to figure out the path to your
original xsd file.
Recently Cezar posted the following code sample to this list:
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);
Now you can read the contents of your xsd file (using the copy in
the compiled jar). I think that's the other point Radu was suggesting.
- Wing Yew
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2008 7:23 AM
To: [email protected]
Subject: RE: Imported, included schemas
"returns the path to the Schema file inside the jar that it came from"
I don't use jar files.
I open my xsd schemas with my types, elements, etc....
-----Original Message-----
From: Radu Preotiuc-Pietro [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2008 12:49 AM
To: [email protected]
Subject: Re: Imported, included schemas
I think that this has been covered, but getSourceName() returns the path
to the Schema file inside the jar that it came from, there is no
guarantee that "decoding it" returns anything meaningful. What you can
do is use getResourceByName() to get to the text of the Schema file.
But the original location of the file is not saved in the jar and the
"stack" of imports and includes is never computed as such. Sorry! :-)
Radu
On Tue, 2008-03-18 at 06:10 -0700, [EMAIL PROTECTED] wrote:
> Hi All!
>
> I'm using XMLBeans to validate xsd schemas, according to specified
> rules.
> I need to implement the feature to show where the user can find
> exception.
>
> I'm trying to get file name using SchemaType.getSourceName() method.
>
> As I have understood, I have the result converted by QNameHelper.java
> class.
>
> Is it possible to ease decode it? Is there any helper methods to do
> it?
>
> And, finally:
>
> Is it possible to see some "stack" of imports, includes? For example I
> open a.xsd for validation, it imports b.xsd. Then b.xsd imports c.xsd
> and c.xsd includes d.xsd which contain an exception.
>
> The best would be the result: a.xsd -> b.xsd -> c.xsd -> d.xsd, for
> now I can just show a.xsd -> d.xsd, by getting path of
> property.getContainerType().getSourceName, where property is
> validating property or type.getSourceName if I validate a type.
>
> Thanks a lot.
>
> Regards,
> Denis.
>
> plain text document attachment (disclaim.txt), "Legal Disclaimer"
> 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.
>
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.
---------------------------------------------------------------------
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]
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.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]