Richard,
thanks for your suggestions and time.
|test parser dom dbString |
test := '<?xml version="1.0" encoding="UTF-8"?><test>Text with an xml entity: –</test></xml>'.
parser := AbtXmlDOMParser newNonValidatingParser decodingEnabled: false .
dom := parser parse: test.
dbString := (dom getElementsByTagName: 'test') first contents first abrAsString.
(Utf8View on: dbString)
gives me a primitive failed on VAST 12.0. So your first idea deosn't work.
I also played with your second idea, ot sounds extremely logical. but so far I haven't succeeded.
This is where I currently am:
|test parser dom dbString charArray |
test := '<?xml version="1.0" encoding="UTF-8"?><test>Text with an xml entity: –</test></xml>'.
parser := AbtXmlDOMParser newNonValidatingParser decodingEnabled: false .
dom := parser parse: test.
dbString := (dom getElementsByTagName: 'test') first contents first abrAsString.
charArray := dbString asArray.
Utf8View on: charArray. "--> Primitve failed in: UnicodeView>>#primInitializeOn:immutable: "
charArray := dbString asUtf8 "--> DBString does not understand asUtf8"
utf8String := charArray collect: [:dbChar| dbChar asGrapheme]. "--> Index out of range in Charater>>asGrapheme"
So, unfortunately, to me it seems like AbtXmlDOMParser leads to a dead end because a DBString is a dumb dead end...?
I think it shouldn't give me a DBString at all, but a String in UTF-8 codepage (or a real Utf8String . But I guess I am just too stupid to use it properly.
Joachim