Skip to content

Commit

Permalink
Simplify document roots and fix tree
Browse files Browse the repository at this point in the history
  • Loading branch information
astares committed Oct 22, 2024
1 parent bd54c0a commit f8619c6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/XML-Parser-Tools/XMLDocument.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : 'XMLDocument' }

{ #category : '*XML-Parser-Tools' }
XMLDocument >> inspectorRoots [

^ Array with: self root
]
12 changes: 10 additions & 2 deletions src/XML-Parser-Tools/XMLNode.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,27 @@ XMLNode >> inspectTreeIn: specBuilder [
<inspectorPresentationOrder: 28 title: 'Tree'>

| roots |
roots := self isDocument ifTrue: [ (Array with: self root) ] ifFalse: [ (Array with: self) ].

roots := self inspectorRoots.
^ specBuilder newTree
roots: roots;
display: [ :aNode |
self inspectorTreeStringFor: aNode
];
" displayIcon: [ :aNode | aNode iconName ifNotNil: [ :aName | self iconNamed: aName ] ];"
children: [ :aNode |
aNode isContentNode ifFalse: [ aNode descendantElements ] ifTrue: [ #() ]]

aNode hasChildren ifTrue: [ aNode descendantElements ] ifFalse: [ #() ]]


]

{ #category : '*XML-Parser-Tools' }
XMLNode >> inspectorRoots [

^ Array with: self
]

{ #category : '*XML-Parser-Tools' }
XMLNode >> inspectorTreeStringFor: anXMLElement [
| display |
Expand Down

0 comments on commit f8619c6

Please sign in to comment.