Hi!
I've found a little bug in XMLParser and fixed it, but I haven't found any
issue tracker for the project, so I don't know where should I submit it.
The bug occurs when the parsed page has the xml:lang property set to empty,
in which case (anAttributeDictionary at: 'xml:lang') fails. So here's what I
did:
SAXHandler >> handleStartTag: anElementName attributes:
anAttributeDictionary namespaces: aNamespaceDictionary
| prefix localName namespaceUri |
self elementNester startedElement: anElementName.
(anAttributeDictionary includesKey: 'xml:lang')
ifTrue: [ self languageEnvironment: ((anAttributeDictionary at:
'xml:lang') ifEmpty: [ Latin1Environment defaultEncodingName ]) ]. " ← here
"
anElementName
splitQualifiedNameInto: [ :prefixPart :localPart |
prefix := prefixPart.
localName := localPart.
namespaceUri := '' ].
self usesNamespaces
ifTrue: [
self scopeAllocator enterScope.
self declareNamespaces: aNamespaceDictionary.
namespaceUri := self scopeAllocator resolvePrefix:
prefix.
self validateStartTag: anElementName prefix: prefix
attributes:
anAttributeDictionary ].
self saxHandler
startElement: anElementName
prefix: prefix
uri: namespaceUri
localName: localName
attributes: anAttributeDictionary
Cheers!
--
View this message in context:
http://forum.world.st/XMLParser-tiny-bug-tp4506051p4506051.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.