src/Pure/General/xml.ML
changeset 40627 becf5d5187cc
parent 40131 7cbebd636e79
child 43767 e0219ef7f84c
equal deleted inserted replaced
40626:d86540f6ea0d 40627:becf5d5187cc
   156 in
   156 in
   157 
   157 
   158 val parse_comments =
   158 val parse_comments =
   159   blanks -- Scan.repeat (parse_comment -- blanks >> K ()) >> K ();
   159   blanks -- Scan.repeat (parse_comment -- blanks >> K ()) >> K ();
   160 
   160 
   161 val parse_string = Scan.read Symbol.stopper parse_chars o explode;
   161 val parse_string = Scan.read Symbol.stopper parse_chars o raw_explode;
   162 
   162 
   163 fun parse_content xs =
   163 fun parse_content xs =
   164   (parse_optional_text @@@
   164   (parse_optional_text @@@
   165     (Scan.repeat
   165     (Scan.repeat
   166       ((parse_element >> single ||
   166       ((parse_element >> single ||
   182   (Scan.repeat parse_misc -- Scan.option parse_doctype -- Scan.repeat parse_misc)
   182   (Scan.repeat parse_misc -- Scan.option parse_doctype -- Scan.repeat parse_misc)
   183   |-- parse_element;
   183   |-- parse_element;
   184 
   184 
   185 fun parse s =
   185 fun parse s =
   186   (case Scan.finite Symbol.stopper (Scan.error (!! (err "Malformed element")
   186   (case Scan.finite Symbol.stopper (Scan.error (!! (err "Malformed element")
   187       (blanks |-- parse_document --| blanks))) (explode s) of
   187       (blanks |-- parse_document --| blanks))) (raw_explode s) of
   188     (x, []) => x
   188     (x, []) => x
   189   | (_, ys) => error ("XML parsing error: Unprocessed input\n" ^ Symbol.beginning 100 ys));
   189   | (_, ys) => error ("XML parsing error: Unprocessed input\n" ^ Symbol.beginning 100 ys));
   190 
   190 
   191 end;
   191 end;
   192 
   192