Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Retrieving documentation from an <xsd:pattern> within a schema
Retrieving documentation from an <xsd:pattern> within a schema [message #55247] Thu, 25 November 2004 15:42 Go to next message
Eclipse User
Originally posted by: none.nonet.com

Hi there,

I'm having trouble retrieving the text from a documentation element
contained within an annotation within an <xs:pattern> element. Through the
API i can successfully get the text from annotations/documentation within
other parts, such as element declarations or type definitions, just not when
the annotation is within the pattern. Here's an example

<xs:simpleType name="ISBN">
<xs:annotation>
<xs:documentation>The ISBN is a unique code identifying the
book</xs:documentation> ///I can get this one
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[a-z]{3}(-[0-9]{6})?">
<xs:annotation>
<xs:documentation>A string of the form
aaa-xxxxxx</xs:documentation> ///I can't get this one
</xs:annotation>
</xs:pattern>
</xs:restriction>
</xs:simpleType>

I'm wondering if this is a known bug, or if i'm missing something obvious.
If it is a bug, any ideas how to go about submitting it?

Thanks very much for your help,

Ray
Re: Retrieving documentation from an <xsd:pattern> within a schema [message #55275 is a reply to message #55247] Thu, 25 November 2004 16:54 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Ray,

Pattern and enumeration facets are a little tricky because although they
can repeat in the syntax, in the abstract model there can only be one
such facet. So a single facet is synthesized from the repeated facets
and that synthesized facet has a getAnnotations reference that's
populated from all the contained annotations of all the repeats. So if
you are looking at the synthesized facet, you should look at the
getAnnotations.


Ray wrote:

>Hi there,
>
>I'm having trouble retrieving the text from a documentation element
>contained within an annotation within an <xs:pattern> element. Through the
>API i can successfully get the text from annotations/documentation within
>other parts, such as element declarations or type definitions, just not when
>the annotation is within the pattern. Here's an example
>
><xs:simpleType name="ISBN">
> <xs:annotation>
> <xs:documentation>The ISBN is a unique code identifying the
>book</xs:documentation> ///I can get this one
> </xs:annotation>
> <xs:restriction base="xs:string">
> <xs:pattern value="[a-z]{3}(-[0-9]{6})?">
> <xs:annotation>
> <xs:documentation>A string of the form
>aaa-xxxxxx</xs:documentation> ///I can't get this one
> </xs:annotation>
> </xs:pattern>
> </xs:restriction>
></xs:simpleType>
>
>I'm wondering if this is a known bug, or if i'm missing something obvious.
>If it is a bug, any ideas how to go about submitting it?
>
>Thanks very much for your help,
>
>Ray
>
>
>
>
Re: Retrieving documentation from an <xsd:pattern> within a schema [message #55329 is a reply to message #55275] Fri, 26 November 2004 10:36 Go to previous messageGo to next message
Eclipse User
Originally posted by: none.nonet.com

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:co52oe$vp$1@www.eclipse.org...
> Ray,
>
> Pattern and enumeration facets are a little tricky because although they
> can repeat in the syntax, in the abstract model there can only be one such
> facet. So a single facet is synthesized from the repeated facets and that
> synthesized facet has a getAnnotations reference that's populated from all
> the contained annotations of all the repeats. So if you are looking at
> the synthesized facet, you should look at the getAnnotations.
>
>

Hey Ed,

Thanks again for your quick response and help. Here's the code I'm
using......

XSDSimpleTypeDefinition a_simpleType = (XSDSimpleTypeDefinition) a_typeDef;
//get the simple type def

EList temp = a_simpleType.getSyntheticFacets(); //get the
synthetic facets

for (int i = 0 ; i < temp.size() ; i++) //for each facet
{
XSDFacet facet = (XSDFacet) temp.get(i); //can look in
here with debugger and see xs:pattern no prob.

XSDAnnotation annos = facet.getAnnotation(); //there is no
getAnnotations function within api for a facet.

//this returns null..........

//doesn't reach here - throws, but this is how i would get the 1st
documentation element

annos.getUserInformation()
Element documentationElement =
(Element)(annos.getUserInformation().get(0));
String documentation;
if(documentationElement.hasChildNodes())
{
documentation =
documentationElement.getChildNodes().item(0).getNodeValue();
}
}

However, within the Eclipse debugger, i can see an 'annotations' member of
the facet, which on further inspection does have user information, which
seems to have no content. Any thoughts?

Just as a recap, here's that simple type def from the schema again.....
<xs:simpleType name="ISBN">
<xs:annotation>
<xs:documentation>The ISBN is a unique code identifying the
book</xs:documentation> ///I can get this one
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[a-z]{3}(-[0-9]{6})?">
<xs:annotation>
<xs:documentation>A string of the form
aaa-xxxxxx</xs:documentation> ///I can't get this one
</xs:annotation>
</xs:pattern>
</xs:restriction>
</xs:simpleType>


Ray
Re: Retrieving documentation from an <xsd:pattern> within a schema [message #55356 is a reply to message #55329] Fri, 26 November 2004 11:47 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------000709090403020206040102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Ray,

An XSDPatternFacet and an XSDEnumerationFacet are both
XSDRepeatableFacets and therefore have this method available:

public interface XSDRepeatableFacet extends XSDConstrainingFacet
{
/**
* Returns the value of the '<em><b>Annotations</b></em>'
reference list.
* The list contents are of type {@link
org.eclipse.xsd.XSDAnnotation}.
* <!-- begin-user-doc -->
* <p>
* This represents the
* enumeration <a
href="http://www.w3.org/TR/xmlschema-2/#enumeration-annotation">annotation</a>,
or
* pattern <a
href="http://www.w3.org/TR/xmlschema-2/#pattern-annotation">annotation</a>
* infoset property.
* It is computed from the concrete {@link #getAnnotation()
annotation content} and should typically not be modified directly.
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Annotations</em>' reference list.
* @see org.eclipse.xsd.XSDPackage#getXSDRepeatableFacet_Annotations ()
* @model type="org.eclipse.xsd.XSDAnnotation" resolveProxies="false"
* @generated
*/
EList getAnnotations();

}


Ray wrote:

>"Ed Merks" <merks@ca.ibm.com> wrote in message
>news:co52oe$vp$1@www.eclipse.org...
>
>
>>Ray,
>>
>>Pattern and enumeration facets are a little tricky because although they
>>can repeat in the syntax, in the abstract model there can only be one such
>>facet. So a single facet is synthesized from the repeated facets and that
>>synthesized facet has a getAnnotations reference that's populated from all
>>the contained annotations of all the repeats. So if you are looking at
>>the synthesized facet, you should look at the getAnnotations.
>>
>>
>>
>>
>
>Hey Ed,
>
>Thanks again for your quick response and help. Here's the code I'm
>using......
>
>XSDSimpleTypeDefinition a_simpleType = (XSDSimpleTypeDefinition) a_typeDef;
>//get the simple type def
>
>EList temp = a_simpleType.getSyntheticFacets(); //get the
>synthetic facets
>
>for (int i = 0 ; i < temp.size() ; i++) //for each facet
>{
> XSDFacet facet = (XSDFacet) temp.get(i); //can look in
>here with debugger and see xs:pattern no prob.
>
> XSDAnnotation annos = facet.getAnnotation(); //there is no
>getAnnotations function within api for a facet.
>
> //this returns null..........
>
> //doesn't reach here - throws, but this is how i would get the 1st
>documentation element
>
> annos.getUserInformation()
> Element documentationElement =
>(Element)(annos.getUserInformation().get(0));
> String documentation;
> if(documentationElement.hasChildNodes())
> {
> documentation =
> documentationElement.getChildNodes().item(0).getNodeValue();
> }
> }
>
>However, within the Eclipse debugger, i can see an 'annotations' member of
>the facet, which on further inspection does have user information, which
>seems to have no content. Any thoughts?
>
>Just as a recap, here's that simple type def from the schema again.....
><xs:simpleType name="ISBN">
> <xs:annotation>
> <xs:documentation>The ISBN is a unique code identifying the
>book</xs:documentation> ///I can get this one
> </xs:annotation>
> <xs:restriction base="xs:string">
> <xs:pattern value="[a-z]{3}(-[0-9]{6})?">
> <xs:annotation>
> <xs:documentation>A string of the form
>aaa-xxxxxx</xs:documentation> ///I can't get this one
> </xs:annotation>
> </xs:pattern>
> </xs:restriction>
></xs:simpleType>
>
>
>Ray
>
>
>
>
>


--------------000709090403020206040102
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">
Ray,<br>
<br>
An XSDPatternFacet and an XSDEnumerationFacet are both
XSDRepeatableFacets and therefore have this method available:<br>
<blockquote><small>public interface XSDRepeatableFacet extends
XSDConstrainingFacet</small><br>
<small>{</small><br>
<small>&nbsp; /**</small><br>
<small>&nbsp;&nbsp; * Returns the value of the
'&lt;em&gt;&lt;b&gt;Annotations&lt;/b&am p;gt;&lt;/em&gt;' reference list.</small><br>
<small>&nbsp;&nbsp; * The list contents are of type {@link
org.eclipse.xsd.XSDAnnotation}.</small><br>
<small>&nbsp;&nbsp; * &lt;!-- begin-user-doc --&gt;</small><br>
<small>&nbsp;&nbsp; * &lt;p&gt;</small><br>
<small>&nbsp;&nbsp; * This represents the</small><br>
<small>&nbsp;&nbsp; * enumeration &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#enumeration-annotation">"http://www.w3.org/TR/xmlschema-2/#enumeration-annotation"</a>&gt;annotation&lt;/a&gt;,
or</small><br>
<small>&nbsp;&nbsp; * pattern &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#pattern-annotation">"http://www.w3.org/TR/xmlschema-2/#pattern-annotation"</a>&gt;annotation&lt;/a&gt;</small><br>
<small>&nbsp;&nbsp; * infoset property.</small><br>
<small>&nbsp;&nbsp; * It is computed from the concrete {@link #getAnnotation()
annotation content} and should typically not be modified directly.</small><br>
<small>&nbsp;&nbsp; * &lt;/p&gt;</small><br>
<small>&nbsp;&nbsp; * &lt;!-- end-user-doc --&gt;</small><br>
<small>&nbsp;&nbsp; * @return the value of the
'&lt;em&gt;Annotations&lt;/em&gt;' reference list.</small><br>
<small>&nbsp;&nbsp; * @see
org.eclipse.xsd.XSDPackage#getXSDRepeatableFacet_Annotations () </small><br>
<small>&nbsp;&nbsp; * @model type="org.eclipse.xsd.XSDAnnotation"
resolveProxies="false"</small><br>
<small>&nbsp;&nbsp; * @generated</small><br>
<small>&nbsp;&nbsp; */</small><br>
<small>&nbsp; EList getAnnotations();</small><br>
<br>
<small>}</small><br>
</blockquote>
<br>
Ray wrote:
<blockquote cite="midco7106$o49$1@www.eclipse.org" type="cite">
<pre wrap="">"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:co52oe$vp$1@www.eclipse.org">news:co52oe$vp$1@www.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Ray,

Pattern and enumeration facets are a little tricky because although they
can repeat in the syntax, in the abstract model there can only be one such
facet. So a single facet is synthesized from the repeated facets and that
synthesized facet has a getAnnotations reference that's populated from all
the contained annotations of all the repeats. So if you are looking at
the synthesized facet, you should look at the getAnnotations.


</pre>
</blockquote>
<pre wrap=""><!---->
Hey Ed,

Thanks again for your quick response and help. Here's the code I'm
using......

XSDSimpleTypeDefinition a_simpleType = (XSDSimpleTypeDefinition) a_typeDef;
//get the simple type def

EList temp = a_simpleType.getSyntheticFacets(); //get the
synthetic facets

for (int i = 0 ; i &lt; temp.size() ; i++) //for each facet
{
XSDFacet facet = (XSDFacet) temp.get(i); //can look in
here with debugger and see xs:pattern no prob.

XSDAnnotation annos = facet.getAnnotation(); //there is no
getAnnotations function within api for a facet.

//this returns null..........

//doesn't reach here - throws, but this is how i would get the 1st
documentation element

annos.getUserInformation()
Element documentationElement =
(Element)(annos.getUserInformation().get(0));
String documentation;
if(documentationElement.hasChildNodes())
{
documentation =
documentationElement.getChildNodes().item(0).getNodeValue();
}
}

However, within the Eclipse debugger, i can see an 'annotations' member of
the facet, which on further inspection does have user information, which
seems to have no content. Any thoughts?

Just as a recap, here's that simple type def from the schema again.....
&lt;xs:simpleType name="ISBN"&gt;
&lt;xs:annotation&gt;
&lt;xs:documentation&gt;The ISBN is a unique code identifying the
book&lt;/xs:documentation&gt; ///I can get this one
&lt;/xs:annotation&gt;
&lt;xs:restriction base="xs:string"&gt;
&lt;xs:pattern value="[a-z]{3}(-[0-9]{6})?"&gt;
&lt;xs:annotation&gt;
&lt;xs:documentation&gt;A string of the form
aaa-xxxxxx&lt;/xs:documentation&gt; ///I can't get this one
&lt;/xs:annotation&gt;
&lt;/xs:pattern&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;


Ray



</pre>
</blockquote>
<br>
</body>
</html>

--------------000709090403020206040102--
Re: Retrieving documentation from an <xsd:pattern> within a schema [message #55544 is a reply to message #55356] Tue, 30 November 2004 11:00 Go to previous message
Eclipse User
Originally posted by: none.nonet.com

>"Ed Merks" <merks@ca.ibm.com> wrote in message
>news:co754s$v1h$1@www.eclipse.org...
>Ray,
>An XSDPatternFacet and an XSDEnumerationFacet are both XSDRepeatableFacets
>and therefore have this method available:

Cheers Ed - by casting to this it solves the problem. Thanks again,

Ray
Re: Retrieving documentation from an <xsd:pattern> within a schema [message #592712 is a reply to message #55247] Thu, 25 November 2004 16:54 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26047
Registered: July 2009
Senior Member
Ray,

Pattern and enumeration facets are a little tricky because although they
can repeat in the syntax, in the abstract model there can only be one
such facet. So a single facet is synthesized from the repeated facets
and that synthesized facet has a getAnnotations reference that's
populated from all the contained annotations of all the repeats. So if
you are looking at the synthesized facet, you should look at the
getAnnotations.


Ray wrote:

>Hi there,
>
>I'm having trouble retrieving the text from a documentation element
>contained within an annotation within an <xs:pattern> element. Through the
>API i can successfully get the text from annotations/documentation within
>other parts, such as element declarations or type definitions, just not when
>the annotation is within the pattern. Here's an example
>
><xs:simpleType name="ISBN">
> <xs:annotation>
> <xs:documentation>The ISBN is a unique code identifying the
>book</xs:documentation> ///I can get this one
> </xs:annotation>
> <xs:restriction base="xs:string">
> <xs:pattern value="[a-z]{3}(-[0-9]{6})?">
> <xs:annotation>
> <xs:documentation>A string of the form
>aaa-xxxxxx</xs:documentation> ///I can't get this one
> </xs:annotation>
> </xs:pattern>
> </xs:restriction>
></xs:simpleType>
>
>I'm wondering if this is a known bug, or if i'm missing something obvious.
>If it is a bug, any ideas how to go about submitting it?
>
>Thanks very much for your help,
>
>Ray
>
>
>
>
Re: Retrieving documentation from an <xsd:pattern> within a schema [message #592746 is a reply to message #55275] Fri, 26 November 2004 10:36 Go to previous message
Ray is currently offline Ray
Messages: 9
Registered: July 2009
Junior Member
"Ed Merks" <merks@ca.ibm.com> wrote in message
news:co52oe$vp$1@www.eclipse.org...
> Ray,
>
> Pattern and enumeration facets are a little tricky because although they
> can repeat in the syntax, in the abstract model there can only be one such
> facet. So a single facet is synthesized from the repeated facets and that
> synthesized facet has a getAnnotations reference that's populated from all
> the contained annotations of all the repeats. So if you are looking at
> the synthesized facet, you should look at the getAnnotations.
>
>

Hey Ed,

Thanks again for your quick response and help. Here's the code I'm
using......

XSDSimpleTypeDefinition a_simpleType = (XSDSimpleTypeDefinition) a_typeDef;
//get the simple type def

EList temp = a_simpleType.getSyntheticFacets(); //get the
synthetic facets

for (int i = 0 ; i < temp.size() ; i++) //for each facet
{
XSDFacet facet = (XSDFacet) temp.get(i); //can look in
here with debugger and see xs:pattern no prob.

XSDAnnotation annos = facet.getAnnotation(); //there is no
getAnnotations function within api for a facet.

//this returns null..........

//doesn't reach here - throws, but this is how i would get the 1st
documentation element

annos.getUserInformation()
Element documentationElement =
(Element)(annos.getUserInformation().get(0));
String documentation;
if(documentationElement.hasChildNodes())
{
documentation =
documentationElement.getChildNodes().item(0).getNodeValue();
}
}

However, within the Eclipse debugger, i can see an 'annotations' member of
the facet, which on further inspection does have user information, which
seems to have no content. Any thoughts?

Just as a recap, here's that simple type def from the schema again.....
<xs:simpleType name="ISBN">
<xs:annotation>
<xs:documentation>The ISBN is a unique code identifying the
book</xs:documentation> ///I can get this one
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[a-z]{3}(-[0-9]{6})?">
<xs:annotation>
<xs:documentation>A string of the form
aaa-xxxxxx</xs:documentation> ///I can't get this one
</xs:annotation>
</xs:pattern>
</xs:restriction>
</xs:simpleType>


Ray
Re: Retrieving documentation from an <xsd:pattern> within a schema [message #592757 is a reply to message #55329] Fri, 26 November 2004 11:47 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26047
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000709090403020206040102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Ray,

An XSDPatternFacet and an XSDEnumerationFacet are both
XSDRepeatableFacets and therefore have this method available:

public interface XSDRepeatableFacet extends XSDConstrainingFacet
{
/**
* Returns the value of the '<em><b>Annotations</b></em>'
reference list.
* The list contents are of type {@link
org.eclipse.xsd.XSDAnnotation}.
* <!-- begin-user-doc -->
* <p>
* This represents the
* enumeration <a
href="http://www.w3.org/TR/xmlschema-2/#enumeration-annotation">annotation</a>,
or
* pattern <a
href="http://www.w3.org/TR/xmlschema-2/#pattern-annotation">annotation</a>
* infoset property.
* It is computed from the concrete {@link #getAnnotation()
annotation content} and should typically not be modified directly.
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Annotations</em>' reference list.
* @see org.eclipse.xsd.XSDPackage#getXSDRepeatableFacet_Annotations ()
* @model type="org.eclipse.xsd.XSDAnnotation" resolveProxies="false"
* @generated
*/
EList getAnnotations();

}


Ray wrote:

>"Ed Merks" <merks@ca.ibm.com> wrote in message
>news:co52oe$vp$1@www.eclipse.org...
>
>
>>Ray,
>>
>>Pattern and enumeration facets are a little tricky because although they
>>can repeat in the syntax, in the abstract model there can only be one such
>>facet. So a single facet is synthesized from the repeated facets and that
>>synthesized facet has a getAnnotations reference that's populated from all
>>the contained annotations of all the repeats. So if you are looking at
>>the synthesized facet, you should look at the getAnnotations.
>>
>>
>>
>>
>
>Hey Ed,
>
>Thanks again for your quick response and help. Here's the code I'm
>using......
>
>XSDSimpleTypeDefinition a_simpleType = (XSDSimpleTypeDefinition) a_typeDef;
>//get the simple type def
>
>EList temp = a_simpleType.getSyntheticFacets(); //get the
>synthetic facets
>
>for (int i = 0 ; i < temp.size() ; i++) //for each facet
>{
> XSDFacet facet = (XSDFacet) temp.get(i); //can look in
>here with debugger and see xs:pattern no prob.
>
> XSDAnnotation annos = facet.getAnnotation(); //there is no
>getAnnotations function within api for a facet.
>
> //this returns null..........
>
> //doesn't reach here - throws, but this is how i would get the 1st
>documentation element
>
> annos.getUserInformation()
> Element documentationElement =
>(Element)(annos.getUserInformation().get(0));
> String documentation;
> if(documentationElement.hasChildNodes())
> {
> documentation =
> documentationElement.getChildNodes().item(0).getNodeValue();
> }
> }
>
>However, within the Eclipse debugger, i can see an 'annotations' member of
>the facet, which on further inspection does have user information, which
>seems to have no content. Any thoughts?
>
>Just as a recap, here's that simple type def from the schema again.....
><xs:simpleType name="ISBN">
> <xs:annotation>
> <xs:documentation>The ISBN is a unique code identifying the
>book</xs:documentation> ///I can get this one
> </xs:annotation>
> <xs:restriction base="xs:string">
> <xs:pattern value="[a-z]{3}(-[0-9]{6})?">
> <xs:annotation>
> <xs:documentation>A string of the form
>aaa-xxxxxx</xs:documentation> ///I can't get this one
> </xs:annotation>
> </xs:pattern>
> </xs:restriction>
></xs:simpleType>
>
>
>Ray
>
>
>
>
>


--------------000709090403020206040102
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">
Ray,<br>
<br>
An XSDPatternFacet and an XSDEnumerationFacet are both
XSDRepeatableFacets and therefore have this method available:<br>
<blockquote><small>public interface XSDRepeatableFacet extends
XSDConstrainingFacet</small><br>
<small>{</small><br>
<small>&nbsp; /**</small><br>
<small>&nbsp;&nbsp; * Returns the value of the
'&lt;em&gt;&lt;b&gt;Annotations&lt;/b&am p;gt;&lt;/em&gt;' reference list.</small><br>
<small>&nbsp;&nbsp; * The list contents are of type {@link
org.eclipse.xsd.XSDAnnotation}.</small><br>
<small>&nbsp;&nbsp; * &lt;!-- begin-user-doc --&gt;</small><br>
<small>&nbsp;&nbsp; * &lt;p&gt;</small><br>
<small>&nbsp;&nbsp; * This represents the</small><br>
<small>&nbsp;&nbsp; * enumeration &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#enumeration-annotation">"http://www.w3.org/TR/xmlschema-2/#enumeration-annotation"</a>&gt;annotation&lt;/a&gt;,
or</small><br>
<small>&nbsp;&nbsp; * pattern &lt;a
href=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xmlschema-2/#pattern-annotation">"http://www.w3.org/TR/xmlschema-2/#pattern-annotation"</a>&gt;annotation&lt;/a&gt;</small><br>
<small>&nbsp;&nbsp; * infoset property.</small><br>
<small>&nbsp;&nbsp; * It is computed from the concrete {@link #getAnnotation()
annotation content} and should typically not be modified directly.</small><br>
<small>&nbsp;&nbsp; * &lt;/p&gt;</small><br>
<small>&nbsp;&nbsp; * &lt;!-- end-user-doc --&gt;</small><br>
<small>&nbsp;&nbsp; * @return the value of the
'&lt;em&gt;Annotations&lt;/em&gt;' reference list.</small><br>
<small>&nbsp;&nbsp; * @see
org.eclipse.xsd.XSDPackage#getXSDRepeatableFacet_Annotations () </small><br>
<small>&nbsp;&nbsp; * @model type="org.eclipse.xsd.XSDAnnotation"
resolveProxies="false"</small><br>
<small>&nbsp;&nbsp; * @generated</small><br>
<small>&nbsp;&nbsp; */</small><br>
<small>&nbsp; EList getAnnotations();</small><br>
<br>
<small>}</small><br>
</blockquote>
<br>
Ray wrote:
<blockquote cite="midco7106$o49$1@www.eclipse.org" type="cite">
<pre wrap="">"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:co52oe$vp$1@www.eclipse.org">news:co52oe$vp$1@www.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Ray,

Pattern and enumeration facets are a little tricky because although they
can repeat in the syntax, in the abstract model there can only be one such
facet. So a single facet is synthesized from the repeated facets and that
synthesized facet has a getAnnotations reference that's populated from all
the contained annotations of all the repeats. So if you are looking at
the synthesized facet, you should look at the getAnnotations.


</pre>
</blockquote>
<pre wrap=""><!---->
Hey Ed,

Thanks again for your quick response and help. Here's the code I'm
using......

XSDSimpleTypeDefinition a_simpleType = (XSDSimpleTypeDefinition) a_typeDef;
//get the simple type def

EList temp = a_simpleType.getSyntheticFacets(); //get the
synthetic facets

for (int i = 0 ; i &lt; temp.size() ; i++) //for each facet
{
XSDFacet facet = (XSDFacet) temp.get(i); //can look in
here with debugger and see xs:pattern no prob.

XSDAnnotation annos = facet.getAnnotation(); //there is no
getAnnotations function within api for a facet.

//this returns null..........

//doesn't reach here - throws, but this is how i would get the 1st
documentation element

annos.getUserInformation()
Element documentationElement =
(Element)(annos.getUserInformation().get(0));
String documentation;
if(documentationElement.hasChildNodes())
{
documentation =
documentationElement.getChildNodes().item(0).getNodeValue();
}
}

However, within the Eclipse debugger, i can see an 'annotations' member of
the facet, which on further inspection does have user information, which
seems to have no content. Any thoughts?

Just as a recap, here's that simple type def from the schema again.....
&lt;xs:simpleType name="ISBN"&gt;
&lt;xs:annotation&gt;
&lt;xs:documentation&gt;The ISBN is a unique code identifying the
book&lt;/xs:documentation&gt; ///I can get this one
&lt;/xs:annotation&gt;
&lt;xs:restriction base="xs:string"&gt;
&lt;xs:pattern value="[a-z]{3}(-[0-9]{6})?"&gt;
&lt;xs:annotation&gt;
&lt;xs:documentation&gt;A string of the form
aaa-xxxxxx&lt;/xs:documentation&gt; ///I can't get this one
&lt;/xs:annotation&gt;
&lt;/xs:pattern&gt;
&lt;/xs:restriction&gt;
&lt;/xs:simpleType&gt;


Ray



</pre>
</blockquote>
<br>
</body>
</html>

--------------000709090403020206040102--
Re: Retrieving documentation from an <xsd:pattern> within a schema [message #592845 is a reply to message #55356] Tue, 30 November 2004 11:00 Go to previous message
Ray is currently offline Ray
Messages: 9
Registered: July 2009
Junior Member
>"Ed Merks" <merks@ca.ibm.com> wrote in message
>news:co754s$v1h$1@www.eclipse.org...
>Ray,
>An XSDPatternFacet and an XSDEnumerationFacet are both XSDRepeatableFacets
>and therefore have this method available:

Cheers Ed - by casting to this it solves the problem. Thanks again,

Ray
Previous Topic:Saving single xsd from multiple parts
Next Topic:particle.getElement()
Goto Forum:
  


Current Time: Wed Sep 17 07:41:44 GMT 2014

Powered by FUDForum. Page generated in 0.02612 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software