Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » set annotation to schema object
set annotation to schema object [message #1235] Tue, 01 October 2002 07:51 Go to next message
Eclipse UserFriend
Originally posted by: kwgkwg.netian.com

I just try to add annotaion to XSD file.
But I can't set annotation to XSDSchema object.
It doesn't exist API.
Is there another way to set annotation to XSDSchema object?
Re: set annotation to schema object [message #1260 is a reply to message #1235] Tue, 01 October 2002 12:45 Go to previous messageGo to next message
Dave Spriet is currently offline Dave SprietFriend
Messages: 14
Registered: July 2009
Junior Member
Since Documentation is not really part of the infoset model you have to do a
little more work to create documentation

XSDAnnotation annotation = XSDFactory .eINSTANCE.createXSDAnnotation();
xsdSchema.getContents().add(0,annotation);

//This is where the real work comes
Element documentation = annotation.createUserInformation(null);
annotation.getElement().appendChild(documentation);
documentation.appendChild(documentation.getOwnerDocument().c reateTextNode( "m
y documentation"));

Regards,
Dave Spriet
WebSphere MQ Integration Tooling

"guest" <kwgkwg@netian.com> wrote in message
news:anbk5i$r3e$1@rogue.oti.com...
> I just try to add annotaion to XSD file.
> But I can't set annotation to XSDSchema object.
> It doesn't exist API.
> Is there another way to set annotation to XSDSchema object?
>
Re: set annotation to schema object [message #1323 is a reply to message #1235] Wed, 02 October 2002 10:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

You can do xsdSchema.getContents().add(xsdAnnotation). Schemas can have
many annotations and they are interspersed with the other contents.
There is also a white diamond relation xsdSchema.getAnnotations(); these
are automatically populated from what's added to xsdSchema.getContents()
and is not modified directly by clients.

As Dave points out, the stuff under an annotation is just pure DOM and
you must manipulate it as such.

guest wrote:

> I just try to add annotaion to XSD file.
> But I can't set annotation to XSDSchema object.
> It doesn't exist API.
> Is there another way to set annotation to XSDSchema object?
Re: set annotation to schema object [message #7210 is a reply to message #1323] Sun, 29 December 2002 15:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hayden.unicorn.com

Ed Merks wrote:

> You can do xsdSchema.getContents().add(xsdAnnotation). Schemas can have
> many annotations and they are interspersed with the other contents.
> There is also a white diamond relation xsdSchema.getAnnotations(); these
> are automatically populated from what's added to xsdSchema.getContents()
> and is not modified directly by clients.

> As Dave points out, the stuff under an annotation is just pure DOM and
> you must manipulate it as such.

> guest wrote:

> > I just try to add annotaion to XSD file.
> > But I can't set annotation to XSDSchema object.
> > It doesn't exist API.
> > Is there another way to set annotation to XSDSchema object?


I'm trying to do a similar action, but a get instead of a set.

I parse in the schema, and do a getAnnotations() on the XSDSchema class- I
need to retrieve the xsd:documentation for the annotation. I have an
XSDAnnotation object in my hand and I call the getUserInformation()
method. I then have a list of dom Elements. My list actually contains one
element, and when I call getNodeValue() it returns null, even though there
is content in the xsd:docuementation in there. Do I need to call a flag to
the XSDResourcesSet to tell it to build a DOM object for me so that I can
access the information?

Thanks
Re: set annotation to schema object [message #7298 is a reply to message #7210] Tue, 07 January 2003 14:32 Go to previous messageGo to next message
Shane Curcuru is currently offline Shane CurcuruFriend
Messages: 30
Registered: July 2009
Member
No, annotations and their contents should be included in the concrete model (only) by default; you don't need to turn this on.
Very odd. Are you sure you've never called anything like schema.setElement(null) or otherwise caused the concrete model to be
invalidated in your other code? I do have several tests that validate this basic functionality on a selection of schemas.

Try posting a more complete snippet of all your application code that loads and manipulates the schema up to this point if you
need further help.

- Shane

> I parse in the schema, and do a getAnnotations() on the XSDSchema class- I
> need to retrieve the xsd:documentation for the annotation. I have an
> XSDAnnotation object in my hand and I call the getUserInformation()
> method. I then have a list of dom Elements. My list actually contains one
> element, and when I call getNodeValue() it returns null, even though there
> is content in the xsd:docuementation in there. Do I need to call a flag to
> the XSDResourcesSet to tell it to build a DOM object for me so that I can
> access the information?
names [message #34551 is a reply to message #7210] Thu, 18 December 2003 15:39 Go to previous messageGo to next message
norwood sisson is currently offline norwood sissonFriend
Messages: 5
Registered: July 2009
Junior Member
hyphens (that are acceptable to sqc) in element or type names do not
seem to be handled well by eclipse-emf-esd for editor generation.

norwood sisson
Re: names [message #34586 is a reply to message #34551] Thu, 18 December 2003 16:34 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

--------------8B2BFB31116ABFEF02C9D81B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Norwood,

Thanks for pointing this out!! The feature names generated for the
DocumentRoot are not being properly validated as Java identifiers. I'm
changing this in XSDEcoreBuilder:

> etools-diff XSDEcoreBuilder.java
1477c1477
< xsdFeature.getName(),
---
> validName(xsdFeature.getName(), false),

We'll make another 2.0 drop available tomorrow (before I go on holidays
for four weeks).


norwoods wrote:

> hyphens (that are acceptable to sqc) in element or type names do not
> seem to be handled well by eclipse-emf-esd for editor generation.
>
> norwood sisson

--------------8B2BFB31116ABFEF02C9D81B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Norwood,
<p>Thanks for pointing this out!!&nbsp; The feature names generated for
the DocumentRoot are not being properly validated as Java identifiers.&nbsp;
I'm changing this in XSDEcoreBuilder:
<blockquote>> etools-diff XSDEcoreBuilder.java
<br>1477c1477
<br> &lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
xsdFeature.getName(),
<br>---
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
validName(xsdFeature.getName(), false),</blockquote>
We'll make another 2.0 drop available tomorrow (before I go on holidays
for four weeks).
<br>&nbsp;
<p>norwoods wrote:
<blockquote TYPE=CITE>hyphens (that are acceptable to sqc) in element or
type names do not
<br>seem to be handled well by eclipse-emf-esd for editor generation.
<p>norwood sisson</blockquote>
</html>

--------------8B2BFB31116ABFEF02C9D81B--
Re: set annotation to schema object [message #562712 is a reply to message #1235] Tue, 01 October 2002 12:45 Go to previous message
Dave Spriet is currently offline Dave SprietFriend
Messages: 14
Registered: July 2009
Junior Member
Since Documentation is not really part of the infoset model you have to do a
little more work to create documentation

XSDAnnotation annotation = XSDFactory .eINSTANCE.createXSDAnnotation();
xsdSchema.getContents().add(0,annotation);

//This is where the real work comes
Element documentation = annotation.createUserInformation(null);
annotation.getElement().appendChild(documentation);
documentation.appendChild(documentation.getOwnerDocument().c reateTextNode( "m
y documentation"));

Regards,
Dave Spriet
WebSphere MQ Integration Tooling

"guest" <kwgkwg@netian.com> wrote in message
news:anbk5i$r3e$1@rogue.oti.com...
> I just try to add annotaion to XSD file.
> But I can't set annotation to XSDSchema object.
> It doesn't exist API.
> Is there another way to set annotation to XSDSchema object?
>
Re: set annotation to schema object [message #562788 is a reply to message #1235] Wed, 02 October 2002 10:11 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26235
Registered: July 2009
Senior Member
You can do xsdSchema.getContents().add(xsdAnnotation). Schemas can have
many annotations and they are interspersed with the other contents.
There is also a white diamond relation xsdSchema.getAnnotations(); these
are automatically populated from what's added to xsdSchema.getContents()
and is not modified directly by clients.

As Dave points out, the stuff under an annotation is just pure DOM and
you must manipulate it as such.

guest wrote:

> I just try to add annotaion to XSD file.
> But I can't set annotation to XSDSchema object.
> It doesn't exist API.
> Is there another way to set annotation to XSDSchema object?
Re: set annotation to schema object [message #564317 is a reply to message #1323] Sun, 29 December 2002 15:33 Go to previous message
Hayden Marchant is currently offline Hayden MarchantFriend
Messages: 90
Registered: July 2009
Member
Ed Merks wrote:

> You can do xsdSchema.getContents().add(xsdAnnotation). Schemas can have
> many annotations and they are interspersed with the other contents.
> There is also a white diamond relation xsdSchema.getAnnotations(); these
> are automatically populated from what's added to xsdSchema.getContents()
> and is not modified directly by clients.

> As Dave points out, the stuff under an annotation is just pure DOM and
> you must manipulate it as such.

> guest wrote:

> > I just try to add annotaion to XSD file.
> > But I can't set annotation to XSDSchema object.
> > It doesn't exist API.
> > Is there another way to set annotation to XSDSchema object?


I'm trying to do a similar action, but a get instead of a set.

I parse in the schema, and do a getAnnotations() on the XSDSchema class- I
need to retrieve the xsd:documentation for the annotation. I have an
XSDAnnotation object in my hand and I call the getUserInformation()
method. I then have a list of dom Elements. My list actually contains one
element, and when I call getNodeValue() it returns null, even though there
is content in the xsd:docuementation in there. Do I need to call a flag to
the XSDResourcesSet to tell it to build a DOM object for me so that I can
access the information?

Thanks
Re: set annotation to schema object [message #564395 is a reply to message #7210] Tue, 07 January 2003 14:32 Go to previous message
Shane Curcuru is currently offline Shane CurcuruFriend
Messages: 30
Registered: July 2009
Member
No, annotations and their contents should be included in the concrete model (only) by default; you don't need to turn this on.
Very odd. Are you sure you've never called anything like schema.setElement(null) or otherwise caused the concrete model to be
invalidated in your other code? I do have several tests that validate this basic functionality on a selection of schemas.

Try posting a more complete snippet of all your application code that loads and manipulates the schema up to this point if you
need further help.

- Shane

> I parse in the schema, and do a getAnnotations() on the XSDSchema class- I
> need to retrieve the xsd:documentation for the annotation. I have an
> XSDAnnotation object in my hand and I call the getUserInformation()
> method. I then have a list of dom Elements. My list actually contains one
> element, and when I call getNodeValue() it returns null, even though there
> is content in the xsd:docuementation in there. Do I need to call a flag to
> the XSDResourcesSet to tell it to build a DOM object for me so that I can
> access the information?
names [message #581919 is a reply to message #7210] Thu, 18 December 2003 15:39 Go to previous message
norwood sisson is currently offline norwood sissonFriend
Messages: 5
Registered: July 2009
Junior Member
hyphens (that are acceptable to sqc) in element or type names do not
seem to be handled well by eclipse-emf-esd for editor generation.

norwood sisson
Re: names [message #581956 is a reply to message #34551] Thu, 18 December 2003 16:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26235
Registered: July 2009
Senior Member
--------------8B2BFB31116ABFEF02C9D81B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Norwood,

Thanks for pointing this out!! The feature names generated for the
DocumentRoot are not being properly validated as Java identifiers. I'm
changing this in XSDEcoreBuilder:

> etools-diff XSDEcoreBuilder.java
1477c1477
< xsdFeature.getName(),
---
> validName(xsdFeature.getName(), false),

We'll make another 2.0 drop available tomorrow (before I go on holidays
for four weeks).


norwoods wrote:

> hyphens (that are acceptable to sqc) in element or type names do not
> seem to be handled well by eclipse-emf-esd for editor generation.
>
> norwood sisson

--------------8B2BFB31116ABFEF02C9D81B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Norwood,
<p>Thanks for pointing this out!!&nbsp; The feature names generated for
the DocumentRoot are not being properly validated as Java identifiers.&nbsp;
I'm changing this in XSDEcoreBuilder:
<blockquote>> etools-diff XSDEcoreBuilder.java
<br>1477c1477
<br> &lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
xsdFeature.getName(),
<br>---
<br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
validName(xsdFeature.getName(), false),</blockquote>
We'll make another 2.0 drop available tomorrow (before I go on holidays
for four weeks).
<br>&nbsp;
<p>norwoods wrote:
<blockquote TYPE=CITE>hyphens (that are acceptable to sqc) in element or
type names do not
<br>seem to be handled well by eclipse-emf-esd for editor generation.
<p>norwood sisson</blockquote>
</html>

--------------8B2BFB31116ABFEF02C9D81B--
Previous Topic:DOM input
Next Topic:Headless xsd2genmodel ?
Goto Forum:
  


Current Time: Thu Nov 27 19:32:33 GMT 2014

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

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