Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Xml: Accept empty document
  • Loading branch information
raphink committed Jun 9, 2015
1 parent 6f5c632 commit ce6ce65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lenses/tests/test_xml.aug
Expand Up @@ -775,8 +775,8 @@ test Xml.lns get "<doc></doc><bad/>" = *
(* document element must be complete *)
test Xml.lns get "<doc>" = *

(* emtpy document is rejected *)
test Xml.lns get "" = *
(* accept empty document *)
test Xml.lns get "\n" = {}

(* malformed element *)
test Xml.lns get "<a><A@/></a>" = *
Expand Down Expand Up @@ -823,3 +823,6 @@ test Xml.lns get "<!DOCTYPE doc [
test Xml.lns get "<a password=\"my\!pass\" />" =
{ "a" = "#empty"
{ "#attribute" { "password" = "my\!pass" } } }

test Xml.lns put ""
after set "/a" "#empty" = "<a/>\n"
2 changes: 1 addition & 1 deletion lenses/xml.aug
Expand Up @@ -154,7 +154,7 @@ let doc = (sep_osp . (prolog | comment | doctype | pi_instruction))* .
((sep_osp . content) | (sep_osp . empty_element)) .
(sep_osp . (comment | pi_instruction ))* . sep_osp

let lns = doc
let lns = doc | Util.empty?

let filter = (incl "/etc/xml/*.xml")
. (incl "/etc/xml/catalog")
Expand Down

0 comments on commit ce6ce65

Please sign in to comment.