-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
Extension { #name : #XMLElement } | ||
|
||
{ #category : #'*XML-Parser-Tools' } | ||
XMLElement >> inspectAttributesIn: specBuilder [ | ||
<inspectorPresentationOrder: 30 title: 'Attributes'> | ||
|
||
| builder table | | ||
builder := (StSimpleInspectorBuilder on: specBuilder). | ||
|
||
self attributes keysAndValuesDo: [:key :value | | ||
builder key: key value: value | ||
]. | ||
table := builder table. | ||
table columns first title: #'Name'. | ||
table columns second title: #'Value'. | ||
^ table | ||
|
||
|
||
|
||
] | ||
|
||
{ #category : #'*XML-Parser-Tools' } | ||
XMLElement >> inspectTreeIn: specBuilder [ | ||
<inspectorPresentationOrder: 28 title: 'Tree'> | ||
|
||
^ specBuilder newTree | ||
roots: (Array with: self); | ||
display: [ :aNode | | ||
self inspectorTreeStringFor: aNode | ||
]; | ||
" displayIcon: [ :aNode | aNode iconName ifNotNil: [ :aName | self iconNamed: aName ] ];" | ||
children: [ :aNode | aNode descendantElements ] | ||
|
||
|
||
] | ||
|
||
{ #category : #'*XML-Parser-Tools' } | ||
XMLElement >> inspectorTreeStringFor: anXMLElement [ | ||
| display | | ||
display := String streamContents: [:s| | ||
s nextPutAll: anXMLElement name. | ||
anXMLElement hasAttributes ifTrue: [ | ||
s space. | ||
anXMLElement attributes associations do: [:association | | ||
s | ||
nextPutAll: association key; | ||
nextPutAll: '="'; | ||
nextPutAll: association value; | ||
nextPutAll: '"'. | ||
] separatedBy: [ s space ] | ||
] | ||
]. | ||
anXMLElement descendantElements isEmpty ifFalse: [ ^ '<',display, '>' ]. | ||
^ anXMLElement asString | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : #'XML-Parser-Tools' } |