Determining if an <include>'d schema has a defined target namespace [message #594696] |
Thu, 07 April 2005 14:37 |
|
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--
|
|
|
Powered by
FUDForum. Page generated in 0.02979 seconds