Skip to main content



      Home
Home » Archived » XML Schema Definition (XSD) » set annotation to schema object
set annotation to schema object [message #1235] Tue, 01 October 2002 03: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 08:45 Go to previous messageGo to next message
Eclipse UserFriend
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 06: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 10: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 09:32 Go to previous messageGo to next message
Eclipse UserFriend
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 10:39 Go to previous messageGo to next message
Eclipse UserFriend
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 11:34 Go to previous messageGo to next 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 08:45 Go to previous messageGo to next message
Eclipse UserFriend
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 06:11 Go to previous messageGo to next message
Eclipse UserFriend
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 10:33 Go to previous messageGo to next message
Eclipse UserFriend
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 09:32 Go to previous messageGo to next message
Eclipse UserFriend
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 10:39 Go to previous messageGo to next message
Eclipse UserFriend
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 11:34 Go to previous messageGo to next message
Eclipse UserFriend
--------------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: In AGR While Creating Datapool, "Link to Datapool" is not visible [message #1788207] Wed, 30 May 2018 12:17 Go to previous message
Eclipse UserFriend
1
Previous Topic:XSD assert
Next Topic:Creating new xml schema file example ?
Goto Forum:
  


Current Time: Tue Jul 01 18:46:58 EDT 2025

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

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

Back to the top