Re: Managing "comments" in XML documents like any other XML content

Subject: Re: Managing "comments" in XML documents like any other XML content
From: Sean Wheller <seanwhe -at- yahoo -dot- com>
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Thu, 13 Nov 2003 00:15:31 -0800 (PST)


--- Scott Abel <abelsp -at- netdirect -dot- net> wrote:
>
> I'm trying to make the case for treating code
> 'comments' written in XML
> documents as content. That is, I want to tag
> comments with a <comment>
> element instead of "commenting it out" using the
> SGML comments notation
> <!--comment goes here--!>.

Hi Scott,

Interesting question.

I assume you are using DTD's and not XML Schema. If
you are using XML Schema then please refer to the
message from Isaac and his pointer to the W3 rec.

SGML comments certainly have their +'s and -'s. One
way that you can manage them is to write an XSL that
will make a copy of the comments. You can refer to
them using the comment(). This is great if you just
want to collect the comments, but it has the drawback
of putting them out of context to the text which is
being annotated in the original document.


Another way is to extend your DTD using a custom mod.
This can then be included in your DTD external subset.
Your mod should define the element you want to use for
comments e.g. <comment>.

Best to decide whether it will be a block or inline
element and stick to one method.

You can then use XPATH to collect all comments e.g.
//comment

Naturally your xsl's will not know what to do with the
comment element, so you may want to include a template
for comment in your xsl's or custom layer if you want
to output comments in drafts. Create a param to toggle
output ON/OFF <xsl:param name="comments" select="1"/>,
if set to 0 then comments are off. Your xsl should
test for this condition.

The other problem is knowing who wrote what comment.
We just use a convention. That is a comment would look
like this
<!-- SEAN: Something to say. JOHN: Something to
answer. SEAN: Lets see what PETER thinks -->

Hope this helps.

Sean Wheller

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ROBOHELP FOR FRAMEMAKER TRIAL NOW AVAILABLE!

RoboHelp for FrameMaker is a NEW online publishing tool for FrameMaker that
lets you easily single-source content to online Help, intranet, and Web.
The interface is designed for FrameMaker users, so there is little or no
learning curve and no macro language required! Call 800-718-4407 for
competitive pricing or download a trial at: http://www.ehelp.com/techwr-l4

---
You are currently subscribed to techwr-l as:
archive -at- raycomm -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- raycomm -dot- com
Send administrative questions to ejray -at- raycomm -dot- com -dot- Visit
http://www.raycomm.com/techwhirl/ for more resources and info.



References:
Managing "comments" in XML documents like any other XML content: From: Scott Abel

Previous by Author: Re: More on Technical Writing in India
Next by Author: RE: .NET XML documentation tool
Previous by Thread: Managing "comments" in XML documents like any other XML content
Next by Thread: Re: Managing "comments" in XML documents like any other XML content


What this post helpful? Share it with friends and colleagues:


Sponsored Ads