Determining if an <include>'d schema has a defined target namespace [message #59082] |
Thu, 07 April 2005 10:37  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------090509080408010309000802
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
I've got an included schema that doesn't have a targetNamespace
defined. I'd like to determine that (it isn't defined) but the method
XSDSchema.getTargetNamespace() returns the "incorporated" schema's
target namespace (since the top-level schema defines a target namespace).
Is it possible to determine this?
Sample schema:
<!-- top-level.xsd -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ibm.com/samples">
<xs:include schemaLocation="include.xsd"/>
</xs:schema>
<!-- include.xsd -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attribute name="dummy" type="xs:string"/>
</xs:schema>
Attempt to get using something like:
Resource res = ...;
XSDSchema topLevelSchema = (XSDSchema)res.getContents().get(0);
XSDInclude xsdInclude = (XSDInclude)topLevelSchema.getContents().get(0);
String tns = xsdInclude.getIncorporatedSchema().getTargetNamespace();
// tns is set to the top-level tns
Thanks in advance,
Steve
--------------090509080408010309000802
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I've got an included schema that doesn't have a targetNamespace
defined. I'd like to determine that (it isn't defined) but the method
XSDSchema.getTargetNamespace() returns the "incorporated" schema's
target namespace (since the top-level schema defines a target
namespace).<br>
<br>
Is it possible to determine this?<br>
<br>
Sample schema:<br>
<blockquote><tt><!-- top-level.xsd --></tt><br>
<tt><xs:schema xmlns:xs=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
targetNamespace=<a class="moz-txt-link-rfc2396E" href="http://www.ibm.com/samples">"http://www.ibm.com/samples"</a>></tt><br>
<tt> <xs:include schemaLocation="include.xsd"/></tt><br>
<tt></xs:schema></tt><br>
<br>
<tt><!-- include.xsd --></tt><br>
<tt><xs:schema xmlns:xs=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>></tt><br>
<tt> <xs:attribute name="dummy" type="xs:string"/></tt><br>
<tt></xs:schema></tt><br>
</blockquote>
<br>
Attempt to get using something like:<br>
<br>
<blockquote><tt>Resource res = ...;</tt><br>
<tt>XSDSchema topLevelSchema = (XSDSchema)res.getContents().get(0);</tt><br>
<tt>XSDInclude xsdInclude =
(XSDInclude)topLevelSchema.getContents().get(0);</tt><br>
<tt>String tns =
xsdInclude.getIncorporatedSchema().getTargetNamespace();</tt ><br>
<tt>// tns is set to the top-level tns</tt><br>
</blockquote>
<br>
Thanks in advance,<br>
Steve<br>
<a class="moz-txt-link-rfc2396E" href="http://tempuri.org/MySchema.xsd"></a>
</body>
</html>
--------------090509080408010309000802--
|
|
|
Re: Determining if an <include>'d schema has a defined target namespace [message #59110 is a reply to message #59082] |
Thu, 07 April 2005 10:49  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------080706070905030606070404
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Steve,
You can access the resolved schema to get that:
String tns = xsdInclude.getResolvedSchema().getTargetNamespace()
Given an XSDSchema, you can also call getOriginalVersion() to determine
the schema from which it was cloned.
Steve Speicher wrote:
> Hi,
>
> I've got an included schema that doesn't have a targetNamespace
> defined. I'd like to determine that (it isn't defined) but the method
> XSDSchema.getTargetNamespace() returns the "incorporated" schema's
> target namespace (since the top-level schema defines a target namespace).
>
> Is it possible to determine this?
>
> Sample schema:
>
> <!-- top-level.xsd -->
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.ibm.com/samples">
> <xs:include schemaLocation="include.xsd"/>
> </xs:schema>
>
> <!-- include.xsd -->
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:attribute name="dummy" type="xs:string"/>
> </xs:schema>
>
>
> Attempt to get using something like:
>
> Resource res = ...;
> XSDSchema topLevelSchema = (XSDSchema)res.getContents().get(0);
> XSDInclude xsdInclude =
> (XSDInclude)topLevelSchema.getContents().get(0);
> String tns = xsdInclude.getIncorporatedSchema().getTargetNamespace();
> // tns is set to the top-level tns
>
>
> Thanks in advance,
> Steve
--------------080706070905030606070404
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Steve,<br>
<br>
You can access the resolved schema to get that:<br>
<blockquote><tt>String tns =
xsdInclude.getResolvedSchema().getTargetNamespace()</tt><br >
</blockquote>
Given an XSDSchema, you can also call getOriginalVersion() to determine
the schema from which it was cloned.<br>
<br>
<br>
Steve Speicher wrote:
<blockquote cite="midd33grh$dob$1@news.eclipse.org" type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
Hi,<br>
<br>
I've got an included schema that doesn't have a targetNamespace
defined. I'd like to determine that (it isn't defined) but the method
XSDSchema.getTargetNamespace() returns the "incorporated" schema's
target namespace (since the top-level schema defines a target
namespace).<br>
<br>
Is it possible to determine this?<br>
<br>
Sample schema:<br>
<blockquote><tt><!-- top-level.xsd --></tt><br>
<tt><xs:schema xmlns:xs=<a class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
targetNamespace=<a class="moz-txt-link-rfc2396E"
href="http://www.ibm.com/samples">"http://www.ibm.com/samples"</a>></tt><br>
<tt> <xs:include schemaLocation="include.xsd"/></tt><br>
<tt></xs:schema></tt><br>
<br>
<tt><!-- include.xsd --></tt><br>
<tt><xs:schema xmlns:xs=<a class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>></tt><br>
<tt> <xs:attribute name="dummy" type="xs:string"/></tt><br>
<tt></xs:schema></tt><br>
</blockquote>
<br>
Attempt to get using something like:<br>
<br>
<blockquote><tt>Resource res = ...;</tt><br>
<tt>XSDSchema topLevelSchema = (XSDSchema)res.getContents().get(0);</tt><br>
<tt>XSDInclude xsdInclude =
(XSDInclude)topLevelSchema.getContents().get(0);</tt><br>
<tt>String tns =
xsdInclude.getIncorporatedSchema().getTargetNamespace();</tt ><br>
<tt>// tns is set to the top-level tns</tt><br>
</blockquote>
<br>
Thanks in advance,<br>
Steve<br>
</blockquote>
<br>
</body>
</html>
--------------080706070905030606070404--
|
|
|
Re: Determining if an <include>'d schema has a defined target namespace [message #594704 is a reply to message #59082] |
Thu, 07 April 2005 10:49  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------080706070905030606070404
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Steve,
You can access the resolved schema to get that:
String tns = xsdInclude.getResolvedSchema().getTargetNamespace()
Given an XSDSchema, you can also call getOriginalVersion() to determine
the schema from which it was cloned.
Steve Speicher wrote:
> Hi,
>
> I've got an included schema that doesn't have a targetNamespace
> defined. I'd like to determine that (it isn't defined) but the method
> XSDSchema.getTargetNamespace() returns the "incorporated" schema's
> target namespace (since the top-level schema defines a target namespace).
>
> Is it possible to determine this?
>
> Sample schema:
>
> <!-- top-level.xsd -->
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.ibm.com/samples">
> <xs:include schemaLocation="include.xsd"/>
> </xs:schema>
>
> <!-- include.xsd -->
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:attribute name="dummy" type="xs:string"/>
> </xs:schema>
>
>
> Attempt to get using something like:
>
> Resource res = ...;
> XSDSchema topLevelSchema = (XSDSchema)res.getContents().get(0);
> XSDInclude xsdInclude =
> (XSDInclude)topLevelSchema.getContents().get(0);
> String tns = xsdInclude.getIncorporatedSchema().getTargetNamespace();
> // tns is set to the top-level tns
>
>
> Thanks in advance,
> Steve
--------------080706070905030606070404
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Steve,<br>
<br>
You can access the resolved schema to get that:<br>
<blockquote><tt>String tns =
xsdInclude.getResolvedSchema().getTargetNamespace()</tt><br >
</blockquote>
Given an XSDSchema, you can also call getOriginalVersion() to determine
the schema from which it was cloned.<br>
<br>
<br>
Steve Speicher wrote:
<blockquote cite="midd33grh$dob$1@news.eclipse.org" type="cite">
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
Hi,<br>
<br>
I've got an included schema that doesn't have a targetNamespace
defined. I'd like to determine that (it isn't defined) but the method
XSDSchema.getTargetNamespace() returns the "incorporated" schema's
target namespace (since the top-level schema defines a target
namespace).<br>
<br>
Is it possible to determine this?<br>
<br>
Sample schema:<br>
<blockquote><tt><!-- top-level.xsd --></tt><br>
<tt><xs:schema xmlns:xs=<a class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
targetNamespace=<a class="moz-txt-link-rfc2396E"
href="http://www.ibm.com/samples">"http://www.ibm.com/samples"</a>></tt><br>
<tt> <xs:include schemaLocation="include.xsd"/></tt><br>
<tt></xs:schema></tt><br>
<br>
<tt><!-- include.xsd --></tt><br>
<tt><xs:schema xmlns:xs=<a class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>></tt><br>
<tt> <xs:attribute name="dummy" type="xs:string"/></tt><br>
<tt></xs:schema></tt><br>
</blockquote>
<br>
Attempt to get using something like:<br>
<br>
<blockquote><tt>Resource res = ...;</tt><br>
<tt>XSDSchema topLevelSchema = (XSDSchema)res.getContents().get(0);</tt><br>
<tt>XSDInclude xsdInclude =
(XSDInclude)topLevelSchema.getContents().get(0);</tt><br>
<tt>String tns =
xsdInclude.getIncorporatedSchema().getTargetNamespace();</tt ><br>
<tt>// tns is set to the top-level tns</tt><br>
</blockquote>
<br>
Thanks in advance,<br>
Steve<br>
</blockquote>
<br>
</body>
</html>
--------------080706070905030606070404--
|
|
|
Powered by
FUDForum. Page generated in 0.02617 seconds