Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Adding XML Comments to XML Schema?
Adding XML Comments to XML Schema? [message #61131] Wed, 25 May 2005 14:03 Go to next message
Eclipse UserFriend
Originally posted by: user.domain.invalid

Hi,

Ive been looking for a way to add a plain XML comment to an XMLSchema
but I seems to be missing on how to do it. I seem not to be able to
locate a XMLComment or similar in the EMF representation.

Could anyone point me in the right direktion?

/anders
Re: Adding XML Comments to XML Schema? [message #61154 is a reply to message #61131] Wed, 25 May 2005 21:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

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

Anders,

There is an example of pretty much everything in XSPrototypicalSchema.
Examples of how to create annotations are here:

http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
< http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>


user@domain.invalid wrote:

> Hi,
>
> Ive been looking for a way to add a plain XML comment to an XMLSchema
> but I seems to be missing on how to do it. I seem not to be able to
> locate a XMLComment or similar in the EMF representation.
>
> Could anyone point me in the right direktion?
>
> /anders



--------------020409070303050909000304
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">
</head>
<body bgcolor="#ffffff" text="#000000">
Anders,<br>
<br>
There is an example of pretty much everything in
XSPrototypicalSchema.&nbsp;&nbsp; Examples of how to create annotations are here:<br>
<blockquote><a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29"> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()</a><br>
</blockquote>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:user@domain.invalid">user@domain.invalid</a> wrote:
<blockquote cite="midd720oq$u92$1@news.eclipse.org" type="cite">Hi,
<br>
<br>
Ive been looking for a way to add a plain XML comment to an XMLSchema
but I seems to be missing on how to do it. I seem not to be able to
locate a XMLComment or similar in the EMF representation.
<br>
<br>
Could anyone point me in the right direktion?
<br>
<br>
/anders
<br>
</blockquote>
<br>
</body>
</html>

--------------020409070303050909000304--
Re: Adding XML Comments to XML Schema? [message #61178 is a reply to message #61154] Thu, 26 May 2005 08:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: user.domain.invalid

Ed,


Thanks for the examplas, unfortunately both appInfo and documentation
returns null in my code when trying to creation annotations for
ComplexTypeDef's.

Element appinfo =
annotation.createApplicationInformation("http://www.example.com/appinfo");
Element documentation =
annotation.createUserInformation("http://www.example.com/documentation");


I also got a need to add plain XML comments <!-- commen --> to the
schema. I managed to do this for the schema itself by callng
updateElement() and the working on the resulting XML itslf

thanks
/anders


Ed Merks wrote:
> Anders,
>
> There is an example of pretty much everything in XSPrototypicalSchema.
> Examples of how to create annotations are here:
>
> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>
>
>
> user@domain.invalid wrote:
>
>> Hi,
>>
>> Ive been looking for a way to add a plain XML comment to an XMLSchema
>> but I seems to be missing on how to do it. I seem not to be able to
>> locate a XMLComment or similar in the EMF representation.
>>
>> Could anyone point me in the right direktion?
>>
>> /anders
>
>
Re: Adding XML Comments to XML Schema? [message #61205 is a reply to message #61178] Thu, 26 May 2005 11:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

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

Anders,

Did you take note of this comment in the Javadoc:

// *NOTE*
// Working with the contents of an annotation requires dropping down into the DOM model.
// This imposes the additional requirement that the annotation must be |attached| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getSchema%28%29> to a schema.
// It also has the effect of calling |XSDConcreteComponent.updateElement()| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#updateElement%28%29>,
// if the schema does not have an |element| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getElement%28%29> or |document| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDSchema.html#getDocument%28%29> yet.

All manipulation of comments require direct manipulation of DOM and
having a DOM requires being attached to a schema. So most likely you've
not added your complex type to the contents of a schema.


user@domain.invalid wrote:

> Ed,
>
>
> Thanks for the examplas, unfortunately both appInfo and documentation
> returns null in my code when trying to creation annotations for
> ComplexTypeDef's.
>
> Element appinfo =
> annotation.createApplicationInformation("http://www.example.com/appinfo");
>
> Element documentation =
> annotation.createUserInformation("http://www.example.com/documentation");
>
>
> I also got a need to add plain XML comments <!-- commen --> to the
> schema. I managed to do this for the schema itself by callng
> updateElement() and the working on the resulting XML itslf
>
> thanks
> /anders
>
>
> Ed Merks wrote:
>
>> Anders,
>>
>> There is an example of pretty much everything in
>> XSPrototypicalSchema. Examples of how to create annotations are here:
>>
>>
>> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
>>
>>
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>
>>
>>
>>
>> user@domain.invalid wrote:
>>
>>> Hi,
>>>
>>> Ive been looking for a way to add a plain XML comment to an
>>> XMLSchema but I seems to be missing on how to do it. I seem not to
>>> be able to locate a XMLComment or similar in the EMF representation.
>>>
>>> Could anyone point me in the right direktion?
>>>
>>> /anders
>>
>>
>>


--------------090104000004090805070706
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">
Anders,<br>
<br>
Did you take note of this comment in the Javadoc:<br>
<pre> // <b>NOTE</b>
// Working with the contents of an annotation requires dropping down into the DOM model.
// This imposes the additional requirement that the annotation must be <a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getSchema%28%29"><code>attached</code></a> to a schema.
// It also has the effect of calling <a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#updateElement%28%29"><code>XSDConcreteComponent.updateElement()</code></a>,
// if the schema does not have an <a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getElement%28%29"><code>element</code></a> or <a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDSchema.html#getDocument%28%29"><code>document</code></a> yet.</pre>
All manipulation of comments require direct manipulation of DOM and
having a DOM requires being attached to a schema.&nbsp; So most likely
you've not added your complex type to the contents of a schema.<br>
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:user@domain.invalid">user@domain.invalid</a> wrote:
<blockquote cite="midd7435l$9bv$1@news.eclipse.org" type="cite">Ed,
<br>
<br>
<br>
Thanks for the examplas, unfortunately both appInfo and documentation
returns null in my code when trying to creation annotations for
ComplexTypeDef's.
<br>
<br>
&nbsp;Element appinfo =
annotation.createApplicationInformation(<a class="moz-txt-link-rfc2396E" href="http://www.example.com/appinfo">"http://www.example.com/appinfo"</a>);
<br>
&nbsp; Element documentation =
annotation.createUserInformation(<a class="moz-txt-link-rfc2396E" href="http://www.example.com/documentation">"http://www.example.com/documentation"</a>);
<br>
<br>
<br>
I also got a need to add plain XML comments&nbsp; &lt;!-- commen --&gt; to
the schema. I managed to do this for the schema itself by callng
updateElement() and the working on the resulting XML itslf
<br>
<br>
thanks
<br>
/anders
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Anders,
<br>
<br>
There is an example of pretty much everything in
XSPrototypicalSchema.&nbsp;&nbsp; Examples of how to create annotations are here:
<br>
<br>
&nbsp;&nbsp;&nbsp;
<a class="moz-txt-link-freetext" href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition("> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition(</a>)
<br>
&nbsp;&nbsp;&nbsp;
<a class="moz-txt-link-rfc2396E" href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29">&lt; http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29&gt;</a>
<br>
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:user@domain.invalid">user@domain.invalid</a> wrote:
<br>
<br>
<blockquote type="cite">Hi,
<br>
<br>
Ive been looking for a way to add a plain XML comment to an XMLSchema
but I seems to be missing on how to do it. I seem not to be able to
locate a XMLComment or similar in the EMF representation.
<br>
<br>
Could anyone point me in the right direktion?
<br>
<br>
/anders
<br>
</blockquote>
<br>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------090104000004090805070706--
Re: Adding XML Comments to XML Schema? [message #61227 is a reply to message #61205] Fri, 27 May 2005 09:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: user.domain.invalid

Hi Ed,

Many thanks, it now works , I changed the order of add() so adds are
done before creating the annotations.

The last piece of the puzzle is to figure out how to add a <!-- comment
--> before the root Element in the generated Schema.

thanks
/anders



Ed Merks wrote:

> Anders,
>
> Did you take note of this comment in the Javadoc:
>
> // *NOTE*
> // Working with the contents of an annotation requires dropping down into the DOM model.
> // This imposes the additional requirement that the annotation must be |attached| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getSchema%28%29> to a schema.
> // It also has the effect of calling |XSDConcreteComponent.updateElement()| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#updateElement%28%29>,
> // if the schema does not have an |element| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getElement%28%29> or |document| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDSchema.html#getDocument%28%29> yet.
>
> All manipulation of comments require direct manipulation of DOM and
> having a DOM requires being attached to a schema. So most likely you've
> not added your complex type to the contents of a schema.
>
>
> user@domain.invalid wrote:
>
>> Ed,
>>
>>
>> Thanks for the examplas, unfortunately both appInfo and documentation
>> returns null in my code when trying to creation annotations for
>> ComplexTypeDef's.
>>
>> Element appinfo =
>> annotation.createApplicationInformation("http://www.example.com/appinfo");
>>
>> Element documentation =
>> annotation.createUserInformation("http://www.example.com/documentation");
>>
>>
>> I also got a need to add plain XML comments <!-- commen --> to the
>> schema. I managed to do this for the schema itself by callng
>> updateElement() and the working on the resulting XML itslf
>>
>> thanks
>> /anders
>>
>>
>> Ed Merks wrote:
>>
>>> Anders,
>>>
>>> There is an example of pretty much everything in
>>> XSPrototypicalSchema. Examples of how to create annotations are here:
>>>
>>>
>>> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
>>>
>>>
>>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>
>>>
>>>
>>>
>>> user@domain.invalid wrote:
>>>
>>>> Hi,
>>>>
>>>> Ive been looking for a way to add a plain XML comment to an
>>>> XMLSchema but I seems to be missing on how to do it. I seem not to
>>>> be able to locate a XMLComment or similar in the EMF representation.
>>>>
>>>> Could anyone point me in the right direktion?
>>>>
>>>> /anders
>>>
>>>
>>>
>
Re: Adding XML Comments to XML Schema? [message #61251 is a reply to message #61227] Fri, 27 May 2005 12:05 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Anders,

I quickly tried a couple of things, but none of them worked:

org.w3c.dom.Document doc = xsdSchema.updateDocument();
//org.w3c.dom.Document doc = xsdSchema.getDocument();
// doc.insertBefore(doc.getDocumentElement(),
doc.createComment("comment"));
doc.appendChild(doc.createComment("comment"));

If you figure this DOM question out, please share your experience...


user@domain.invalid wrote:

> Hi Ed,
>
> Many thanks, it now works , I changed the order of add() so adds are
> done before creating the annotations.
>
> The last piece of the puzzle is to figure out how to add a <!--
> comment --> before the root Element in the generated Schema.
>
> thanks
> /anders
>
>
>
> Ed Merks wrote:
>
>> Anders,
>>
>> Did you take note of this comment in the Javadoc:
>>
>> // *NOTE*
>> // Working with the contents of an annotation requires dropping
>> down into the DOM model.
>> // This imposes the additional requirement that the annotation must
>> be |attached|
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getSchema%28%29>
>> to a schema.
>> // It also has the effect of calling
>> |XSDConcreteComponent.updateElement()|
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#updateElement%28%29>,
>>
>> // if the schema does not have an |element|
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getElement%28%29>
>> or |document|
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDSchema.html#getDocument%28%29>
>> yet.
>>
>> All manipulation of comments require direct manipulation of DOM and
>> having a DOM requires being attached to a schema. So most likely
>> you've not added your complex type to the contents of a schema.
>>
>>
>> user@domain.invalid wrote:
>>
>>> Ed,
>>>
>>>
>>> Thanks for the examplas, unfortunately both appInfo and
>>> documentation returns null in my code when trying to creation
>>> annotations for ComplexTypeDef's.
>>>
>>> Element appinfo =
>>> annotation.createApplicationInformation("http://www.example.com/appinfo");
>>>
>>> Element documentation =
>>> annotation.createUserInformation("http://www.example.com/documentation");
>>>
>>>
>>>
>>> I also got a need to add plain XML comments <!-- commen --> to the
>>> schema. I managed to do this for the schema itself by callng
>>> updateElement() and the working on the resulting XML itslf
>>>
>>> thanks
>>> /anders
>>>
>>>
>>> Ed Merks wrote:
>>>
>>>> Anders,
>>>>
>>>> There is an example of pretty much everything in
>>>> XSPrototypicalSchema. Examples of how to create annotations are
>>>> here:
>>>>
>>>>
>>>> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
>>>>
>>>>
>>>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>
>>>>
>>>>
>>>>
>>>> user@domain.invalid wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Ive been looking for a way to add a plain XML comment to an
>>>>> XMLSchema but I seems to be missing on how to do it. I seem not to
>>>>> be able to locate a XMLComment or similar in the EMF representation.
>>>>>
>>>>> Could anyone point me in the right direktion?
>>>>>
>>>>> /anders
>>>>
>>>>
>>>>
>>>>
>>
Re: Adding XML Comments to XML Schema? [message #595487 is a reply to message #61131] Wed, 25 May 2005 21:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020409070303050909000304
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anders,

There is an example of pretty much everything in XSPrototypicalSchema.
Examples of how to create annotations are here:

http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
< http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>


user@domain.invalid wrote:

> Hi,
>
> Ive been looking for a way to add a plain XML comment to an XMLSchema
> but I seems to be missing on how to do it. I seem not to be able to
> locate a XMLComment or similar in the EMF representation.
>
> Could anyone point me in the right direktion?
>
> /anders



--------------020409070303050909000304
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">
</head>
<body bgcolor="#ffffff" text="#000000">
Anders,<br>
<br>
There is an example of pretty much everything in
XSPrototypicalSchema.&nbsp;&nbsp; Examples of how to create annotations are here:<br>
<blockquote><a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29"> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()</a><br>
</blockquote>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:user@domain.invalid">user@domain.invalid</a> wrote:
<blockquote cite="midd720oq$u92$1@news.eclipse.org" type="cite">Hi,
<br>
<br>
Ive been looking for a way to add a plain XML comment to an XMLSchema
but I seems to be missing on how to do it. I seem not to be able to
locate a XMLComment or similar in the EMF representation.
<br>
<br>
Could anyone point me in the right direktion?
<br>
<br>
/anders
<br>
</blockquote>
<br>
</body>
</html>

--------------020409070303050909000304--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Adding XML Comments to XML Schema? [message #595497 is a reply to message #61154] Thu, 26 May 2005 08:56 Go to previous message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
Ed,


Thanks for the examplas, unfortunately both appInfo and documentation
returns null in my code when trying to creation annotations for
ComplexTypeDef's.

Element appinfo =
annotation.createApplicationInformation("http://www.example.com/appinfo");
Element documentation =
annotation.createUserInformation("http://www.example.com/documentation");


I also got a need to add plain XML comments <!-- commen --> to the
schema. I managed to do this for the schema itself by callng
updateElement() and the working on the resulting XML itslf

thanks
/anders


Ed Merks wrote:
> Anders,
>
> There is an example of pretty much everything in XSPrototypicalSchema.
> Examples of how to create annotations are here:
>
> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>
>
>
> user@domain.invalid wrote:
>
>> Hi,
>>
>> Ive been looking for a way to add a plain XML comment to an XMLSchema
>> but I seems to be missing on how to do it. I seem not to be able to
>> locate a XMLComment or similar in the EMF representation.
>>
>> Could anyone point me in the right direktion?
>>
>> /anders
>
>
Re: Adding XML Comments to XML Schema? [message #595506 is a reply to message #61178] Thu, 26 May 2005 11:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090104000004090805070706
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Anders,

Did you take note of this comment in the Javadoc:

// *NOTE*
// Working with the contents of an annotation requires dropping down into the DOM model.
// This imposes the additional requirement that the annotation must be |attached| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getSchema%28%29> to a schema.
// It also has the effect of calling |XSDConcreteComponent.updateElement()| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#updateElement%28%29>,
// if the schema does not have an |element| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getElement%28%29> or |document| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDSchema.html#getDocument%28%29> yet.

All manipulation of comments require direct manipulation of DOM and
having a DOM requires being attached to a schema. So most likely you've
not added your complex type to the contents of a schema.


user@domain.invalid wrote:

> Ed,
>
>
> Thanks for the examplas, unfortunately both appInfo and documentation
> returns null in my code when trying to creation annotations for
> ComplexTypeDef's.
>
> Element appinfo =
> annotation.createApplicationInformation("http://www.example.com/appinfo");
>
> Element documentation =
> annotation.createUserInformation("http://www.example.com/documentation");
>
>
> I also got a need to add plain XML comments <!-- commen --> to the
> schema. I managed to do this for the schema itself by callng
> updateElement() and the working on the resulting XML itslf
>
> thanks
> /anders
>
>
> Ed Merks wrote:
>
>> Anders,
>>
>> There is an example of pretty much everything in
>> XSPrototypicalSchema. Examples of how to create annotations are here:
>>
>>
>> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
>>
>>
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>
>>
>>
>>
>> user@domain.invalid wrote:
>>
>>> Hi,
>>>
>>> Ive been looking for a way to add a plain XML comment to an
>>> XMLSchema but I seems to be missing on how to do it. I seem not to
>>> be able to locate a XMLComment or similar in the EMF representation.
>>>
>>> Could anyone point me in the right direktion?
>>>
>>> /anders
>>
>>
>>


--------------090104000004090805070706
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">
Anders,<br>
<br>
Did you take note of this comment in the Javadoc:<br>
<pre> // <b>NOTE</b>
// Working with the contents of an annotation requires dropping down into the DOM model.
// This imposes the additional requirement that the annotation must be <a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getSchema%28%29"><code>attached</code></a> to a schema.
// It also has the effect of calling <a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#updateElement%28%29"><code>XSDConcreteComponent.updateElement()</code></a>,
// if the schema does not have an <a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getElement%28%29"><code>element</code></a> or <a
href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDSchema.html#getDocument%28%29"><code>document</code></a> yet.</pre>
All manipulation of comments require direct manipulation of DOM and
having a DOM requires being attached to a schema.&nbsp; So most likely
you've not added your complex type to the contents of a schema.<br>
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:user@domain.invalid">user@domain.invalid</a> wrote:
<blockquote cite="midd7435l$9bv$1@news.eclipse.org" type="cite">Ed,
<br>
<br>
<br>
Thanks for the examplas, unfortunately both appInfo and documentation
returns null in my code when trying to creation annotations for
ComplexTypeDef's.
<br>
<br>
&nbsp;Element appinfo =
annotation.createApplicationInformation(<a class="moz-txt-link-rfc2396E" href="http://www.example.com/appinfo">"http://www.example.com/appinfo"</a>);
<br>
&nbsp; Element documentation =
annotation.createUserInformation(<a class="moz-txt-link-rfc2396E" href="http://www.example.com/documentation">"http://www.example.com/documentation"</a>);
<br>
<br>
<br>
I also got a need to add plain XML comments&nbsp; &lt;!-- commen --&gt; to
the schema. I managed to do this for the schema itself by callng
updateElement() and the working on the resulting XML itslf
<br>
<br>
thanks
<br>
/anders
<br>
<br>
<br>
Ed Merks wrote:
<br>
<blockquote type="cite">Anders,
<br>
<br>
There is an example of pretty much everything in
XSPrototypicalSchema.&nbsp;&nbsp; Examples of how to create annotations are here:
<br>
<br>
&nbsp;&nbsp;&nbsp;
<a class="moz-txt-link-freetext" href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition("> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition(</a>)
<br>
&nbsp;&nbsp;&nbsp;
<a class="moz-txt-link-rfc2396E" href=" http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29">&lt; http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29&gt;</a>
<br>
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:user@domain.invalid">user@domain.invalid</a> wrote:
<br>
<br>
<blockquote type="cite">Hi,
<br>
<br>
Ive been looking for a way to add a plain XML comment to an XMLSchema
but I seems to be missing on how to do it. I seem not to be able to
locate a XMLComment or similar in the EMF representation.
<br>
<br>
Could anyone point me in the right direktion?
<br>
<br>
/anders
<br>
</blockquote>
<br>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>

--------------090104000004090805070706--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Adding XML Comments to XML Schema? [message #595516 is a reply to message #61205] Fri, 27 May 2005 09:13 Go to previous message
user is currently offline userFriend
Messages: 296
Registered: July 2009
Senior Member
Hi Ed,

Many thanks, it now works , I changed the order of add() so adds are
done before creating the annotations.

The last piece of the puzzle is to figure out how to add a <!-- comment
--> before the root Element in the generated Schema.

thanks
/anders



Ed Merks wrote:

> Anders,
>
> Did you take note of this comment in the Javadoc:
>
> // *NOTE*
> // Working with the contents of an annotation requires dropping down into the DOM model.
> // This imposes the additional requirement that the annotation must be |attached| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getSchema%28%29> to a schema.
> // It also has the effect of calling |XSDConcreteComponent.updateElement()| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#updateElement%28%29>,
> // if the schema does not have an |element| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getElement%28%29> or |document| < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDSchema.html#getDocument%28%29> yet.
>
> All manipulation of comments require direct manipulation of DOM and
> having a DOM requires being attached to a schema. So most likely you've
> not added your complex type to the contents of a schema.
>
>
> user@domain.invalid wrote:
>
>> Ed,
>>
>>
>> Thanks for the examplas, unfortunately both appInfo and documentation
>> returns null in my code when trying to creation annotations for
>> ComplexTypeDef's.
>>
>> Element appinfo =
>> annotation.createApplicationInformation("http://www.example.com/appinfo");
>>
>> Element documentation =
>> annotation.createUserInformation("http://www.example.com/documentation");
>>
>>
>> I also got a need to add plain XML comments <!-- commen --> to the
>> schema. I managed to do this for the schema itself by callng
>> updateElement() and the working on the resulting XML itslf
>>
>> thanks
>> /anders
>>
>>
>> Ed Merks wrote:
>>
>>> Anders,
>>>
>>> There is an example of pretty much everything in
>>> XSPrototypicalSchema. Examples of how to create annotations are here:
>>>
>>>
>>> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
>>>
>>>
>>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>
>>>
>>>
>>>
>>> user@domain.invalid wrote:
>>>
>>>> Hi,
>>>>
>>>> Ive been looking for a way to add a plain XML comment to an
>>>> XMLSchema but I seems to be missing on how to do it. I seem not to
>>>> be able to locate a XMLComment or similar in the EMF representation.
>>>>
>>>> Could anyone point me in the right direktion?
>>>>
>>>> /anders
>>>
>>>
>>>
>
Re: Adding XML Comments to XML Schema? [message #595524 is a reply to message #61227] Fri, 27 May 2005 12:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Anders,

I quickly tried a couple of things, but none of them worked:

org.w3c.dom.Document doc = xsdSchema.updateDocument();
//org.w3c.dom.Document doc = xsdSchema.getDocument();
// doc.insertBefore(doc.getDocumentElement(),
doc.createComment("comment"));
doc.appendChild(doc.createComment("comment"));

If you figure this DOM question out, please share your experience...


user@domain.invalid wrote:

> Hi Ed,
>
> Many thanks, it now works , I changed the order of add() so adds are
> done before creating the annotations.
>
> The last piece of the puzzle is to figure out how to add a <!--
> comment --> before the root Element in the generated Schema.
>
> thanks
> /anders
>
>
>
> Ed Merks wrote:
>
>> Anders,
>>
>> Did you take note of this comment in the Javadoc:
>>
>> // *NOTE*
>> // Working with the contents of an annotation requires dropping
>> down into the DOM model.
>> // This imposes the additional requirement that the annotation must
>> be |attached|
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getSchema%28%29>
>> to a schema.
>> // It also has the effect of calling
>> |XSDConcreteComponent.updateElement()|
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#updateElement%28%29>,
>>
>> // if the schema does not have an |element|
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDConcreteComponent.html#getElement%28%29>
>> or |document|
>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/XSDSchema.html#getDocument%28%29>
>> yet.
>>
>> All manipulation of comments require direct manipulation of DOM and
>> having a DOM requires being attached to a schema. So most likely
>> you've not added your complex type to the contents of a schema.
>>
>>
>> user@domain.invalid wrote:
>>
>>> Ed,
>>>
>>>
>>> Thanks for the examplas, unfortunately both appInfo and
>>> documentation returns null in my code when trying to creation
>>> annotations for ComplexTypeDef's.
>>>
>>> Element appinfo =
>>> annotation.createApplicationInformation("http://www.example.com/appinfo");
>>>
>>> Element documentation =
>>> annotation.createUserInformation("http://www.example.com/documentation");
>>>
>>>
>>>
>>> I also got a need to add plain XML comments <!-- commen --> to the
>>> schema. I managed to do this for the schema itself by callng
>>> updateElement() and the working on the resulting XML itslf
>>>
>>> thanks
>>> /anders
>>>
>>>
>>> Ed Merks wrote:
>>>
>>>> Anders,
>>>>
>>>> There is an example of pretty much everything in
>>>> XSPrototypicalSchema. Examples of how to create annotations are
>>>> here:
>>>>
>>>>
>>>> http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition()
>>>>
>>>>
>>>> < http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29>
>>>>
>>>>
>>>>
>>>> user@domain.invalid wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Ive been looking for a way to add a plain XML comment to an
>>>>> XMLSchema but I seems to be missing on how to do it. I seem not to
>>>>> be able to locate a XMLComment or similar in the EMF representation.
>>>>>
>>>>> Could anyone point me in the right direktion?
>>>>>
>>>>> /anders
>>>>
>>>>
>>>>
>>>>
>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Adding XML Comments to XML Schema?
Next Topic:Creating complexType with simpleContent
Goto Forum:
  


Current Time: Thu Mar 28 10:01:53 GMT 2024

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

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

Back to the top