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 |
Eclipse User |
|
|
|
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 #61205 is a reply to message #61178] |
Thu, 26 May 2005 11:34 |
Eclipse User |
|
|
|
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. 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>
Element appinfo =
annotation.createApplicationInformation(<a class="moz-txt-link-rfc2396E" href="http://www.example.com/appinfo">"http://www.example.com/appinfo"</a>);
<br>
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 <!-- commen --> 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. Examples of how to create annotations are here:
<br>
<br>
<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>
<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">< http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29></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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 #595506 is a reply to message #61178] |
Thu, 26 May 2005 11:34 |
Ed Merks Messages: 33252 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. 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>
Element appinfo =
annotation.createApplicationInformation(<a class="moz-txt-link-rfc2396E" href="http://www.example.com/appinfo">"http://www.example.com/appinfo"</a>);
<br>
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 <!-- commen --> 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. Examples of how to create annotations are here:
<br>
<br>
<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>
<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">< http://download.eclipse.org/tools/emf/xsd/javadoc/org/eclips e/xsd/util/XSDPrototypicalSchema.html#initializeSimpleRecurs iveComplexTypeDefinition%28%29></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 |
user 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 |
Ed Merks Messages: 33252 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/
|
|
|
Goto Forum:
Current Time: Fri Nov 08 22:53:49 GMT 2024
Powered by FUDForum. Page generated in 0.03860 seconds
|