Creating XSDAnnotations [message #36335] |
Mon, 19 January 2004 17:05 |
Eclipse User |
|
|
|
Originally posted by: floodg.uk.ibm.com
Hi,
trying to create an XSDAnnotation for an XSDFacet. Can't understand why the
following code doesn't do the job!
XSDAnnotation annotation = XSDFactory.eINSTANCE.createXSDAnnotation();
facet.setAnnotation(annotation);
Element element =
annotation.createUserInformation(facet.getSchema().getSchema Location());
Node node = element.getOwnerDocument().createTextNode("some text");
element.appendChild(node);
annotation.getUserInformation().add(element);
I've also tried element.setNodeValue("some text") but that doesn't work
either. My output contains no annotation node at all.
And ideas or sample code would be greatly appreciated!
Gary.
|
|
|
Re: Creating XSDAnnotations [message #36395 is a reply to message #36335] |
Wed, 21 January 2004 20:22 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
--------------D44794964EAFC5E875CB95F6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Gary,
It's good to look at the examples in XSDPrototypicalSchema.
The Javadoc for createUserInformation says this:
* The caller is responsible for adding the documentation element
to annotation element.
So you should have this line in place of
annotation.getElement().appendChild(element);
instead of this line:
annotation.getUserInformation().add(element);
Gary Flood wrote:
> Hi,
>
> trying to create an XSDAnnotation for an XSDFacet. Can't understand why the
> following code doesn't do the job!
>
> XSDAnnotation annotation = XSDFactory.eINSTANCE.createXSDAnnotation();
>
> facet.setAnnotation(annotation);
>
> Element element =
> annotation.createUserInformation(facet.getSchema().getSchema Location());
>
> Node node = element.getOwnerDocument().createTextNode("some text");
>
> element.appendChild(node);
>
> annotation.getUserInformation().add(element);
>
> I've also tried element.setNodeValue("some text") but that doesn't work
> either. My output contains no annotation node at all.
>
> And ideas or sample code would be greatly appreciated!
>
> Gary.
--------------D44794964EAFC5E875CB95F6
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Gary,
<p>It's good to look at the examples in XSDPrototypicalSchema.
<p>The Javadoc for createUserInformation says this:
<blockquote> * The caller is responsible for adding the documentation
element to annotation element.</blockquote>
So you should have this line in place of
<blockquote>annotation.getElement().appendChild(element);</blockquote >
instead of this line:
<blockquote>annotation.getUserInformation().add(element);</blockquote >
<p><br>Gary Flood wrote:
<blockquote TYPE=CITE>Hi,
<p>trying to create an XSDAnnotation for an XSDFacet. Can't understand
why the
<br>following code doesn't do the job!
<p>XSDAnnotation annotation = XSDFactory.eINSTANCE.createXSDAnnotation();
<p>facet.setAnnotation(annotation);
<p>Element element =
<br> annotation.createUserInformation(facet.getSchema().getSchema Location());
<p>Node node = element.getOwnerDocument().createTextNode("some text");
<p>element.appendChild(node);
<p>annotation.getUserInformation().add(element);
<p> I've also tried element.setNodeValue("some text") but that doesn't
work
<br>either. My output contains no annotation node at all.
<p>And ideas or sample code would be greatly appreciated!
<p>Gary.</blockquote>
</html>
--------------D44794964EAFC5E875CB95F6--
|
|
|
Re: Creating XSDAnnotations [message #583032 is a reply to message #36335] |
Wed, 21 January 2004 20:22 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
--------------D44794964EAFC5E875CB95F6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Gary,
It's good to look at the examples in XSDPrototypicalSchema.
The Javadoc for createUserInformation says this:
* The caller is responsible for adding the documentation element
to annotation element.
So you should have this line in place of
annotation.getElement().appendChild(element);
instead of this line:
annotation.getUserInformation().add(element);
Gary Flood wrote:
> Hi,
>
> trying to create an XSDAnnotation for an XSDFacet. Can't understand why the
> following code doesn't do the job!
>
> XSDAnnotation annotation = XSDFactory.eINSTANCE.createXSDAnnotation();
>
> facet.setAnnotation(annotation);
>
> Element element =
> annotation.createUserInformation(facet.getSchema().getSchema Location());
>
> Node node = element.getOwnerDocument().createTextNode("some text");
>
> element.appendChild(node);
>
> annotation.getUserInformation().add(element);
>
> I've also tried element.setNodeValue("some text") but that doesn't work
> either. My output contains no annotation node at all.
>
> And ideas or sample code would be greatly appreciated!
>
> Gary.
--------------D44794964EAFC5E875CB95F6
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Gary,
<p>It's good to look at the examples in XSDPrototypicalSchema.
<p>The Javadoc for createUserInformation says this:
<blockquote> * The caller is responsible for adding the documentation
element to annotation element.</blockquote>
So you should have this line in place of
<blockquote>annotation.getElement().appendChild(element);</blockquote >
instead of this line:
<blockquote>annotation.getUserInformation().add(element);</blockquote >
<p><br>Gary Flood wrote:
<blockquote TYPE=CITE>Hi,
<p>trying to create an XSDAnnotation for an XSDFacet. Can't understand
why the
<br>following code doesn't do the job!
<p>XSDAnnotation annotation = XSDFactory.eINSTANCE.createXSDAnnotation();
<p>facet.setAnnotation(annotation);
<p>Element element =
<br> annotation.createUserInformation(facet.getSchema().getSchema Location());
<p>Node node = element.getOwnerDocument().createTextNode("some text");
<p>element.appendChild(node);
<p>annotation.getUserInformation().add(element);
<p> I've also tried element.setNodeValue("some text") but that doesn't
work
<br>either. My output contains no annotation node at all.
<p>And ideas or sample code would be greatly appreciated!
<p>Gary.</blockquote>
</html>
--------------D44794964EAFC5E875CB95F6--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.05232 seconds