core/trunk/XML__Comment.st
changeset 3 7909b6680107
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/trunk/XML__Comment.st	Thu Apr 10 09:14:47 2008 +0000
@@ -0,0 +1,91 @@
+"{ Package: 'stx:goodies/xmlsuite/core' }"
+
+"{ NameSpace: XML }"
+
+Node subclass:#Comment
+	instanceVariableNames:'text'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'XML-VW-Nodes'
+!
+
+Comment comment:'This class represents an XML comment. XML comments may appear anywhere in an XML document outside other markup or within the document type declaration at places allowed by grammar.
+
+ XML comments are delimited by the start-tag ''<!!--'' and the end-tag ''-->''. 
+
+According to the XML 1.0 specification, for compatibilty, double-hyphens (the string ''--'') must not occur within comments.
+
+Instance Variables:
+	text    <String>  contents of the comment element
+'
+!
+
+
+!Comment methodsFor:'accessing'!
+
+text
+
+	^text
+!
+
+text: aText
+
+	text := aText
+!
+
+xPath
+    ^ parent xPath
+
+    "Created: / 23-04-2005 / 23:15:32 / janfrog"
+! !
+
+!Comment methodsFor:'printing'!
+
+prettyPrintOn: aStream depth: indent
+
+        aStream nextPutAll: '<!!--', (text == nil ifTrue: [''] ifFalse: [text]), '-->'
+!
+
+printCanonicalOn: aStream
+
+	^self
+!
+
+printHTMLOn: aStream
+
+        self prettyPrintOn: aStream
+!
+
+printNoIndentOn: aStream endSpacing: endSpacingBlock spacing: spacingBlock
+
+        ^self prettyPrintOn: aStream
+!
+
+printOn: aStream
+
+        aStream nextPutAll: '<!!--', (text == nil ifTrue: [''] ifFalse: [text]), '-->'
+! !
+
+!Comment methodsFor:'testing'!
+
+isComment
+
+	^true
+! !
+
+!Comment methodsFor:'visiting'!
+
+acceptVisitor:aVisitor 
+    "Double dispatch back to the visitor, passing my type encoded in
+     the selector (visitor pattern)"
+
+    "stub code automatically generated - please change if required"
+
+    ^ aVisitor visitComment:self
+! !
+
+!Comment class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/goodies/xml/vw/Comment.st,v 1.9 2003/08/04 13:07:53 james Exp $'
+! !