Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Creating XSDAnnotations
Creating XSDAnnotations [message #36335] Mon, 19 January 2004 17:05 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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>&nbsp;&nbsp; * 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>&nbsp;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 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
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>&nbsp;&nbsp; * 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>&nbsp;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/
Previous Topic:finding elements or attributes based on Types
Next Topic:How to find out when an attribute is a ref or not?
Goto Forum:
  


Current Time: Fri Apr 19 10:50:22 GMT 2024

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

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

Back to the top