[squeak-dev] The Trunk: XML-Parser-ar.32.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Aug 10 20:25:52 UTC 2010


Andreas Raab uploaded a new version of XML-Parser to project The Trunk:
http://source.squeak.org/trunk/XML-Parser-ar.32.mcz

==================== Summary ====================

Name: XML-Parser-ar.32
Author: ar
Time: 10 August 2010, 1:25:41.615 pm
UUID: 00d928a6-ebba-104d-a598-b96b4445f2e7
Ancestors: XML-Parser-mtf.30

Fix printing of XMLElements; add tests for behavior.

=============== Diff against XML-Parser-mtf.30 ===============

Item was added:
+ ----- Method: XMLParserTest>>testPrintElements (in category 'tests') -----
+ testPrintElements
+ 	| node |
+ 	node:= (XMLElement new) name: 'foo';
+ 		setAttributes: (Dictionary new);
+ 		yourself.
+ 	self assert: node asString withBlanksTrimmed = '<foo/>'.
+ 
+ 	node:= (XMLElement new) name: 'foo';
+ 		setAttributes: (Dictionary newFromPairs: {'id'. '123'});
+ 		yourself.
+ 	self assert: node asString withBlanksTrimmed = '<foo id="123"/>'.
+ 
+ 	node:= (XMLElement new) name: 'foo';
+ 		addContent: (XMLStringNode string: 'Hello World'); 
+ 		setAttributes: (Dictionary new);
+ 		yourself.
+ 	self assert: node asString withBlanksTrimmed = '<foo>Hello World</foo>'.
+ 
+ 	node:= (XMLElement new) name: 'foo';
+ 		addContent: (XMLStringNode string: 'Hello World'); 
+ 		setAttributes: (Dictionary newFromPairs: {'id'. '123'});
+ 		yourself.
+ 	self assert: node asString withBlanksTrimmed = '<foo id="123">Hello World</foo>'.
+ 
+ !

Item was changed:
  ----- Method: XMLElement>>isEmpty (in category 'testing') -----
  isEmpty
+ 	"Answer true if the receiver is empty"
+ 
+ 	^self elementsAndContents isEmpty!
- 	^self elements isEmpty!

Item was changed:
  ----- Method: XMLElement>>printXMLOn: (in category 'printing') -----
  printXMLOn: writer
+ 	"Print the receiver in XML form"
+ 
  	writer startElement: self name attributeList: self attributes.
  	(writer canonical not
+ 		and: [self isEmpty])
- 		and: [self isEmpty and: [self attributes isEmpty not]])
  		ifTrue: [writer endEmptyTag: self name]
  		ifFalse: [
  			writer endTag.
  			self elementsAndContentsDo: [:content | content printXMLOn: writer].
  			writer endTag: self name]!




More information about the Squeak-dev mailing list