| 1 | Binding to xml-light |
| 2 | ==================== |
| 3 | |
| 4 | This Rocq-Elpi plugin gives access to xml files. |
| 5 | |
| 6 | ```bash |
| 7 | opam install rocq-elpi-xml # pulls in xml-light |
| 8 | ``` |
| 9 | |
| 10 | Then you can access the APIs in [doc/xml.elpi](doc/xml.elpi) this way: |
| 11 | |
| 12 | ```coq |
| 13 | From elpi Require Import elpi xml. |
| 14 | |
| 15 | From elpi.xml.tests Extra Dependency "test.xml" as xml_test_file. |
| 16 | |
| 17 | Elpi Command hello_xml. |
| 18 | Elpi Accumulate Plugin "xml.elpi". |
| 19 | Elpi Accumulate lp:{{ |
| 20 | main [str D] :- |
| 21 | std.assert-ok! (coq.extra-dep->xml D X) "bad file", |
| 22 | coq.say "xml AST:" X, |
| 23 | coq.xml->string X S, |
| 24 | coq.say "pretty:" S, |
| 25 | coq.string->xml S X', |
| 26 | coq.say "xml AST:" X', |
| 27 | std.assert! (X = X') "this would be bad". |
| 28 | }}. |
| 29 | Elpi Export hello_xml. |
| 30 | |
| 31 | hello_xml "xml_test_file". |
| 32 | ``` |
| 33 | |
| 34 | Note: At the time of writing `rocq_makefile` fully supports this directive and |
| 35 | considers `<file>` as a dependency of the `.v` file. Dune does not yet |
| 36 | support this. For a workaround see the [tests/](tests-plugin/) directory. |
| 37 |