-
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
58 changed files
with
6,421 additions
and
6,364 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
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
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 |
---|---|---|
|
@@ -90,33 +90,36 @@ SAX2ElementHandlerParserTest >> testParsingSamplePerson [ | |
|
||
| person rootFactory personFactory contactsFactory factoryMapper | | ||
rootFactory := SAX2PluggableElementHandlerFactory new | ||
handleElement: 'person' | ||
withClass: SAX2HPersonElementHandler. | ||
handleElement: 'person' | ||
withClass: SAX2HPersonElementHandler. | ||
personFactory := SAX2PluggableElementHandlerFactory new | ||
handleElement: 'name' withClass: SAX2HNameElementHandler; | ||
handleElement: 'date-of-birth' | ||
withClass: SAX2HDateOfBirthElementHandler; | ||
handleElement: 'contacts' withClass: SAX2HContactsElementHandler; | ||
handleElement: 'residence' withClass: SAX2HResidenceElementHandler. | ||
handleElement: 'name' | ||
withClass: SAX2HNameElementHandler; | ||
handleElement: 'date-of-birth' | ||
withClass: SAX2HDateOfBirthElementHandler; | ||
handleElement: 'contacts' | ||
withClass: SAX2HContactsElementHandler; | ||
handleElement: 'residence' | ||
withClass: SAX2HResidenceElementHandler. | ||
contactsFactory := SAX2PluggableElementHandlerFactory new | ||
handleElement: 'email' | ||
withClass: SAX2HEmailElementHandler. | ||
handleElement: 'email' | ||
withClass: SAX2HEmailElementHandler. | ||
factoryMapper := SAX2PluggableElementHandlerFactoryMapper new | ||
mapElementHandlerClass: SAX2HPersonElementHandler | ||
toFactory: personFactory; | ||
mapElementHandlerClass: SAX2HContactsElementHandler | ||
toFactory: contactsFactory. | ||
mapElementHandlerClass: SAX2HPersonElementHandler | ||
toFactory: personFactory; | ||
mapElementHandlerClass: SAX2HContactsElementHandler | ||
toFactory: contactsFactory. | ||
person := (SAX2ElementParser on: self samplePersonXML) | ||
elementHandlerFactory: rootFactory; | ||
elementHandlerFactoryMapper: factoryMapper; | ||
parseDocument. | ||
elementHandlerFactory: rootFactory; | ||
elementHandlerFactoryMapper: factoryMapper; | ||
parseDocument. | ||
self | ||
assert: person class == SAX2SamplePerson; | ||
assert: person class identicalTo: SAX2SamplePerson; | ||
assert: person name equals: 'Tim Bray'; | ||
assert: person dateOfBirth | ||
equals: (Date year: 1955 month: 6 day: 21); | ||
equals: (Date year: 1955 month: 6 day: 21); | ||
assert: person emailAddresses asArray | ||
equals: #('[email protected]' '[email protected]'); | ||
equals: #( '[email protected]' '[email protected]' ); | ||
assert: person residence | ||
equals: 'Vancouver, British Columbia, Canada' | ||
equals: 'Vancouver, British Columbia, Canada' | ||
] |
Oops, something went wrong.