|
6 | 6 | REBOL [
|
7 | 7 | Title: "A more XML 1.0 compliant set of XML parsing tools."
|
8 | 8 | File: %codec-xml.r
|
9 |
| - Date: 19-Nov-2018 |
10 |
| - Version: 0.8.0 |
| 9 | + Date: 24-Apr-2020 |
| 10 | + Version: 0.8.1 |
11 | 11 | Author: ["Gavin F. McKenzie" "Oldes"]
|
12 | 12 | Email: %brianwisti--yahoo--com
|
13 | 13 | Purpose: {
|
@@ -137,6 +137,7 @@ REBOL [
|
137 | 137 | @@TBD: say more here
|
138 | 138 | }
|
139 | 139 | History: [
|
| 140 | + 0.8.1 { Oldes: fixed Prolog parsing in some cases} |
140 | 141 | 0.8.0 { Oldes: used original script as a Rebol3 codec}
|
141 | 142 | 0.7.6 { Version from 1-jul-2009 downloaded from rebol.org}
|
142 | 143 | 0.7.4 { Fixed a defect to allow optional space around
|
@@ -374,26 +375,14 @@ register-codec [
|
374 | 375 | ;
|
375 | 376 | block-handler: make xml-parse-handler [
|
376 | 377 | xml-doc: copy []
|
377 |
| - xml-block: copy [] |
| 378 | + xml-block: none |
378 | 379 | xml-content: copy ""
|
379 | 380 |
|
380 |
| - start-document: func [ |
381 |
| - ][ |
| 381 | + start-document: does [ |
382 | 382 | ;
|
383 | 383 | ; Seed the document
|
384 | 384 | ;
|
385 |
| - xml-block: reduce copy/deep [ |
386 |
| - 'document [ |
387 |
| - version none |
388 |
| - encoding none |
389 |
| - standalone none |
390 |
| - doctype none |
391 |
| - pubid none |
392 |
| - sysid none |
393 |
| - subset none |
394 |
| - ] |
395 |
| - none |
396 |
| - ] |
| 385 | + xml-block: reduce ['document copy #() none] |
397 | 386 | ]
|
398 | 387 | xml-decl: func [
|
399 | 388 | version-info [string! none!]
|
@@ -821,15 +810,12 @@ register-codec [
|
821 | 810 | any xmlMisc
|
822 | 811 | opt [xmlDocTypeDecl any xmlMisc]
|
823 | 812 | ]
|
824 |
| - xmlDocTypeDecl: [ "<!DOCTYPE" |
825 |
| - xmlS |
| 813 | + xmlDocTypeDecl: [ (public-id: system-id: internal-subset: none) |
| 814 | + "<!DOCTYPE" xmlS |
826 | 815 | copy document-type xmlName
|
827 | 816 | opt [xmlS xmlExternalID]
|
828 | 817 | any xmlSpace
|
829 |
| - "[" |
830 |
| - copy internal-subset |
831 |
| - to "]" |
832 |
| - "]" |
| 818 | + opt [#"[" copy internal-subset to #"]" 1 skip] ;@@ this can be unsafe! |
833 | 819 | any xmlSpace ">"
|
834 | 820 | (handler/document-type
|
835 | 821 | document-type
|
@@ -907,16 +893,14 @@ register-codec [
|
907 | 893 | ]
|
908 | 894 | )
|
909 | 895 | ]
|
910 |
| - xmlExternalID: [ ["SYSTEM" xmlSpace xmlSystemLiteral] | |
911 |
| - ["PUBLIC" xmlSpace xmlPubIDLiteral |
912 |
| - xmlSpace xmlSystemLiteral |
913 |
| - ] |
| 896 | + xmlExternalID: [ ["SYSTEM" xmlS xmlSystemLiteral] | |
| 897 | + ["PUBLIC" xmlS xmlPubIDLiteral xmlS xmlSystemLiteral] |
914 | 898 | ]
|
915 |
| - xmlSystemLiteral: [ [#"^"" copy system-id to #"^"" #"^""] | |
916 |
| - [#"'" copy system-id to #"'" #"'"] |
| 899 | + xmlSystemLiteral: [ [#"^"" copy system-id to #"^"" 1 skip] | |
| 900 | + [#"'" copy system-id to #"'" 1 skip] |
917 | 901 | ]
|
918 |
| - xmlPubIDLiteral: [ [#"^"" copy public-id to #"^"" #"^""] | |
919 |
| - [#"'" copy public-id to #"'" #"'"] |
| 902 | + xmlPubIDLiteral: [ [#"^"" copy public-id to #"^"" 1 skip] | |
| 903 | + [#"'" copy public-id to #"'" 1 skip] |
920 | 904 | ]
|
921 | 905 | xmlNDataDecl: [xmlS "NDATA" xmlS xmlNameProd]
|
922 | 906 | xmlCDSect: [ "<![CDATA["
|
@@ -1008,13 +992,9 @@ register-codec [
|
1008 | 992 | "apos" [ return #"'" ]
|
1009 | 993 | ][
|
1010 | 994 | either (first entity-ref) = #"#" [
|
1011 |
| - either (second entity-ref) = #"x" [ |
1012 |
| - to char! to integer! to issue! |
1013 |
| - skip entity-ref 2 |
1014 |
| - ][ |
1015 |
| - to char! to integer! |
1016 |
| - skip entity-ref 1 |
1017 |
| - ] |
| 995 | + to char! to integer! either (second entity-ref) = #"x" [ |
| 996 | + to issue! skip entity-ref 2 |
| 997 | + ][ skip entity-ref 1 ] |
1018 | 998 | ][
|
1019 | 999 | none
|
1020 | 1000 | ]
|
|
0 commit comments