6239 ]]]]]] |
6239 ]]]]]] |
6240 ]. |
6240 ]. |
6241 ! |
6241 ! |
6242 |
6242 |
6243 printXmlTextQuotedOn:aStream |
6243 printXmlTextQuotedOn:aStream |
|
6244 <resource: #todo> |
6244 "convert aString to a valid XML string |
6245 "convert aString to a valid XML string |
6245 that can be used for XML text. |
6246 that can be used for XML text. |
6246 Here line formatting characters are not escaped. |
6247 Here line formatting characters are not escaped. |
6247 TODO: care for 16bit UNICODE string and escape chars ..." |
6248 TODO: care for 16bit UNICODE string and escape chars ... |
|
6249 TODO: check why apos and quot are not generated here" |
6248 |
6250 |
6249 self do:[:eachChar | |
6251 self do:[:eachChar | |
6250 eachChar == $< ifTrue:[ |
6252 eachChar == $< ifTrue:[ |
6251 aStream nextPutAll:'<' "mapping needed for xml text" |
6253 aStream nextPutAll:'<' "mapping needed for xml text" |
6252 ] ifFalse:[ eachChar == $& ifTrue:[ |
6254 ] ifFalse:[ eachChar == $& ifTrue:[ |
6253 aStream nextPutAll:'&' "mapping needed for all" |
6255 aStream nextPutAll:'&' "mapping needed for all" |
6254 "/ ] ifFalse:[ eachChar == $> ifTrue:[ |
6256 ] ifFalse:[ eachChar == $> ifTrue:[ |
6255 "/ aStream nextPutAll:'>' "mapping needed for comments" |
6257 aStream nextPutAll:'>' "mapping needed for comments" |
6256 "/ ] ifFalse:[ eachChar == $' ifTrue:[ |
6258 "/ ] ifFalse:[ eachChar == $' ifTrue:[ |
6257 "/ aStream nextPutAll:''' "mapping needed for attributes" |
6259 "/ aStream nextPutAll:''' "mapping needed for attributes" |
6258 "/ ] ifFalse:[ eachChar == $" ifTrue:[ |
6260 "/ ] ifFalse:[ eachChar == $" ifTrue:[ |
6259 "/ aStream nextPutAll:'"' "mapping needed for attributes" |
6261 "/ aStream nextPutAll:'"' "mapping needed for attributes" |
6260 ] ifFalse:[ |
6262 ] ifFalse:[ |
6261 |codePoint| |
6263 |codePoint| |
6262 codePoint := eachChar codePoint. |
6264 codePoint := eachChar codePoint. |
6263 ((codePoint < 16r20 and:[codePoint ~~ 9 and:[codePoint ~~ 10 and:[codePoint ~~ 13]]]) |
6265 ((codePoint < 16r20 and:[codePoint ~~ 9 and:[codePoint ~~ 10 and:[codePoint ~~ 13]]]) |
6264 or:[codePoint >= 16r7F]) ifTrue:[ |
6266 or:[codePoint >= 16r7F]) ifTrue:[ |
6265 aStream nextPutAll:'&#'. |
6267 aStream nextPutAll:'&#'. |
6266 codePoint printOn:aStream. |
6268 codePoint printOn:aStream base:16. |
6267 aStream nextPut:$;. |
6269 aStream nextPut:$;. |
6268 ] ifFalse:[ |
6270 ] ifFalse:[ |
6269 aStream nextPut:eachChar |
6271 aStream nextPut:eachChar |
6270 ]]]"/]]] |
6272 ]]]]"/]] |
6271 ]. |
6273 ]. |
|
6274 |
|
6275 " |
|
6276 String streamContents:[:s|'< & >' printXmlTextQuotedOn:s] |
|
6277 String streamContents:[:s|'< & >',(Character value:7) printXmlTextQuotedOn:s] |
|
6278 String streamContents:[:s|'< & >',(Character value:129) printXmlTextQuotedOn:s] |
|
6279 String streamContents:[:s|'< & >',(Character value:1000) printXmlTextQuotedOn:s] |
|
6280 " |
|
6281 |
|
6282 "Modified (comment): / 22-08-2018 / 09:00:40 / Claus Gittinger" |
6272 ! |
6283 ! |
6273 |
6284 |
6274 xmlQuotedPrintString |
6285 xmlQuotedPrintString |
6275 "convert aString to a valid XML string |
6286 "convert aString to a valid XML string |
6276 that can be used for attributes, text, comments an PIs" |
6287 that can be used for attributes, text, comments an PIs" |
6419 Here, by default, we assume unicode-encoding. |
6430 Here, by default, we assume unicode-encoding. |
6420 Notice, that ISO-8859-1 is a true subset of unicode, |
6431 Notice, that ISO-8859-1 is a true subset of unicode, |
6421 and that singleByteStrings are therefore both unicode AND |
6432 and that singleByteStrings are therefore both unicode AND |
6422 8859-1 encoded." |
6433 8859-1 encoded." |
6423 |
6434 |
6424 ^ #unicode |
6435 ^ #'iso10646-1'. |
|
6436 "/ ^ #unicode |
|
6437 |
|
6438 "Modified: / 22-08-2018 / 09:30:16 / Claus Gittinger" |
6425 ! |
6439 ! |
6426 |
6440 |
6427 hasChangeOfEmphasis |
6441 hasChangeOfEmphasis |
6428 "return true, if the receiver contains non-empty emphasis information |
6442 "return true, if the receiver contains non-empty emphasis information |
6429 i.e. any non-normal (=emphasized) characters" |
6443 i.e. any non-normal (=emphasized) characters" |