tyxml-2.2.0/0000755000000000000000000000000012060404012011043 5ustar0000000000000000tyxml-2.2.0/Makefile0000644000000000000000000000337112060404012012507 0ustar0000000000000000 include Makefile.config -include Makefile.local all: files/META files/META.tyxml $(MAKE) -C syntax byte opt $(MAKE) -C lib byte opt byte: files/META files/META.tyxml $(MAKE) -C syntax byte $(MAKE) -C lib byte opt: files/META files/META.tyxml $(MAKE) -C syntax opt $(MAKE) -C lib opt clean: $(MAKE) -C lib clean $(MAKE) -C syntax clean $(MAKE) -C doc clean rm -f files/META files/META.tyxml distclean: $(MAKE) -C syntax distclean $(MAKE) -C lib distclean $(MAKE) -C doc distclean -rm -f *~ \#* .\#* files/META files/META.tyxml .PHONY: doc doc: $(MAKE) -C doc depend: $(MAKE) -C syntax depend $(MAKE) -C lib depend include Makefile.filelist VERSION := $(shell head -n 1 VERSION) files/META: files/META.in Makefile.config sed -e s%_LIBNAME_%${LIBNAME}%g \ -e s%_PACKAGENAME_%${PACKAGENAME}%g \ -e s%_LIBDIR_%% \ -e s%_SYNTAXDIR_%% \ $< > $@ files/META.tyxml: files/META.in Makefile.config sed -e s%_LIBNAME_%${LIBNAME}%g \ -e s%_PACKAGENAME_%${PACKAGENAME}%g \ -e s%_LIBDIR_%directory\ =\ \"..\/lib\"% \ -e s%_SYNTAXDIR_%directory\ =\ \"..\/syntax\"% \ $< > $@ install: $(OCAMLFIND) install ${PACKAGENAME} \ -patch-version ${VERSION} \ files/META ${INTF} ${IMPL} ${NATIMPL} \ ${MLI_TO_INSTALL} install-byte: $(OCAMLFIND) install ${PACKAGENAME} \ -patch-version ${VERSION} \ files/META ${INTF} ${IMPL} ${MLI_TO_INSTALL} install-opt: $(OCAMLFIND) install ${PACKAGENAME} \ -patch-version ${VERSION} \ files/META ${INTF} ${NATIMPL} ${MLI_TO_INSTALL} uninstall: $(OCAMLFIND) remove ${PACKAGENAME} reinstall: uninstall install reinstall-byte: uninstall install-byte reinstall-opt: uninstall install-opt dist: DARCS_REPO=$(PWD) darcs dist -d ${PACKAGENAME}-${VERSION} tyxml-2.2.0/LICENSE0000644000000000000000000000041312060404012012046 0ustar0000000000000000The Ocsigen application core, and other portions of the official Ocsigen distribution not explicitly licensed otherwise, are licensed under the GNU LESSER GENERAL PUBLIC LICENSE with openssl linking exception -- see the 'COPYING' file in this directory for details. tyxml-2.2.0/CHANGES0000644000000000000000000000241712060404012012042 0ustar0000000000000000 ===== 2.2.0 ===== * Adding tag ===== 2.1.0 ===== * Rename all module names lower-case * Explicit choice of implementation for syntax extension ===== 2.0.2 ===== * Add a simple printer: XML.print * API change: ** Rename XML.event into XML.event_handler ** The functorized interface now export the concrete representation of XML.nodes ** Open types in SVG_sigs (closes #269). ===== 2.0.1 ===== * Allow compilation on win32/msvc * Truly allow to abstract the XMl.uri representation * Always print XHTML in a format that is "Html compatible": ** Add missing namespace in . ===== 2.0 ===== * Allow the namespace attribute in HTML5 elements. * Always print polyglot XML. ( document correct as HTML5 and as XML ) * Add new polymorphic types to HTML5 ( between_phrasing_and_phrasing_without_interactive, ... ) ===== 2.0-rc1 ===== * Some fixes to match the latest HTML5 working draft (05/08/2011). * Simplification of the functorial interface (use module substitution) * Fix IFrame usage. ===== 1.91 ===== * First independant release (was released with ocsigen) * Add a functorial interface for concrete XML representation * Add a functorial interface for stream printer * Rename XHTML5 into HTML5 * Change the default syntax to HTML5 instead of XHTML 1.1 tyxml-2.2.0/Makefile.filelist0000644000000000000000000000347212060404012014323 0ustar0000000000000000INTF := lib/xml_sigs.cmi \ lib/xml_print.cmi \ lib/xml_iter.cmi \ lib/xml.cmi \ \ lib/xhtml_types.cmi \ lib/xhtml_sigs.cmi \ lib/xhtml_f.cmi \ \ lib/svg_types.cmi \ lib/svg_sigs.cmi \ lib/svg_f.cmi \ \ lib/html5_types.cmi \ lib/html5_sigs.cmi \ lib/html5_f.cmi \ \ lib/xhtml.cmi \ lib/svg.cmi \ lib/html5.cmi \ \ syntax/pa_tyxml.cmi \ syntax/simplexmlparser.cmi \ IMPL := lib/${LIBNAME}_f.cma \ lib/${LIBNAME}.cma \ syntax/pa_${LIBNAME}.cmo \ syntax/xmllexer.cmo \ syntax/simplexmlparser.cmo \ NATIMPL := lib/${LIBNAME}.cmxa \ lib/${LIBNAME}_f.cmxa \ syntax/xmllexer.cmx \ syntax/simplexmlparser.cmx \ NATIMPL += $(patsubst %.cmxa,%$(LIBEXT),$(filter %.cmxa,${NATIMPL})) \ $(patsubst %.cmx,%$(OBJEXT),$(filter %.cmx,${NATIMPL})) \ ifeq "${NATDYNLINK}" "yes" NATIMPL += $(patsubst %.cmxa,%.cmxs,$(filter %.cmxa,${NATIMPL})) \ $(patsubst %.cmx,%.cmxs,$(filter %.cmx,${NATIMPL})) endif NOMLI := DOC := $(filter-out ${NOMLI}, ${INTF:.cmi=.mli}) ${NOMLI:.mli=.ml} ## DUCE_INTF := lib/xml_sigs_duce.cmi \ lib/xml_print_duce.cmi \ lib/xhtml_types_duce.cmi \ lib/xhtml_duce.cmi \ DUCE_IMPL := lib/${LIBNAME}_duce.cma DUCE_NATIMPL := lib/${LIBNAME}_duce.cmxa lib/${LIBNAME}_duce$(LIBEXT) ifeq "${NATDYNLINK}" "yes" DUCE_NATIMPL += lib/${LIBNAME}_duce.cmxs endif DUCE_NOMLI := DUCE_DOC := $(filter-out ${DUCE_NOMLI}, ${DUCE_INTF:.cmi=.mli}) ${DUCE_NOMLI:.mli=.ml} ifeq "${OCAMLDUCE}" "yes" INTF += ${DUCE_INTF} IMPL += ${DUCE_IMPL} NATIMPL += ${DUCE_NATIMPL} DOC += ${DUCE_DOC} endif MLI_TO_INSTALL := $(foreach X,$(INTF:.cmi=.ml),$(if $(wildcard $(X)i),$(X)i,$(X))) tyxml-2.2.0/README0000644000000000000000000000343512060404012011730 0ustar0000000000000000 == TypedXML tyxml is a parser and printer for xml, and a simple library for building valid XHTML 1.1, HTML5 or SVG tree. The generic printer allows a HTML compatible mode. * Directory {{{lib}}} XHTML typing using Thorsten Ohl's XHTML.M library to validate xml tree at compile-time, adapted to support HTML5 and SVG. The implementation uses a XML module for generating well formed---but not necessarily valid with respect to some DTD---XML documents. The elements of type XML.elt and attributes of type XML.attrib are then hidden behind polymorphic phantom types type 'a elt = XML.elt and type 'a attrib = XML.attrib with 'a set to appropriate polymorphic variants. * Directory {{{syntax}}} A syntax extension to write XHTML or HTML5 inside a caml program. == Requirements: * ocaml and camlp4 * findlib * ocamlnet (for netstring) [optionnal] * ocamlduce == Build intructions: $ ${EDITOR} Makefile.config $ make $ make install == API documentation: $ make doc $ ${BROWSER} doc/api-html/index.html == Examples: $ ocaml Objective Caml version 3.12.1 # #use "topfind";; - : unit = () # #camlp4o;; Camlp4 Parsing version 3.12.1 # #require "tyxml.syntax";; # let x = << Contents >>;; val x : [> `A ] HTML5.M.elt = # HTML5.P.print_list ~output:print_string [x];; - : string = " Contents \n" # let x = <<
>>;; Error: This expression cannot be coerced to type ([< HTML5_types.html_content ] as 'a) HTML5.M.elt list; it has type ([> HTML5_types.br ] as 'b) HTML5.M.elt list but is here used with type 'a HTML5.M.elt list Type 'b = [> `Br ] is not compatible with type 'a = [< `Body | `Head ] The second variant type does not allow tag(s) `Br tyxml-2.2.0/COPYING0000644000000000000000000006543712060404012012115 0ustar0000000000000000This program is released under the LGPL version 2.1 (see the text below) with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. As a special exception to the GNU Library General Public License, you may also link, statically or dynamically, a "work that uses the Library" with a publicly distributed version of the Library to produce an executable file containing portions of the Library, and distribute that executable file under terms of your choice, without any of the additional requirements listed in clause 6 of the GNU Library General Public License. By "a publicly distributed version of the Library", we mean either the unmodified Library, or a modified version of the Library that is distributed under the conditions defined in clause 3 of the GNU Library General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU Library General Public License. GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! tyxml-2.2.0/VERSION0000644000000000000000000000000612060404012012107 0ustar00000000000000002.2.0 tyxml-2.2.0/boring0000644000000000000000000000020412060404012012242 0ustar0000000000000000\.cmi$ \.cmx$ \.cmo$ \.cma$ \.cmxa$ \.cmxs$ \.o$ \.a$ ~$ ^Makefile.config$ ^doc/api-html ^syntax/xmllexer.ml$ ^syntax/camllexer.ml$ tyxml-2.2.0/predist0000644000000000000000000000005212060404012012435 0ustar0000000000000000#!/bin/sh # Cleanup rm -f predist boring tyxml-2.2.0/Makefile.config0000644000000000000000000000074112060404012013751 0ustar0000000000000000 PACKAGENAME := tyxml LIBNAME := tyxml ## Binaries OCAMLFIND := ocamlfind OCAMLLEX := ocamllex OCAMLDUCEFIND := ocamlducefind ## Build options ## Shall we build ocamlduce support ? [detect] OCAMLDUCE := \ $(shell (${OCAMLDUCEFIND} query > /dev/null 2>&1 && echo yes) || echo no) ## Shall we build native plugins ? [detect] NATDYNLINK := \ $(shell (test -f $$(${OCAMLFIND} query dynlink)/dynlink.cmxa && echo yes) || echo no) # DBG := -g OBJEXT := .o LIBEXT := .a tyxml-2.2.0/lib/0000755000000000000000000000000012060404012011611 5ustar0000000000000000tyxml-2.2.0/lib/xhtml_f.mli0000644000000000000000000000362012060404012013756 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Typesafe constructors for XHTML documents (Functorial interface) *) module Make_01_00(X : Xml_sigs.T) : Xhtml_sigs.T_01_00 with type Xml.uri = X.uri and type Xml.event_handler = X.event_handler and type Xml.attrib = X.attrib and type Xml.elt = X.elt module Make_01_01(X : Xml_sigs.T) : Xhtml_sigs.T_01_01 with type Xml.uri = X.uri and type Xml.event_handler = X.event_handler and type Xml.attrib = X.attrib and type Xml.elt = X.elt module Make(X : Xml_sigs.T) : Xhtml_sigs.T with type Xml.uri = X.uri and type Xml.event_handler = X.event_handler and type Xml.attrib = X.attrib and type Xml.elt = X.elt tyxml-2.2.0/lib/html5_types.mli0000644000000000000000000015570612060404012014607 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2010 by Simon Castellan * Copyright (C) 2010 by Cecile Herbelin * Copyright (C) 2010 by Vincent Balat * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (* TODO, Issues: -> Map cannot contain area children for now -> noscript (a [a []]) should not be typed. -> mathml ! *) (* _fun prefix are the types that must be used in Html5.M. They are more restrictive as some param are already taken as seperate argument, to ensure better compatibility. SC *) (* TODO: from draft 8 may 2011: * add bdi element * add s element * add u element * area is only allowed inside a phrasing if included inside a map element *) (** HTML5 types with variants. (See also {!Html5.M}) @see information concerning HTML5 at W3C. *) (** See {!Xhtml.M} for a description of the transcription's principles. *) (** {1 Attribute types.} *) type cdata = string (** Character data *) type id = string (** A document-unique identifier *) type idref = string (** A reference to a document-unique identifier *) type idrefs = idref list (** A space-separated list of references to document-unique identifiers *) type name = string (** A name with the same character constraints as ID above *) type nmtoken = string (** A name composed of only name tokens as defined in XML 1.0 @see XML 1.0 *) type nmtokens = nmtoken list (** One or more white space separated NMTOKEN values *) (** {2 Data Types} *) type character = char (** A single character from ISO 10646. *) type charset = string (** A character encoding, as per RFC2045 (MIME). @see RFC2045 *) type charsets = charset list (** A space-separated list of character encodings, as per RFC2045 (MIME). @see RFC2045 *) type contenttype = string (** A media type, as per RFC2045 (MIME). @see RFC2045 *) type contenttypes = contenttype list (** A comma-separated list of media types, as per RFC2045 (MIME). @see RFC2045 *) type coords = string list (** Comma- separated list of coordinates to use in defining areas. *) type datetime = string (** Date and time information. *) type fpi = string (** A character string representing an SGML Formal Public Identifier. *) type frametarget = string (** Frame name used as destination for results of certain actions. *) type languagecode = string (** A language code, as per RFC5646. @see RFC5646 *) type length = [ | `Pixels of int | `Percent of int ] (** The value may be either in pixels or a percentage of the available horizontal or vertical space. Thus, the value [`Percent 50] means half of the available space. *) type linktypes = [ | `Alternate | `Archives | `Author | `Bookmark | `External | `First | `Help | `Icon | `Index | `Last | `License | `Next | `Nofollow | `Noreferrer | `Pingback | `Prefetch | `Prev | `Search | `Stylesheet | `Sidebar | `Tag | `Up | `Other of string ] list (** Authors may use the following recognized link types, listed here with their conventional interpretations. A LinkTypes value refers to a space-separated list of link types. White space characters are not permitted within link types. These link types are case-insensitive, i.e., ["Alternate"] has the same meaning as ["alternate"]. User agents, search engines, etc. may interpret these link types in a variety of ways. For example, user agents may provide access to linked documents through a navigation bar. {ul {- [`Alternate]: Gives alternate representations of the current document.} {- [`Archives]: Provides a link to a collection of records, documents, or other materials of historical interest.} {- [`Author]: Gives a link to the current document's author.} {- [`Bookmark]: Gives the permalink for the nearest ancestor section.} {- [`External]: Indicates that the referenced document is not part of the same site as the current document.} {- [`First]: Indicates that the current document is a part of a series, and that the first document in the series is the referenced document.} {- [`Help]: Provides a link to context-sensitive help.} {- [`Icon]: Imports an icon to represent the current document.} {- [`Index]: Gives a link to the document that provides a table of contents or index listing the current document.} {- [`Last]: Indicates that the current document is a part of a series, and that the last document in the series is the referenced document.} {- [`Licence]: Indicates that the main content of the current document is covered by the copyright license described by the referenced document.} {- [`Next]: Indicates that the current document is a part of a series, and that the next document in the series is the referenced document.} {- [`Nofollow]: Indicates that the current document's original author or publisher does not endorse the referenced document.} {- [`Noreferrer]: Requires that the user agent not send an HTTP Referer (sic) header if the user follows the hyperlink.} {- [`Pingback]: Gives the address of the pingback server that handles pingbacks to the current document.} {- [`Prefetch]: Specifies that the target resource should be preemptively cached.} {- [`Prev]: Indicates that the current document is a part of a series, and that the previous document in the series is the referenced document.} {- [`Search]: Gives a link to a resource that can be used to search through the current document and its related pages.} {- [`Stylesheet]: Imports a stylesheet.} {- [`Sidebar]: Specifies that the referenced document, if retrieved, is intended to be shown in the browser's sidebar (if it has one).} {- [`Tag]: Gives a tag (identified by the given address) that applies to the current document.} {- [`Up]: Provides a link to a document giving the context for the current document.} } *) type mediadesc = [ | `All | `Aural | `Braille | `Embossed | `Handheld | `Print | `Projection | `Screen | `Speech | `TTY | `TV ] list (** The MediaDesc attribute is a comma-separated list of media descriptors. The following is a list of recognized media descriptors: {ul {- [`Screen]: For non-paged computer screens.} {- [`TTY]: For media using a fixed-pitch character grid (like teletypes, terminals, or devices with limited display capabilities).} {- [`TV]: For TV-type devices (low resolution, limited scrollability).} {- [`Projection]: For projectors.} {- [`Handheld]: For handheld devices (small screen, limited bandwidth).} {- [`Print]: For paged and for documents viewed on screen in print preview mode.} {- [`Braille]: For braille tactile feedback devices.} {- [`Aural]: For speech synthesizers.} {- [`All]: For all devices.}} {ol {- The value is a comma-separated list of entries. For example, [media="screen, 3d-glasses, print and resolution > 90dpi"] is mapped to: ["screen"], ["3d-glasses"], ["print and resolution > 90dpi"].} {- Each entry is truncated just before the first character that isn't a US ASCII letter [\[a-zA-Z\]] (ISO 10646 hex 41-5a, 61-7a), digit [\[0-9\]] (hex 30-39), or hyphen-minus (hex 2d). In the example, this gives: ["screen"], ["3d-glasses"], ["print"].} {- A case-insensitive match is then made with the set of media types defined above. User agents may ignore entries that don't match. In the example we are left with ["screen"] and ["print"].}} Note. Style sheets may include media-dependent variations within them (e.g., the [CSS \@media] consig). In such cases it may be appropriate to use ["media=all"]. *) type multilength = [ | length | `Relative of int ] (** The value may be a Length or a relative length. A relative length has the form ["i*"], where ["i"] is an integer. When allotting space among elements competing for that space, user agents allot pixel and percentage lengths first, then divide up remaining available space among relative lengths. Each relative length receives a portion of the available space that is proportional to the integer preceding the ["*"]. The value ["*"] is equivalent to ["1*"]. Thus, if 60 pixels of space are available after the user agent allots pixel and percentage space, and the competing relative lengths are ["1*"], ["2*"], and ["3*"], the ["1*"] will be allotted 10 pixels, the ["2*"] will be allotted 20 pixels, and the ["3*"] will be allotted 30 pixels. *) (* comma-separated *) type multilengths = multilength list (** A comma separated list of items of type MultiLength. *) type number = int (* space-separated *) type numbers = number list type float_number = float type pixels = int (** The value is an integer that represents the number of pixels of the canvas (screen, paper). Thus, the value ["50"] means fifty pixels. For normative information about the definition of a pixel, please consult CSS2. @see CSS2 *) type script_ = string (** Script data can be the content of the ["script"] element and the value of intrinsic event attributes. User agents must not evaluate script data as HTML markup but instead must pass it on as data to a script engine. The case-sensitivity of script data depends on the scripting language. Please note that script data that is element content may not contain character references, but script data that is the value of an attribute may contain them. *) type text = string (** Arbitrary textual data, likely meant to be human-readable. *) (** {2 Core} *) type i18n = [ | `XML_lang ] type core = [ | `Accesskey | `Class | `Contenteditable | `Contextmenu | `Dir | `Draggable | `Hidden | `Id | i18n | `Spellcheck | `Style_Attr | `Tabindex | `Title | `User_data | `XMLns ] (** {2 Events} *) (** Javascript events *) type events = [ | `OnAbort | `OnBlur | `OnCanPlay | `OnCanPlayThrough | `OnChange | `OnClick | `OnContextMenu | `OnDblClick | `OnDrag | `OnDragEnd | `OnDragEnter | `OnDragLeave | `OnDragOver | `OnDragStart | `OnDrop | `OnDurationChange | `OnEmptied | `OnEnded | `OnError | `OnFocus | `OnFormChange | `OnFormInput | `OnInput | `OnInvalid | `OnMouseDown | `OnMouseUp | `OnMouseOver | `OnMouseMove | `OnMouseOut | `OnMouseWheel | `OnPause | `OnPlay | `OnPlaying | `OnProgress | `OnRateChange | `OnReadyStateChange | `OnScroll | `OnSeeked | `OnSeeking | `OnSelect | `OnShow | `OnStalled | `OnSubmit | `OnSuspend | `OnTimeUpdate | `OnVolumeChange | `OnWaiting | `OnKeyPress | `OnKeyDown | `OnKeyUp | `OnLoad | `OnLoadedData | `OnLoadedMetaData | `OnLoadStart ] (** Common attributes *) type common = [ | core | i18n | events ] (** {1 Categegories of HTML5 elements} *) (** These category are mainly subdivised in - interactive, - phrasing, - flow5, these categories may overlap *) type heading = [ | `H1 | `H2 | `H3 | `H4 | `H5 | `H6 | `Hgroup ] type sectioning = [ | `Section | `Nav | `Aside | `Article ] type resetable = [ | `Textarea | `Select | `Output | `Keygen | `Input ] type submitable = [ | `Textarea | `Select | `Keygen | `Input | `Button ] type labelable = [ | resetable | `Progress | `Meter | `Button ] type labelable_without_interactive = [ `Progress | `Meter] type formatblock = [ | heading | sectioning | `Pre | `P | `Header | `Footer | `Div | `Blockquote | `Address ] type sectionningroot = [ | `Td | `Figure | `Fieldset | `Details | `Body | `Blockquote ] type listed = [ | resetable | submitable | `Fieldset ] type formassociated = [ | listed | `Progress | `Meter | `Label ] (** Transparent elements. Such elements have a part of they children in their dataconsigor, and behaves like them. We could do something like [=a: 'a elt list -> 'a elt] but the information about the node name would be forgotten and would allow things like that : [=p [a [a []]]]. This system allow to build non-conforming terms such as [a [a []]] but when passed to a standard element (such as [p]), it will yield an error. Exception to that : if you embdedd the element in another transparent (of an another kind) : [p [noscript (a [a []])]] will be correctly typed. *) type (+'interactive, +'noscript, +'regular, +'media) transparent = [ | `A of 'interactive | `Noscript of 'noscript | `Canvas of 'regular | `Map of 'regular | `Ins of 'regular | `Del of 'regular | `Object of 'regular | `Object_interactive of 'regular | `Audio_interactive of 'media | `Video_interactive of 'media | `Audio of 'media | `Video of 'media ] (* _interactive variants are not used for now *) type (+'noscript, +'regular, +'media) transparent_without_interactive = [ | `Noscript of 'noscript | `Ins of 'regular | `Del of 'regular | `Object of 'regular | `Canvas of 'regular | `Map of 'regular | `Audio of 'media | `Video of 'media ] type (+'interactive, +'regular, +'media) transparent_without_noscript = [ | `A of 'interactive | `Ins of 'regular | `Del of 'regular | `Canvas of 'regular | `Map of 'regular | `Object of 'regular | `Object_interactive of 'regular | `Video of 'media | `Audio of 'media | `Video_interactive of 'media | `Audio_interactive of 'media ] type (+'interactive, +'noscript, +'regular) transparent_without_media = [ | `A of 'interactive | `Noscript of 'noscript | `Ins of 'regular | `Del of 'regular | `Map of 'regular | `Canvas of 'regular | `Object of 'regular | `Object_interactive of 'regular ] (** Metadata without title *) type metadata_without_title = [ | `Style | `Script | `Noscript of [ | `Meta | `Link | `Style ] | `Meta | `Link | `Command | `Base ] (** Metadata contents. Used specially in *) type metadata = [ | metadata_without_title | `Title ] (** Interactive contents : contents that require user-interaction (Forms, link, etc.) *) (** Core element types are element types without transparent. *) type core_interactive = [ | `Textarea | `Select | `Menu | `Label | `Keygen | `Input | `Img_interactive | `Iframe | `Embed | `Details | `Button ] type interactive = [ core_interactive | (interactive, interactive, interactive) transparent_without_interactive ] (** Phrasing contents is inline contents : bold text, span, and so on. *) type core_phrasing = [ | labelable | submitable | `Wbr | `Var | `U | `Svg | `Time | `Sup | `Sub | `Strong | `Span | `Small | `Script | `Samp | `Ruby | `Q | `Mark | `Label | `Kbd | `Iframe | `I | `Embed | `Em | `Dfn | `Datalist | `Command | `Code | `Cite | `Br | `Bdo | `B | `Abbr | `Img | `Img_interactive | `PCDATA ] type core_phrasing_without_noscript = [ | labelable | submitable | `Wbr | `Var | `U | `Time | `Sup | `Sub | `Svg | `Strong | `Span | `Small | `Script | `Samp | `Ruby | `Q | `Mark | `Label | `Kbd | `Iframe | `I | `Embed | `Em | `Dfn | `Datalist | `Command | `Code | `Cite | `Br | `Bdo | `Img | `Img_interactive | `B | `Abbr | `PCDATA ] type core_phrasing_without_interactive = [ | labelable_without_interactive | `Wbr | `Var | `U | `Img | `Time | `Sup | `Sub | `Strong | `Span | `Small | `Script | `Svg | `Samp | `Ruby | `Q | `Mark | `Kbd | `Img | `I | `Em | `Dfn | `Datalist | `Command | `Code | `Cite | `Br | `Bdo | `B | `Abbr | `PCDATA ] type core_phrasing_without_media = [ | labelable | submitable | `Wbr | `Var | `U | `Time | `Svg | `Sup | `Sub | `Strong | `Span | `Small | `Script | `Samp | `Ruby | `Q | `Mark | `Label | `Kbd | `Img | `Img_interactive | `Iframe | `I | `Embed | `Em | `Dfn | `Datalist | `Command | `Code | `Cite | `Br | `Bdo | `B | `Abbr | `PCDATA ] type phrasing_without_noscript = (phrasing_without_interactive, phrasing, phrasing_without_media) transparent_without_noscript and phrasing_without_media = [ | core_phrasing_without_media | (phrasing_without_interactive, phrasing_without_noscript, phrasing) transparent_without_media ] and phrasing_without_interactive = [ | core_phrasing_without_interactive | (phrasing_without_noscript, phrasing, phrasing_without_media) transparent_without_interactive ] and phrasing = [ | (phrasing_without_interactive, phrasing_without_noscript, phrasing, phrasing_without_media) transparent | core_phrasing ] type (+'a, +'b) between_phrasing_and_phrasing_without_interactive = ( [< core_phrasing | ([< phrasing_without_interactive] as 'b, phrasing_without_noscript, phrasing, phrasing_without_media) transparent > `Abbr `B `Bdo `Br `Canvas `Cite `Code `Command `Datalist `Del `Dfn `Em `I `Img `Ins `Kbd `Map `Mark `Meter `Noscript `Object `PCDATA `Progress `Q `Ruby `Samp `Script `Small `Span `Strong `Sub `Sup `Svg `Time `U `Var `Wbr ] as 'a) (** Phrasing without the interactive markups *) type phrasing_without_dfn = [ | labelable | submitable | `Wbr | `Var | `U | `Time | `Sup | `Sub | `Strong | `Span | `Small | `Script | `Samp | `Ruby | `Q | `Mark | `Label | `Img | `Img_interactive | `Kbd | `I | `Em | `Datalist | `Command | `Code | `Cite | `Br | `Bdo | `B | `Abbr | `PCDATA | (phrasing_without_interactive, phrasing_without_noscript, phrasing_without_dfn, phrasing_without_media) transparent ] type phrasing_without_label = [ | labelable | submitable | `Wbr | `Var | `U | `Time | `Sup | `Sub | `Strong | `Span | `Img | `Img_interactive | `Small | `Script | `Samp | `Ruby | `Q | `Mark | `Kbd | `I | `Em | `Dfn | `Datalist | `Command | `Code | `Cite | `Br | `Bdo | `B | `Abbr | `PCDATA | (phrasing_without_interactive, phrasing_without_noscript, phrasing_without_label, phrasing_without_media) transparent ] type phrasing_without_progress = [ | resetable | submitable | `Wbr | `Var | `U | `Time | `Sup | `Sub | `Strong | `Span | `Small | `Script | `Samp | `Img | `Img_interactive | `Ruby | `Q | `Meter | `Mark | `Label | `Kbd | `I | `Em | `Dfn | `Datalist | `Command | `Code | `Cite | `Button | `Br | `Bdo | `B | `Abbr | `PCDATA | (phrasing_without_interactive, phrasing_without_noscript, phrasing_without_progress, phrasing_without_media) transparent ] type phrasing_without_time = [ | labelable | submitable | `Wbr | `Var | `U | `Sup | `Sub | `Strong | `Img | `Img_interactive | `Span | `Small | `Script | `Samp | `Ruby | `Q | `Mark | `Label | `Kbd | `I | `Em | `Dfn | `Datalist | `Command | `Code | `Cite | `Br | `Bdo | `B | `Abbr | `PCDATA | (phrasing_without_interactive, phrasing_without_noscript, phrasing_without_time, phrasing_without_media) transparent ] type phrasing_without_meter = [ | submitable | resetable | `Progress | `Button | `Wbr | `Var | `U | `Time | `Sup | `Img | `Img_interactive | `Sub | `Strong | `Span | `Small | `Script | `Samp | `Ruby | `Q | `Mark | `Label | `Kbd | `I | `Em | `Dfn | `Datalist | `Command | `Code | `Cite | `Br | `Bdo | `B | `Abbr | `PCDATA | (phrasing_without_interactive, phrasing_without_noscript, phrasing_without_meter, phrasing_without_media) transparent ] type core_flow5 = [ | core_phrasing | formassociated | formatblock | `Ul | `Table | `Style | `Ol | `Menu | `Hr | `Form | `Figure | `Dl | `Details ] type core_flow5_without_interactive = [ | core_phrasing_without_interactive | formassociated | formatblock | `Ul | `Table | `Style | `Ol | `Menu | `Hr | `Form | `Figure | `Dl ] type core_flow5_without_noscript = [ | core_phrasing_without_noscript | formassociated | formatblock | `Ul | `Table | `Style | `Ol | `Menu | `Hr | `Form | `Figure | `Dl | `Details ] type core_flow5_without_media = [ | core_phrasing_without_media | formassociated | formatblock | `Ul | `Table | `Style | `Ol | `Menu | `Hr | `Form | `Figure | `Dl | `Details ] type flow5_without_interactive = [ core_flow5_without_interactive | (flow5_without_noscript, flow5, flow5_without_media) transparent_without_interactive ] and flow5_without_noscript = [ | core_flow5_without_noscript | (flow5_without_interactive, flow5, flow5_without_media) transparent_without_noscript ] and flow5_without_media = [ core_flow5_without_media | (flow5_without_interactive, flow5_without_noscript, flow5) transparent_without_media ] and flow5 = [ | core_flow5 | (flow5_without_interactive, flow5_without_noscript, flow5, flow5_without_media) transparent ] type flow5_without_table = [ | core_phrasing | formassociated | formatblock | `Ul | `Style | `Ol | `Menu | `Hr | `Form | `Figure | `Dl | `Details | (flow5_without_interactive, flow5_without_noscript, flow5, flow5_without_media) transparent ] type flow5_without_interactive_header_footer = [ | heading | sectioning | `Pre | `P | `Div | `Blockquote | `Address | core_phrasing_without_interactive | formassociated | `Ul | `Table | `Style | `Ol | `Menu | `Hr | `Form | `Figure | `Dl | (flow5_without_noscript, flow5, flow5_without_media) transparent_without_interactive ] type flow5_without_header_footer = [ | heading | sectioning | `Pre | `P | `Div | `Blockquote | `Address | core_phrasing | formassociated | `Ul | `Table | `Style | `Ol | `Menu | `Hr | `Form | `Figure | `Dl | `Details | (flow5_without_interactive_header_footer, flow5_without_noscript, flow5, flow5_without_media) transparent ] type +'a between_flow5_and_flow5_without_interactive_header_footer = [< flow5 > `Abbr `Address `Article `Aside `Audio `B `Bdo `Blockquote `Br `Button `Canvas `Cite `Code `Command `Datalist `Del `Dfn `Div `Dl `Em `Fieldset `Figure `Form `H1 `H2 `H3 `H4 `H5 `H6 `Hgroup `Hr `I `Img `Input `Ins `Kbd `Keygen `Label `Map`Mark `Menu `Meter `Nav `Noscript `Object `Ol `Output `P `PCDATA `Pre `Progress `Q `Ruby `Samp `Script `Section `Select `Small `Span `Strong `Style `Sub `Sup `Svg `Table `Textarea `Time `U `Ul `Var `Video `Wbr] as 'a type (+'a, +'b) between_flow5_and_flow5_without_header_footer = [< core_flow5 | ([< flow5_without_interactive ] as 'b, flow5_without_noscript, 'a, flow5_without_media) transparent > `A `Abbr `Address `Article `Aside `Audio `Audio_interactive `B `Bdo `Blockquote `Br `Button `Canvas `Cite `Code `Command `Datalist `Del `Details `Dfn `Div `Dl `Em `Embed `Fieldset `Figure `Form `H1 `H2 `H3 `H4 `H5 `H6 `Hgroup `Hr `I `Iframe `Img `Img_interactive `Input `Ins `Kbd `Keygen `Label `Map `Mark `Menu `Meter `Nav `Noscript `Object `Object_interactive `Ol `Output `P `PCDATA `Pre `Progress `Q `Ruby `Samp `Script `Section `Select `Small `Span `Strong `Style `Sub `Sup `Svg `Table `Textarea `Time `U `Ul `Var `Video `Video_interactive `Wbr ] as 'a type flow5_without_form = [ | core_phrasing | formassociated | formatblock | `Ul | `Table | `Style | `Ol | `Menu | `Hr | `Figure | `Dl | `Details | (flow5_without_interactive, flow5_without_noscript, flow5, flow5_without_media) transparent ] type flow5_without_sectioning_heading_header_footer_address = [ | core_phrasing | formassociated | `Pre | `P | `Div | `Blockquote | `Ul | `Table | `Style | `Ol | `Menu | `Hr | `Form | `Figure | `Dl | `Details | (flow5_without_interactive, flow5_without_noscript, flow5, flow5_without_media) transparent ] (* Type for HTML5 for elements *) type pcdata = [ | `PCDATA ] type notag type no_attribute_allowed type noattrib = [ `No_attribute_allowed of no_attribute_allowed ] type html = [ | `Html ] type xhtml = html type html_content_fun = [ | `Head | `Body ] type html_content = html_content_fun type html_attrib = [ | common | `Manifest ] type head = [ | `Head ] type head_content = [ | metadata ] type head_content_fun = [ | metadata_without_title ] type head_attrib = [ | common ] type body = [ | `Body ] type body_attrib = [ | common | `OnAfterPrint | `OnBeforePrint | `OneBeforeUnload | `OnHashChange | `OnMessage | `OnOffLine | `OnOnLine | `OnPageHide | `OnPageShow | `OnPopState | `OnRedo | `OnResize | `OnStorage | `OnUndo | `OnUnload ] type body_content = flow5 type body_content_fun = flow5 type svg = [ `Svg ] type svg_content = Svg_types.svg_content type svg_attrib = Svg_types.svg_attr (* NAME: base, KIND: nullary, TYPE: [= common | `Href | `Target], [= `Base ], ARG: notag, ATTRIB: OUT: [= `Base ] *) type base = [ | `Base ] type base_content = notag type base_content_fun = notag type base_attrib = [ | common | `Href | `Target ] type title = [ | `Title ] type title_content = [ | `PCDATA ] type title_content_fun = [ | `PCDATA ] type title_attrib = noattrib (* NAME: footer, KIND: star, TYPE: [= common ], [= flow5_without_header_footer ], [=`Footer], ARG: [= flow5_without_header_footer ], ATTRIB: OUT: [=`Footer] *) type footer = [ | `Footer ] type footer_content = [ | flow5_without_header_footer ] type footer_content_fun = [ | flow5_without_header_footer ] type footer_attrib = [ | common ] (* NAME: header, KIND: star, TYPE: [= common ], [= flow5_without_header_footer ], [=`Header], ARG: [= flow5_without_header_footer ], ATTRIB: OUT: [=`Header] *) type header = [ | `Header ] type header_content = [ | flow5_without_header_footer ] type header_content_fun = [ | flow5_without_header_footer ] type header_attrib = [ | common ] (* NAME: section, KIND: star, TYPE: [= common ], [= flow5 ], [=`Section], ARG: [= flow5 ], ATTRIB: OUT: [=`Section] *) type section = [ | `Section ] type section_content = [ | flow5 ] type section_content_fun = [ | flow5 ] type section_attrib = [ | common ] (* NAME: nav, KIND: star, TYPE: [= common ], [= flow5 ], [=`Nav], ARG: [= flow5 ], ATTRIB: OUT: [=`Nav] *) type nav = [ | `Nav ] type nav_content = [ | flow5 ] type nav_content_fun = [ | flow5 ] type nav_attrib = [ | common ] (* NAME: h, KIND: star, TYPE: [= common ], [= phrasing ], [=`H1], ARG: [= phrasing ], ATTRIB: OUT: [=`H1] *) type h1 = [ | `H1 ] type h1_content = [ | phrasing ] type h1_content_fun = [ | phrasing ] type h1_attrib = [ | common ] (* NAME: h, KIND: star, TYPE: [= common ], [= phrasing ], [=`H2], ARG: [= phrasing ], ATTRIB: OUT: [=`H2] *) type h2 = [ | `H2 ] type h2_content = [ | phrasing ] type h2_content_fun = [ | phrasing ] type h2_attrib = [ | common ] (* NAME: h, KIND: star, TYPE: [= common ], [= phrasing ], [=`H3], ARG: [= phrasing ], ATTRIB: OUT: [=`H3] *) type h3 = [ | `H3 ] type h3_content = [ | phrasing ] type h3_content_fun = [ | phrasing ] type h3_attrib = [ | common ] (* NAME: h, KIND: star, TYPE: [= common ], [= phrasing ], [=`H4], ARG: [= phrasing ], ATTRIB: OUT: [=`H4] *) type h4 = [ | `H4 ] type h4_content = [ | phrasing ] type h4_content_fun = [ | phrasing ] type h4_attrib = [ | common ] (* NAME: h, KIND: star, TYPE: [= common ], [= phrasing ], [=`H5], ARG: [= phrasing ], ATTRIB: OUT: [=`H5] *) type h5 = [ | `H5 ] type h5_content = [ | phrasing ] type h5_content_fun = [ | phrasing ] type h5_attrib = [ | common ] (* NAME: h, KIND: star, TYPE: [= common ], [= phrasing ], [=`H6], ARG: [= phrasing ], ATTRIB: OUT: [=`H6] *) type h6 = [ | `H6 ] type h6_content = [ | phrasing ] type h6_content_fun = [ | phrasing ] type h6_attrib = [ | common ] (* NAME: hgroup, KIND: plus, TYPE: [= common ], [= `H1 | `H2 | `H3 | `H4 | `H5 | `H6 ], [=`Hgroup], ARG: [= `H1 | `H2 | `H3 | `H4 | `H5 | `H6 ], ATTRIB: OUT: [=`Hgroup] *) type hgroup = [ | `Hgroup ] type hgroup_content = [ | `H1 | `H2 | `H3 | `H4 | `H5 | `H6 ] type hgroup_content_fun = [ | `H1 | `H2 | `H3 | `H4 | `H5 | `H6 ] type hgroup_attrib = [ | common ] (* NAME: address, KIND: star, TYPE: [= common ], [= flow5_without_sectioning_heading_header_footer_address ], [=`Address], ARG: [= flow5_without_sectioning_heading_header_footer_address ], ATTRIB: OUT: [=`Address] *) type address = [ | `Address ] type address_content = [ | flow5_without_sectioning_heading_header_footer_address ] type address_content_fun = [ | flow5_without_sectioning_heading_header_footer_address ] type address_attrib = [ | common ] (* NAME: article, KIND: star, TYPE: [= common ], [= flow5 ], [=`Article], ARG: [= flow5 ], ATTRIB: OUT: [=`Article] *) type article = [ | `Article ] type article_content = [ | flow5 ] type article_content_fun = [ | flow5 ] type article_attrib = [ | common ] (* NAME: aside, KIND: star, TYPE: [= common ], [= flow5 ], [=`Aside], ARG: [= flow5 ], ATTRIB: OUT: [=`Aside] *) type aside = [ | `Aside ] type aside_content = [ | flow5 ] type aside_content_fun = [ | flow5 ] type aside_attrib = [ | common ] (* NAME: p, KIND: star, TYPE: [= common ], [=phrasing ], [=`P], ARG: [=phrasing ], ATTRIB: OUT: [=`P] *) type p = [ | `P ] type p_content = [ | phrasing ] type p_content_fun = [ | phrasing ] type p_attrib = [ | common ] (* NAME: pre, KIND: star, TYPE: [= common ],[= phrasing ], [=`Pre], ARG: [= phrasing ], ATTRIB: OUT: [=`Pre] *) type pre = [ | `Pre ] type pre_content = [ | phrasing ] type pre_content_fun = [ | phrasing ] type pre_attrib = [ | common ] (* NAME: blockquote, KIND: star, TYPE: [= common | `Cite ],[= flow5 ], [=`Blockquote], ARG: [= flow5 ], ATTRIB: OUT: [=`Blockquote] *) type blockquote = [ | `Blockquote ] type blockquote_content = [ | flow5 ] type blockquote_content_fun = [ | flow5 ] type blockquote_attrib = [ | common | `Cite ] (* NAME: div, KIND: star, TYPE: [= common ], [= flow5 ], [=`Div], ARG: [= flow5 ], ATTRIB: OUT: [=`Div] *) type div = [ | `Div ] type div_content = [ | flow5 ] type div_content_fun = [ | flow5 ] type div_attrib = [ | common ] (* NAME: ol, KIND: star, TYPE: [= common | `Reserved |`Start ], [= `Li of [= common | `Int_Value ]], [=`Ol], ARG: [= `Li of [= common | `Int_Value ]], ATTRIB: OUT: [=`Ol] *) type ol = [ | `Ol ] type ol_content = [ | `Li of [ | common | `Int_Value ] ] type ol_content_fun = [ | `Li of [ | common | `Int_Value ] ] type ol_attrib = [ | common | `Reversed | `Start ] (* NAME: li, KIND: star, TYPE: [= common | `Int_Value] as 'a, [=flow5 ], [=`Li of 'a], ARG: [=flow5 ], ATTRIB: OUT: [=`Li of 'a] *) type li_content = [ | flow5 ] type li_content_fun = [ | flow5 ] type li_attrib = [ | common | `Int_Value ] type li = [ | `Li of li_attrib ] (* NAME: ul, KIND: star, TYPE: [= common ], [= `Li of [= common] ], [=`Ul], ARG: [= `Li of [= common] ], ATTRIB: OUT: [=`Ul] *) type ul = [ | `Ul ] type ul_content = [ | `Li of [ | li_attrib ] ] type ul_content_fun = [ | `Li of [ | li_attrib ] ] type ul_attrib = [ | common ] (* NAME: dd, KIND: star, TYPE: [= common ], [= flow5 ], [=`Dd], ARG: [= flow5 ], ATTRIB: OUT: [=`Dd] *) type dd = [ | `Dd ] type dd_content = [ | flow5 ] type dd_content_fun = [ | flow5 ] type dd_attrib = [ | common ] (* NAME: dt, KIND: star, TYPE: [= common ], [= phrasing], [=`Dt], ARG: [= phrasing], ATTRIB: OUT: [=`Dt] *) type dt = [ | `Dt ] type dt_content = [ | phrasing ] type dt_content_fun = [ | phrasing ] type dt_attrib = [ | common ] (* NAME: figcaption, KIND: star, TYPE: [= common ], [= flow5], [=`Figcaption], ARG: [= flow5], ATTRIB: OUT: [=`Figcaption] *) type figcaption = [ | `Figcaption ] type figcaption_content = [ | flow5 ] type figcaption_content_fun = [ | flow5 ] type figcaption_attrib = [ | common ] (* NAME: hr, KIND: nullary, TYPE: [= common ], [=`Hr], ARG: notag, ATTRIB: OUT: [=`Hr] *) type hr = [ | `Hr ] type hr_content = notag type hr_content_fun = notag type hr_attrib = [ | common ] (* NAME: b, KIND: star, TYPE: [= common ], [= phrasing ], [=`B], ARG: [= phrasing ], ATTRIB: OUT: [=`B] *) type b = [ | `B ] type b_content = [ | phrasing ] type b_content_fun = [ | phrasing ] type b_attrib = [ | common ] (* NAME: i, KIND: star, TYPE: [= common ], [= phrasing ], [=`I], ARG: [= phrasing ], ATTRIB: OUT: [=`I] *) type i = [ | `I ] type i_content = [ | phrasing ] type i_content_fun = [ | phrasing ] type i_attrib = [ | common ] (* NAME: u, KIND: star, TYPE: [= common ], [= phrasing ], [=`U], ARG: [= phrasing ], ATTRIB: OUT: [=`U] *) type u = [ | `U ] type u_content = [ | phrasing ] type u_content_fun = [ | phrasing ] type u_attrib = [ | common ] (* NAME: small, KIND: star, TYPE: [= common ], [= phrasing ], [=`Small], ARG: [= phrasing ], ATTRIB: OUT: [=`Small] *) type small = [ | `Small ] type small_content = [ | phrasing ] type small_content_fun = [ | phrasing ] type small_attrib = [ | common ] (* NAME: sub, KIND: star, TYPE: [= common ], [= phrasing ], [=`Sub], ARG: [= phrasing ], ATTRIB: OUT: [=`Sub] *) type sub = [ | `Sub ] type sub_content = [ | phrasing ] type sub_content_fun = [ | phrasing ] type sub_attrib = [ | common ] (* NAME: sup, KIND: star, TYPE: [= common ], [= phrasing ], [=`Sup], ARG: [= phrasing ], ATTRIB: OUT: [=`Sup] *) type sup = [ | `Sup ] type sup_content = [ | phrasing ] type sup_content_fun = [ | phrasing ] type sup_attrib = [ | common ] (* NAME: mark, KIND: star, TYPE: [= common ],[= phrasing ],[= `Mark ], ARG: [= phrasing ], ATTRIB: OUT: [= `Mark ] *) type mark = [ | `Mark ] type mark_content = [ | phrasing ] type mark_content_fun = [ | phrasing ] type mark_attrib = [ | common ] (* NAME: wbr, KIND: nullary, TYPE: [= common ],[= `Wbr ], ARG: notag, ATTRIB: OUT: [= `Wbr ] *) type wbr = [ | `Wbr ] type wbr_content = notag type wbr_content_fun = notag type wbr_attrib = [ | common ] (* NAME: bdo, KIND: star, TYPE: [= common ],[= phrasing ],[= `Bdo ], ARG: [= phrasing ], ATTRIB: OUT: [= `Bdo ] *) type bdo = [ | `Bdo ] type bdo_content = [ | phrasing ] type bdo_content_fun = [ | phrasing ] type bdo_attrib = [ | common ] (* NAME: abbr, KIND: star, TYPE: [= common ], [=phrasing ], [=`Abbr], ARG: [=phrasing ], ATTRIB: OUT: [=`Abbr] *) type abbr = [ | `Abbr ] type abbr_content = [ | phrasing ] type abbr_content_fun = [ | phrasing ] type abbr_attrib = [ | common ] (* NAME: br, KIND: nullary, TYPE: [= common ], [=`Br], ARG: notag, ATTRIB: OUT: [=`Br] *) type br = [ | `Br ] type br_content = notag type br_content_fun = notag type br_attrib = [ | common ] (* NAME: cite, KIND: star, TYPE: [= common ], [= phrasing ], [=`Cite], ARG: [= phrasing ], ATTRIB: OUT: [=`Cite] *) type cite = [ | `Cite ] type cite_content = [ | phrasing ] type cite_content_fun = [ | phrasing ] type cite_attrib = [ | common ] (* NAME: code, KIND: star, TYPE: [= common ], [= phrasing ], [=`Code], ARG: [= phrasing ], ATTRIB: OUT: [=`Code] *) type code = [ | `Code ] type code_content = [ | phrasing ] type code_content_fun = [ | phrasing ] type code_attrib = [ | common ] (* NAME: dfn, KIND: star, TYPE: [= common ], [= phrasing_without_dfn ], [=`Dfn], ARG: [= phrasing_without_dfn ], ATTRIB: OUT: [=`Dfn] *) type dfn = [ | `Dfn ] type dfn_content = [ | phrasing_without_dfn ] type dfn_content_fun = [ | phrasing_without_dfn ] type dfn_attrib = [ | common ] (* NAME: em, KIND: star, TYPE: [= common ], [= phrasing ], [=`Em], ARG: [= phrasing ], ATTRIB: OUT: [=`Em] *) type em = [ | `Em ] type em_content = [ | phrasing ] type em_content_fun = [ | phrasing ] type em_attrib = [ | common ] (* NAME: kbd, KIND: star, TYPE: [= common ], [= phrasing ], [=`Kbd], ARG: [= phrasing ], ATTRIB: OUT: [=`Kbd] *) type kbd = [ | `Kbd ] type kbd_content = [ | phrasing ] type kbd_content_fun = [ | phrasing ] type kbd_attrib = [ | common ] (* NAME: q, KIND: star, TYPE: [= common | `Cite ], [= phrasing ], [=`Q], ARG: [= phrasing ], ATTRIB: OUT: [=`Q] *) type q = [ | `Q ] type q_content = [ | phrasing ] type q_content_fun = [ | phrasing ] type q_attrib = [ | common | `Cite ] (* NAME: samp, KIND: star, TYPE: [= common ], [= phrasing ], [=`Samp], ARG: [= phrasing ], ATTRIB: OUT: [=`Samp] *) type samp = [ | `Samp ] type samp_content = [ | phrasing ] type samp_content_fun = [ | phrasing ] type samp_attrib = [ | common ] (* NAME: span, KIND: star, TYPE: [= common ], [= phrasing ], [=`Span], ARG: [= phrasing ], ATTRIB: OUT: [=`Span] *) type span = [ | `Span ] type span_content = [ | phrasing ] type span_content_fun = [ | phrasing ] type span_attrib = [ | common ] (* NAME: strong, KIND: star, TYPE: [= common ], [= phrasing ], [=`Strong], ARG: [= phrasing ], ATTRIB: OUT: [=`Strong] *) type strong = [ | `Strong ] type strong_content = [ | phrasing ] type strong_content_fun = [ | phrasing ] type strong_attrib = [ | common ] (* NAME: time, KIND: star, TYPE: [= common |`Datetime |`Pubdate], [= phrasing_without_time ], [=`Time], ARG: [= phrasing_without_time ], ATTRIB: OUT: [=`Time] *) type time = [ | `Time ] type time_content = [ | phrasing_without_time ] type time_content_fun = [ | phrasing_without_time ] type time_attrib = [ | common | `Datetime | `Pubdate ] (* NAME: var, KIND: star, TYPE: [= common ], [= phrasing ], [=`Var], ARG: [= phrasing ], ATTRIB: OUT: [=`Var] *) type var = [ | `Var ] type var_content = [ | phrasing ] type var_content_fun = [ | phrasing ] type var_attrib = [ | common ] (* NAME: a, KIND: star, TYPE: [= common | `Href | `Hreflang | `Media | `Rel | `Target | `Mime_type ], 'a, [= `A of 'a ], ARG: 'a, ATTRIB: OUT: [= `A of 'a ] *) type a_content = flow5_without_interactive type a_content_fun = flow5_without_interactive type 'a a = [ | `A of 'a ] type a_ = [ `A of a_content ] (* should not be used as it may break *) type a_attrib = [ | common | `Href | `Hreflang | `Media | `Rel | `Target | `Mime_type ] (* NAME: del, KIND: star, TYPE: [= common | `Cite | `Datetime ], 'a,[=`Del of 'a], ARG: 'a, ATTRIB: OUT: [=`Del of 'a] *) type 'a del = [ | `Del of 'a ] type del_content = flow5 type del_ = del_content del type del_content_fun = flow5 type del_attrib = [ | common | `Cite | `Datetime ] (* NAME: ins, KIND: star, TYPE: [= common | `Cite | `Datetime ],'a ,[=`Ins of 'a], ARG: 'a , ATTRIB: OUT: [=`Ins of 'a] *) type 'a ins = [ | `Ins of 'a ] type ins_content = flow5 type ins_ = ins_content ins type ins_content_fun = flow5 type ins_attrib = [ | common | `Cite | `Datetime ] (* NAME: iframe, KIND: ndbox, TYPE: *| `Srcdoc*, ARG: , ATTRIB: OUT: *) type iframe = [ | `Iframe ] type iframe_content = [ | `PCDATA ] type iframe_content_fun = [ | `PCDATA ] type iframe_attrib = [ | common | `Src | (*| `Srcdoc*) `Name | `Sandbox | `Seamless | `Width | `Height ] type object__content = [ | flow5 | `Param ] type object__content_fun = flow5 type 'a object_ = [ | `Object of 'a | `Object_interactive of 'a] type object__ = object__content object_ type object__attrib = [ | common | `Data | `Form | `Mime_type | `Height | `Width | `Name | `Usemap ] (* NAME: param, KIND: nullary, TYPE: [= common | `Name | `Text_Value ],[= `Param ], ARG: notag, ATTRIB: OUT: [= `Param ] *) type param = [ | `Param ] type param_content = notag type param_content_fun = notag type param_attrib = [ | common | `Name | `Text_Value ] (* NAME: embed, KIND: nullary, TYPE: [= common | `Src | `Height | `Mime_type | `Width], [=`Embed], ARG: notag, ATTRIB: OUT: [=`Embed] *) type embed = [ | `Embed ] type embed_content = notag type embed_content_fun = notag type embed_attrib = [ | common | `Src | `Height | `Mime_type | `Width ] type 'a audio = [ | `Audio of 'a | `Audio_interactive of 'a ] type audio_content = flow5_without_media type audio_ = audio_content audio type audio_content_fun = flow5_without_media type audio_attrib = [ | common | `Poster | `Preload | `Autoplay | `Loop | `Controls | `Width | `Height ] type 'a video = [ | `Video of 'a | `Video_interactive of 'a ] type video_content = flow5_without_media type video_ = video_content video type video_content_fun = flow5_without_media type video_attrib = [ | common | `Poster | `Preload | `Autoplay | `Loop | `Controls | `Width | `Height ] (* NAME: canvas, KIND: star, TYPE: [= common |`Width |`Height],'a, [=`Canvas of 'a], ARG: 'a, ATTRIB: OUT: [=`Canvas of 'a] *) type 'a canvas = [ | `Canvas of 'a ] type canvas_content = flow5 type canvas_ = canvas_content canvas type canvas_content_fun = flow5 type canvas_attrib = [ | common | `Width | `Height ] (* NAME: source, KIND: nullary, TYPE: [= common |`Src |`Mime_type |`Media ], [=`Source], ARG: notag, ATTRIB: OUT: [=`Source] *) type source = [ | `Source ] type source_content = notag type source_content_fun = notag type source_attrib = [ | common | `Src | `Mime_type | `Media ] (* NAME: area, KIND: nullary, TYPE: [= common | `Alt | `Coords | `Shape| `Target | `Rel | `Media| `Hreflang | `Mime_type],[=`Area], ARG: notag, ATTRIB: OUT: [=`Area] *) type area = [ | `Area ] type area_content = notag type area_content_fun = notag type area_attrib = [ | common | `Alt | `Coords | `Shape | `Target | `Rel | `Media | `Hreflang | `Mime_type ] (* NAME: map, KIND: plus, TYPE: [=common | `Name ],'a, [=`Map of 'a], ARG: 'a, ATTRIB: OUT: [=`Map of 'a] *) type 'a map = [ | `Map of 'a ] type map_content = flow5 type map_ = map_content map type map_content_fun = flow5 type map_attrib = [ | common | `Name ] (* NAME: caption, KIND: star, TYPE: [= common ], [= flow5_without_table], [=`Caption], ARG: [= flow5_without_table], ATTRIB: OUT: [=`Caption] *) type caption = [ | `Caption ] type caption_content = [ | flow5_without_table ] type caption_content_fun = [ | flow5_without_table ] type caption_attrib = [ | common ] (* NAME: table, KIND: plus, TYPE: [= common | `Summary ], [= `Tr ], [=`Table], ARG: [= `Tr ], ATTRIB: OUT: [=`Table] *) type table = [ | `Table ] type table_content = [ | `Tr ] type table_content_fun = [ | `Tr ] type table_attrib = [ | common | `Summary ] (* NAME: tablex, KIND: star, TYPE: [= common | `Summary ], [= `Tbody ], [=`Table], ARG: [= `Tbody ], ATTRIB: OUT: [=`Table] *) type tablex = [ | `Table ] type tablex_content = [ | `Tbody ] type tablex_content_fun = [ | `Tbody ] type tablex_attrib = [ | common | `Summary ] (* NAME: colgroup, KIND: star, TYPE: [= common | `Span ],[= `Col ], [=`Colgroup], ARG: [= `Col ], ATTRIB: OUT: [=`Colgroup] *) type colgroup = [ | `Colgroup ] type colgroup_content = [ | `Col ] type colgroup_content_fun = [ | `Col ] type colgroup_attrib = [ | common | `Span ] (* NAME: col, KIND: nullary, TYPE: [= common | `Span], [=`Col], ARG: notag, ATTRIB: OUT: [=`Col] *) type col = [ | `Col ] type col_content = notag type col_content_fun = notag type col_attrib = [ | common | `Span ] (* NAME: thead, KIND: star, TYPE: [= common],[= `Tr ], [=`Thead], ARG: [= `Tr ], ATTRIB: OUT: [=`Thead] *) type thead = [ | `Thead ] type thead_content = [ | `Tr ] type thead_content_fun = [ | `Tr ] type thead_attrib = [ | common ] (* NAME: tbody, KIND: star, TYPE: [= common],[= `Tr ], [=`Tbody], ARG: [= `Tr ], ATTRIB: OUT: [=`Tbody] *) type tbody = [ | `Tbody ] type tbody_content = [ | `Tr ] type tbody_content_fun = [ | `Tr ] type tbody_attrib = [ | common ] (* NAME: tfoot, KIND: star, TYPE: [= common],[= `Tr ], [=`Tfoot], ARG: [= `Tr ], ATTRIB: OUT: [=`Tfoot] *) type tfoot = [ | `Tfoot ] type tfoot_content = [ | `Tr ] type tfoot_content_fun = [ | `Tr ] type tfoot_attrib = [ | common ] (* NAME: td, KIND: star, TYPE: [= common | `Colspan | `Headers | `Rowspan ], [= flow5 ], [=`Td], ARG: [= flow5 ], ATTRIB: OUT: [=`Td] *) type td = [ | `Td ] type td_content = [ | flow5 ] type td_content_fun = [ | flow5 ] type td_attrib = [ | common | `Colspan | `Headers | `Rowspan ] (* NAME: th, KIND: star, TYPE: [= common | `Colspan | `Headers | `Rowspan | `Scope], [= phrasing], [=`Th], ARG: [= phrasing], ATTRIB: OUT: [=`Th] *) type th = [ | `Th ] type th_content = [ | phrasing ] type th_content_fun = [ | phrasing ] type th_attrib = [ | common | `Colspan | `Headers | `Rowspan | `Scope ] (* NAME: tr, KIND: star, TYPE: [= common ],[= `Td | `Th ], [=`Tr], ARG: [= `Td | `Th ], ATTRIB: OUT: [=`Tr] *) type tr = [ | `Tr ] type tr_content = [ | `Td | `Th ] type tr_content_fun = [ | `Td | `Th ] type tr_attrib = [ | common ] (* NAME: form, KIND: plus, TYPE: [= common |`Accept_charset | `Action | `Enctype | `Method | `Name | `Target | `Autocomplete | `Novalidate ], [= flow5_without_form ], [=`Form], ARG: [= flow5_without_form ], ATTRIB: OUT: [=`Form] *) type form = [ | `Form ] type form_content = [ | flow5_without_form ] type form_content_fun = [ | flow5_without_form ] type form_attrib = [ | common | `Accept_charset | `Action | `Enctype | `Method | `Name | `Target | `Autocomplete | `Novalidate ] (* NAME: fieldset, KIND: star, TYPE: [= common | `Disabled | `Form | `Name], [= flow5 ], [=`Fieldset], ARG: [= flow5 ], ATTRIB: OUT: [=`Fieldset] *) type fieldset = [ | `Fieldset ] type fieldset_content = [ | flow5 ] type fieldset_content_fun = [ | flow5 ] type fieldset_attrib = [ | common | `Disabled | `Form | `Name ] (* NAME: legend, KIND: star, TYPE: [= common ],[= phrasing], [=`Legend], ARG: [= phrasing], ATTRIB: OUT: [=`Legend] *) type legend = [ | `Legend ] type legend_content = [ | phrasing ] type legend_content_fun = [ | phrasing ] type legend_attrib = [ | common ] (* NAME: label, KIND: star, TYPE: [= common | `For | `Form ],[= phrasing_without_label], [=`Label], ARG: [= phrasing_without_label], ATTRIB: OUT: [=`Label] *) type label = [ | `Label ] type label_content = [ | phrasing_without_label ] type label_content_fun = [ | phrasing_without_label ] type label_attrib = [ | common | `For | `Form ] (* NAME: input, KIND: nullary, TYPE: [= input_attr ], [=`Input], ARG: notag, ATTRIB: OUT: [=`Input] *) type input = [ | `Input ] type input_content = notag type input_content_fun = notag type input_attrib = [ | common | `Accept | `Alt | `Autocomplete | `Autofocus | `Checked | `Disabled | `Form | `Formation | `Formenctype | `Formmethod | `Formnovalidate | `Formtarget | `Height | `List | `Input_Max | `Maxlength | `Input_Min | `Multiple | `Name | `Pattern | `Placeholder | `ReadOnly | `Required | `Size | `Src | `Step | `Input_Type | `Value | `Width ] type textarea = [ | `Textarea ] type textarea_attrib = [ | common | `Autofocus | `Disabled | `Form | `Maxlength | `Name | `Placeholder | `ReadOnly | `Required | `Wrap | `Rows | `Cols ] type textarea_content = [ | `PCDATA ] type textarea_content_fun = textarea_content (* NAME: button, KIND: star, TYPE: [= button_attr ], [= phrasing_without_interactive ], [=`Button], ARG: [= phrasing_without_interactive ], ATTRIB: OUT: [=`Button] *) type button = [ | `Button ] type button_content = [ | phrasing_without_interactive ] type button_content_fun = [ | phrasing_without_interactive ] type button_attrib = [ | common | `Autofocus | `Disabled | `Form | `Formaction | `Formenctype | `Formmethod | `Formnovalidate | `Formtarget | `Name | `Text_Value | `Button_Type ] (* NAME: select, KIND: star, TYPE: [= common |`Autofocus | `Multiple | `Name | `Size | `Form | `Disabled ], [ `Optgroup | `Option ],[=`Select], ARG: [ `Optgroup | `Option ], ATTRIB: OUT: [=`Select] *) type select = [ | `Select ] type select_content = [ | `Optgroup | `Option ] type select_content_fun = [ | `Optgroup | `Option ] type select_attrib = [ | common | `Autofocus | `Multiple | `Name | `Size | `Form | `Disabled ] (* NAME: datalist, KIND: nullary, TYPE: [= common ], [=`Datalist], ARG: notag, ATTRIB: OUT: [=`Datalist] *) type datalist = [ | `Datalist ] type datalist_content = notag type datalist_content_fun = notag type datalist_attrib = [ | common ] (* NAME: optgroup, KIND: star, TYPE: [= common | `Disabled | `Label ], [= `Option ], [=`Optgroup], ARG: [= `Option ], ATTRIB: OUT: [=`Optgroup] *) type optgroup = [ | `Optgroup ] type optgroup_content = [ | `Option ] type optgroup_content_fun = [ | `Option ] type optgroup_attrib = [ | common | `Disabled | `Label ] type option_attrib = [ | common | `Selected | `Text_Value | `Disabled | `Label | `Value ] type selectoption = [ | `Option ] type option_content_fun = [ | `PCDATA ] type option_content = [ | `PCDATA ] (* NAME: keygen, KIND: nullary, TYPE: [= common | `Autofcus | `Challenge | `Disabled | `Form | `Keytype | `Name ], [=`Keygen], ARG: notag, ATTRIB: OUT: [=`Keygen] *) type keygen = [ | `Keygen ] type keygen_content = notag type keygen_content_fun = notag type keygen_attrib = [ | common | `Autofcus | `Challenge | `Disabled | `Form | `Keytype | `Name ] (* NAME: progress, KIND: star, TYPE: [= common | `Float_Value |`Max| `Form ],[= phrasing_without_progress], [=`Progress], ARG: [= phrasing_without_progress], ATTRIB: OUT: [=`Progress] *) type progress = [ | `Progress ] type progress_content = [ | phrasing_without_progress ] type progress_content_fun = [ | phrasing_without_progress ] type progress_attrib = [ | common | `Float_Value | `Max | `Form ] (* NAME: meter, KIND: star, TYPE: [= common |`Float_Value |`Min |`Max |`Low |`High |`Optimum |`Form],[= phrasing_without_meter ],[=`Meter], ARG: [= phrasing_without_meter ], ATTRIB: OUT: [=`Meter] *) type meter = [ | `Meter ] type meter_content = [ | phrasing_without_meter ] type meter_content_fun = [ | phrasing_without_meter ] type meter_attrib = [ | common | `Float_Value | `Min | `Max | `Low | `High | `Optimum | `Form ] (* NAME: output_elt, KIND: star, TYPE: [= common |`Form |`For_List |`Name],[= phrasing ],[=`Output], ARG: [= phrasing ], ATTRIB: OUT: [=`Output] *) type output_elt = [ | `Output ] type output_elt_content = [ | phrasing ] type output_elt_content_fun = [ | phrasing ] type output_elt_attrib = [ | common | `Form | `For_List | `Name ] (* NAME: details, KIND: star, TYPE: [= common | `Open ], [= flow5] elt, [= `Details], ARG: [= flow5] elt, ATTRIB: OUT: [= `Details] *) type details = [ | `Details ] type details_content = [ | flow5 ] type details_content_fun = [ | flow5 ] type details_attrib = [ | common | `Open ] (* NAME: summary, KIND: star, TYPE: [= common ],[= phrasing ], [=`Summary], ARG: [= phrasing ], ATTRIB: OUT: [=`Summary] *) type summary = [ | `Summary ] type summary_content = [ | phrasing ] type summary_content_fun = [ | phrasing ] type summary_attrib = [ | common ] (* NAME: command, KIND: nullary, TYPE: [= common |`Icon |`Disabled |`Checked|`Radiogroup |`Command_Type], [=`Command], ARG: notag, ATTRIB: OUT: [=`Command] *) type command = [ | `Command ] type command_content = notag type command_content_fun = notag type command_attrib = [ | common | `Icon | `Disabled | `Checked | `Radiogroup | `Command_Type ] (* NAME: menu, KIND: nullary, TYPE: [= common |`Label |`Menu_Type ],[=`Menu], ARG: notag, ATTRIB: OUT: [=`Menu] *) type menu = [ | `Menu ] type menu_content = notag type menu_content_fun = notag type menu_attrib = [ | common | `Label | `Menu_Type ] (* NAME: noscript, KIND: plus, TYPE: [= common ], 'a, [=`Noscript of 'a], ARG: 'a, ATTRIB: OUT: [=`Noscript of 'a] *) type noscript = [ | `Noscript of flow5_without_noscript ] type noscript_content = flow5_without_noscript type noscript_content_fun = flow5_without_noscript type noscript_attrib = [ | common ] (* NAME: meta, KIND: nullary, TYPE: [= common | `Http_equiv | `Name | `Content | `Charset ], [=`Meta], ARG: notag, ATTRIB: OUT: [=`Meta] *) type meta = [ | `Meta ] type meta_content = notag type meta_content_fun = notag type meta_attrib = [ | common | `Http_equiv | `Name | `Content | `Charset | `Property ] (* NAME: style, KIND: star, TYPE: [= common | `Media | `Mime_type | `Scoped ], [= `PCDATA ], [=`Style], ARG: [= `PCDATA ], ATTRIB: OUT: [=`Style] *) type style = [ | `Style ] type style_content = [ | `PCDATA ] type style_content_fun = [ | `PCDATA ] type style_attrib = [ | common | `Media | `Mime_type | `Scoped ] type script = [ | `Script ] type script_attrib = [ | common | `Async | `Charset | `Src | `Defer | `Mime_type ] type script_content = [ | `PCDATA ] type script_content_fun = [ | `PCDATA ] (* NAME: link, KIND: nullary, TYPE: [= common | `Hreflang | `Media | `Rel | `Href | `Sizes | `Mime_type ], [=`Link], ARG: notag, ATTRIB: OUT: [=`Link] *) type link = [ | `Link ] type link_content = notag type link_content_fun = notag type link_attrib = [ | common | `Hreflang | `Media | `Rel | `Href | `Sizes | `Mime_type ] tyxml-2.2.0/lib/Makefile0000644000000000000000000000425012060404012013252 0ustar0000000000000000include ../Makefile.config -include ../Makefile.local FILES_F := xml_iter.ml \ xml_print.ml \ xhtml_f.ml \ svg_f.ml \ html5_f.ml \ FILES := ${FILES_F} xml.ml xhtml.ml svg.ml html5.ml DUCE_INTF := xml_sigs_duce.mli xhtml_types_duce.mli xml_print_duce.mli xhtml_duce.mli DUCE_FILES := xml_print_duce.ml xhtml_duce.ml LIBS := -package netstring # SYNTAX := -ppopt ../syntax/pa_include.cmo -package camlp4 -syntax camlp4o OCAMLC := $(OCAMLFIND) ocamlc ${DBG} ${SYNTAX} OCAMLOPT := $(OCAMLFIND) ocamlopt ${DBG} ${SYNTAX} OCAMLDEP := $(OCAMLFIND) ocamldep ${SYNTAX} OCAMLDUCEC := ${OCAMLDUCEFIND} ocamlc ${DBG} -thread OCAMLDUCEOPT := ${OCAMLDUCEFIND} ocamlopt ${DBG} -thread OCAMLDUCEDEP := ${OCAMLDUCEFIND} ocamldep all: byte opt byte:: ${LIBNAME}.cma ${LIBNAME}_f.cma opt:: ${LIBNAME}.cmxa ${LIBNAME}_f.cmxa ifeq "${NATDYNLINK}" "yes" opt:: ${LIBNAME}.cmxs ${LIBNAME}_f.cmxs endif ${LIBNAME}.cma: $(FILES:.ml=.cmo) $(OCAMLC) -a $^ -o $@ ${LIBNAME}.cmxa: $(FILES:.ml=.cmx) $(OCAMLOPT) -a $^ -o $@ ${LIBNAME}_f.cma: $(FILES_F:.ml=.cmo) $(OCAMLC) -a $^ -o $@ ${LIBNAME}_f.cmxa: $(FILES_F:.ml=.cmx) $(OCAMLOPT) -a $^ -o $@ ########## ifeq "${OCAMLDUCE}" "yes" byte:: ${LIBNAME}_duce.cma opt:: ${LIBNAME}_duce.cmxa ifeq "${NATDYNLINK}" "yes" opt:: ${LIBNAME}_duce.cmxs endif endif ${LIBNAME}_duce.cma: ${DUCE_FILES:.ml=.cmo} ${OCAMLC} -a -o $@ $^ ${LIBNAME}_duce.cmxa: ${DUCE_FILES:.ml=.cmx} ${OCAMLOPT} -a -o $@ $^ ########## ${DUCE_INTF:.mli=.cmi}: %.cmi: %.mli $(OCAMLDUCEC) ${LIBS} -c $< ${DUCE_FILES:.ml=.cmo}: %.cmo: %.ml $(OCAMLDUCEC) ${LIBS} -c $< ${DUCE_FILES:.ml=.cmx}: %.cmx: %.ml $(OCAMLDUCEOPT) ${LIBS} -c $< %.cmi: %.mli $(OCAMLC) ${LIBS} -c $< %.cmo: %.ml $(OCAMLC) ${LIBS} -c $< %.cmx: %.ml $(OCAMLOPT) ${LIBS} -c $< %.cmxs: %.cmxa $(OCAMLOPT) -shared -linkall -o $@ $< # Clean up clean: -rm -f *.cm[ioax] *.cmxa *.cmxs *.o *.a *.annot distclean: clean -rm -f *~ \#* .\#* depend: $(OCAMLDEP) $(filter-out ${DUCE_INTF}, ${wildcard *.mli}) > .depend $(OCAMLDEP) $(filter-out ${DUCE_FILES}, ${wildcard *.ml}) >> .depend ifeq "${OCAMLDUCE}" "yes" ${OCAMLDUCEDEP} ${DUCE_FILES} ${DUCE_INTF} >> .depend endif FORCE: -include .depend tyxml-2.2.0/lib/xml_print_duce.mli0000644000000000000000000000243612060404012015335 0ustar0000000000000000(* Ocsigen * Copyright (C) 2011 Jaap Boender * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Printer for XHTML with Ocamlduce that handles browser specificities properly. *) module Make (I : sig val emptytags : string list end) : Xml_sigs_duce.Printer (* module MakeTypedRaw (TypedXML : XML_sigs_duce.TypedXML) : XML_sigs_duce.RawTypedPrinter *) module Make_typed (Typed_xml : Xml_sigs_duce.Typed_xml) : Xml_sigs_duce.Typed_printer with module Typed_xml := Typed_xml val print: output:(string -> unit) -> ?encode:(string -> string) -> Ocamlduce.Load.anyxml -> unit tyxml-2.2.0/lib/html5_f.ml0000644000000000000000000006251312060404012013510 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2004 by Thorsten Ohl * Copyright (C) 2007 by Vincent Balat, Gabriel Kerneis * Copyright (C) 2010 by Cecile Herbelin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (* TODO : - MathML and SVG - forbid construction like that noscript (a [a []]) by playing on interactive_without* *) (* IDEAS: The [a_] prefix would have to be maintained and the only advantage are a potentially better mapping of the XHTML modularization to O'Caml modules. *) open Html5_types module Make(Xml : Xml_sigs.T)(Svg : Svg_sigs.T with module Xml := Xml) = struct module Xml = Xml module Info = struct let content_type = "text/html" let alternative_content_types = ["application/xhtml+xml";"application/xml";"text/xml"] let version = "HTML5-draft" let standard = "http://www.w3.org/TR/html5/" let namespace = "http://www.w3.org/1999/xhtml" let doctype = Xml_print.compose_doctype "html" [] let emptytags = [ "area"; "base"; "br"; "col"; "command"; "embed"; "hr"; "img"; "input"; "keygen"; "link"; "meta"; "param"; "source"; "wbr" ] end type uri = Xml.uri let string_of_uri = Xml.string_of_uri let uri_of_string = Xml.uri_of_string type 'a attrib = Xml.attrib let to_xmlattribs x = x let to_attrib x = x (* VB *) let float_attrib = Xml.float_attrib let int_attrib = Xml.int_attrib let string_attrib = Xml.string_attrib let uri_attrib a s = Xml.uri_attrib a s let space_sep_attrib = Xml.space_sep_attrib let comma_sep_attrib = Xml.comma_sep_attrib let event_handler_attrib = Xml.event_handler_attrib (* Deprecated alias. *) let event_attrib = Xml.event_handler_attrib (* space-separated *) let length_attrib name = function | `Pixels p -> int_attrib name p | `Percent p -> string_attrib name ((string_of_int p) ^ "%") let multilength_attrib name = function | (#length as l) -> length_attrib name l | `Relative 1 -> string_attrib name "*" | `Relative i -> string_attrib name ((string_of_int i) ^ "*") let multilength_to_string = function | `Pixels p -> string_of_int p | `Percent p -> (string_of_int p) ^ "%" | `Relative 1 -> "*" | `Relative i -> (string_of_int i) ^ "*" let multilengths_attrib name multilengths = string_attrib name (String.concat ", " (List.map multilength_to_string multilengths)) let linktype_to_string = function | `Alternate -> "alternate" | `Archives -> "archives" | `Author -> "author" | `Bookmark -> "bookmark" | `External -> "external" | `First -> "first" | `Help -> "help" | `Icon -> "icon" | `Index -> "index" | `Last -> "last" | `License -> "license" | `Next -> "next" | `Nofollow -> "nofollow" | `Noreferrer -> "noreferrer" | `Pingback -> "pingback" | `Prefetch -> "prefetch" | `Prev -> "prev" | `Search -> "search" | `Stylesheet -> "stylesheet" | `Sidebar -> "sidebar" | `Tag -> "tag" | `Up -> "up" | `Other t -> t let linktypes_attrib name linktypes = string_attrib name (String.concat " " (List.map linktype_to_string linktypes)) let mediadesc_to_string = function | `All -> "all" | `Aural -> "aural" | `Braille -> "braille" | `Embossed -> "embossed" | `Handheld -> "handheld" | `Print -> "print" | `Projection -> "projection" | `Screen -> "screen" | `Speech -> "speech" | `TTY -> "tty" | `TV -> "tv" let mediadesc_attrib name mediadescs = string_attrib name (String.concat ", " (List.map mediadesc_to_string mediadescs)) (* Core: *) let a_class = space_sep_attrib "class" let a_id = string_attrib "id" let a_user_data name = string_attrib ("data-" ^ name) let a_title = string_attrib "title" (* I18N: *) let a_xml_lang = string_attrib "xml:lang" (* Style: *) let a_style = string_attrib "style" let a_property = string_attrib "property" (* Events: *) let a_onabort = event_attrib "onabort" let a_onafterprint = event_attrib "onafterprint" let a_onbeforeprint = event_attrib "onbeforeprint" let a_onbeforeunload = event_attrib "onbeforeunload" let a_onblur = event_attrib "onblur" let a_oncanplay = event_attrib "oncanplay" let a_oncanplaythrough = event_attrib "oncanplaythrough" let a_onchange = event_attrib "onchange" let a_onclick = event_attrib "onclick" let a_oncontextmenu = event_attrib "oncontextmenu" let a_ondblclick = event_attrib "ondblclick" let a_ondrag = event_attrib "ondrag" let a_ondragend = event_attrib "ondragend" let a_ondragenter = event_attrib "ondragenter" let a_ondragleave = event_attrib "ondragleave" let a_ondragover = event_attrib "ondragover" let a_ondragstart = event_attrib "ondragstart" let a_ondrop = event_attrib "ondrop" let a_ondurationchange = event_attrib "ondurationchange" let a_onemptied = event_attrib "onemptied" let a_onended = event_attrib "onended" let a_onerror = event_attrib "onerror" let a_onfocus = event_attrib "onfocus" let a_onformchange = event_attrib "onformchange" let a_onforminput = event_attrib "onforminput" let a_onhashchange = event_attrib "onhashchange" let a_oninput = event_attrib "oninput" let a_oninvalid = event_attrib "oninvalid" let a_onmousedown = event_attrib "onmousedown" let a_onmouseup = event_attrib "onmouseup" let a_onmouseover = event_attrib "onmouseover" let a_onmousemove = event_attrib "onmousemove" let a_onmouseout = event_attrib "onmouseout" let a_onmousewheel = event_attrib "onmousewheel" let a_onoffline = event_attrib "onoffline" let a_ononline = event_attrib "ononline" let a_onpause = event_attrib "onpause" let a_onplay = event_attrib "onplay" let a_onplaying = event_attrib "onplaying" let a_onpagehide = event_attrib "onpagehide" let a_onpageshow = event_attrib "onpageshow" let a_onpopstate = event_attrib "onpopstate" let a_onprogress = event_attrib "onprogress" let a_onratechange = event_attrib "onratechange" let a_onreadystatechange = event_attrib "onreadystatechange" let a_onredo = event_attrib "onredo" let a_onresize = event_attrib "onresize" let a_onscroll = event_attrib "onscroll" let a_onseeked = event_attrib "onseeked" let a_onseeking = event_attrib "onseeking" let a_onselect = event_attrib "onselect" let a_onshow = event_attrib "onshow" let a_onstalled = event_attrib "onstalled" let a_onstorage = event_attrib "onstorage" let a_onsubmit = event_attrib "onsubmit" let a_onsuspend = event_attrib "onsuspend" let a_ontimeupdate = event_attrib "ontimeupdate" let a_onundo = event_attrib "onundo" let a_onunload = event_attrib "onunload" let a_onvolumechange = event_attrib "onvolumechange" let a_onwaiting = event_attrib "onwaiting" let a_onkeypress = event_attrib "onkeypress" let a_onkeydown = event_attrib "onkeydown" let a_onkeyup = event_attrib "onkeyup" let a_onload = event_attrib "onload" let a_onloadeddata = event_attrib "onloadeddata" let a_onloadedmetadata = event_attrib "" let a_onloadstart = event_attrib "onloadstart" let a_onmessage = event_attrib "onmessage" (* Other Attributes *) let a_version = string_attrib "version" let a_xmlns = function | `W3_org_1999_xhtml -> string_attrib "xmlns" "http://www.w3.org/1999/xhtml" let a_manifest = uri_attrib "manifest" let a_cite = uri_attrib "cite" let a_xml_space = function | `Preserve -> string_attrib "xml:space" "preserve" let a_accesskey c = string_attrib "accesskey" (String.make 1 c) let a_charset = string_attrib "charset" let a_accept_charset = space_sep_attrib "accept-charset" let a_accept = space_sep_attrib "accept" let a_href = uri_attrib "href" let a_hreflang = string_attrib "hreflang" let a_rel = linktypes_attrib "rel" let a_tabindex = int_attrib "tabindex" let a_mime_type = string_attrib "type" let a_alt = string_attrib "alt" let a_height p = int_attrib "height" p let a_src = uri_attrib "src" let a_width p = int_attrib "width" p let a_for = string_attrib "for" let a_for_list = space_sep_attrib "for" let a_selected = function | `Selected -> string_attrib "selected" "selected" let a_text_value = string_attrib "value" let a_int_value = int_attrib "value" let a_value = string_attrib "value" let a_float_value = float_attrib "value" let a_action = uri_attrib "action" let a_method m = string_attrib "method" (match m with | `Get -> "GET" | `Post -> "POST" | `Put -> "PUT" | `Delete -> "DELETE") let a_enctype = string_attrib "enctype" let a_checked = function | `Checked -> string_attrib "checked" "checked" let a_disabled = function | `Disabled -> string_attrib "disabled" "disabled" let a_readonly = function | `ReadOnly -> string_attrib "readonly" "readonly" let a_maxlength = int_attrib "maxLength" let a_name = string_attrib "name" let a_autocomplete ac = string_attrib "autocomplete" (match ac with | `On -> "on" | `Off -> "off") let a_async = function | `Async -> string_attrib "async" "async" let a_autofocus = function | `Autofocus -> string_attrib "autofocus" "autofocus" let a_autoplay = function | `Autoplay -> string_attrib "autoplay" "autoplay" let a_challenge = string_attrib "challenge" let a_contenteditable ce = string_attrib "contexteditable" (match ce with | `True -> "true" | `False -> "false") let a_contextmenu = string_attrib "contextmenu" let a_controls = function | `Controls -> string_attrib "controls" "controls" let a_dir d = string_attrib "dir" (match d with | `Ltr -> "ltr" | `Rtl -> "rtl") let a_draggable d = string_attrib "draggable" (match d with | `True -> "true" | `False -> "false") let a_form = string_attrib "form" let a_formaction = uri_attrib "formaction" let a_formenctype = string_attrib "formenctype" let a_formmethod m = string_attrib "method" (match m with | `Get -> "GET" | `Post -> "POST" | `Put -> "PUT" | `Delete -> "DELETE") let a_formnovalidate = function | `Formnovalidate -> string_attrib "formnovalidate" "formnovalidate" let a_formtarget = string_attrib "formtarget" let a_hidden = function | `Hidden -> string_attrib "hidden" "hidden" let a_high = float_attrib "high" let a_icon = uri_attrib "icon" let a_ismap = function | `Ismap -> string_attrib "ismap" "ismap" let a_keytype = string_attrib "keytype" let a_list = string_attrib "list" let a_loop = function | `Loop -> string_attrib "loop" "loop" let a_low = float_attrib "low" let a_max = float_attrib "max" let a_input_max = int_attrib "max" let a_min = float_attrib "min" let a_input_min = int_attrib "min" let a_novalidate = function | `Novalidate -> string_attrib "novalidate" "novalidate" let a_open = function | `Open -> string_attrib "open" "open" let a_optimum = float_attrib "optimum" let a_pattern = string_attrib "pattern" let a_placeholder = string_attrib "placeholder" let a_poster = uri_attrib "poster" let a_preload pl = string_attrib "preload" (match pl with | `None -> "none" | `Metadata -> "metadata" | `Audio -> "audio") let a_pubdate = function | `Pubdate -> string_attrib "pubdate" "pubdate" let a_radiogroup = string_attrib "radiogroup" let a_required = function | `Required -> string_attrib "required" "required" let a_reversed = function | `Reversed -> string_attrib "reserved" "reserved" let rec a_sandbox sb = let rec aux sb = match sb with | `AllowSameOrigin :: a -> "allow-same-origin" :: (aux a) | `AllowForms :: a -> "allow-forms" :: (aux a) | `AllowScript :: a -> "allow-script" :: (aux a) | [] -> [] in space_sep_attrib "sandbox" (aux sb) let a_spellcheck sc = string_attrib "spellckeck" (match sc with | `True -> "true" | `False -> "false") let a_scoped = function | `Scoped -> string_attrib "scoped" "scoped" let a_seamless = function | `Seamless -> string_attrib "seamless" "seamless" let a_sizes sizes = string_attrib "sizes" (String.concat " " (List.map string_of_int sizes)) let a_span = int_attrib "span" (*let a_srcdoc*) let a_srclang = string_attrib "xml:lang" let a_start = int_attrib "start" let a_step = float_attrib "step" let a_wrap w = string_attrib "wrap" (match w with | `Soft -> "soft" | `Hard -> "hard") let a_size = int_attrib "size" let a_input_type it = string_attrib "type" (match it with | `Url -> "url" | `Tel -> "tel" | `Text -> "text" | `Time -> "time" | `Search -> "search" | `Password -> "password" | `Checkbox -> "checkbox" | `Range -> "range" | `Radio -> "radio" | `Submit -> "submit" | `Reset -> "reset" | `Number -> "number" | `Month -> "month" | `Week -> "week" | `File -> "file" | `Email -> "email" | `Image -> "image" | `Date -> "date" | `Datetime -> "datetime" | `Datetime_local -> "datetime-locale" | `Color -> "color" | `Button -> "button" | `Hidden -> "hidden") let a_menu_type mt = string_attrib "type" (match mt with | `Context -> "context" | `Toolbar -> "toolbar") let a_command_type ct = string_attrib "type" (match ct with | `Command -> "command" | `Checkbox -> "checkbox" | `Radio -> "radio") let a_button_type bt = string_attrib "type" (match bt with | `Button -> "button" | `Submit -> "submit" | `Reset -> "reset") let a_multiple = function | `Multiple -> string_attrib "multiple" "multiple" let a_cols = int_attrib "cols" let a_rows = int_attrib "rows" let a_summary = string_attrib "summary" let a_align a = string_attrib "align" (match a with | `Left -> "left" | `Right -> "right" | `Justify -> "justify" | `Char -> "char") let a_axis = string_attrib "axis" let a_colspan = int_attrib "colspan" let a_headers = space_sep_attrib "headers" let a_rowspan = int_attrib "rowspan" let a_scope s = string_attrib "scope" (match s with | `Row -> "row" | `Col -> "col" | `Rowgroup -> "rowgroup" | `Colgroup -> "colgroup") let a_border = int_attrib "border" let a_cellpadding = length_attrib "cellpadding" let a_cellspacing = length_attrib "cellspacing" let a_datapagesize = string_attrib "datapagesize" let a_rules r = string_attrib "rules" (match r with | `None -> "none" | `Groups -> "groups" | `Rows -> "rows" | `Cols -> "cols" | `All -> "all") let a_char c = string_attrib "char" (String.make 1 c) let a_charoff = length_attrib "charoff" let a_data = uri_attrib "data" let a_codetype = string_attrib "codetype" let a_fs_rows mls = multilengths_attrib "rows" mls let a_fs_cols mls = multilengths_attrib "cols" mls let a_frameborder b = int_attrib "frameborder" (match b with | `Zero -> 0 | `One -> 1) let a_marginheight = int_attrib "marginheight" let a_marginwidth = int_attrib "marginwidth" let a_scrolling s = string_attrib "scrolling" (match s with | `Yes -> "yes" | `No -> "no" | `Auto -> "auto") let a_target = string_attrib "target" let a_content = string_attrib "content" let a_http_equiv = string_attrib "http-equiv" let a_media = mediadesc_attrib "media" type 'a elt = Xml.elt type html = [ | `Html ] elt (* NB: These are more general than the ones in xhtml.mli *) type ('a, 'b) nullary = ?a: (('a attrib) list) -> unit -> 'b elt type ('a, 'b, 'c) unary = ?a: (('a attrib) list) -> 'b elt -> 'c elt type ('a, 'b, 'c, 'd) binary = ?a: (('a attrib) list) -> 'b elt -> 'c elt -> 'd elt type ('b, 'c, 'd, 'e) tri = 'b elt -> 'c elt -> 'd elt -> 'e elt type ('a, 'b, 'c) star = ?a: (('a attrib) list) -> ('b elt) list -> 'c elt type ('a, 'b, 'c) plus = ?a: (('a attrib) list) -> 'b elt -> ('b elt) list -> 'c elt let terminal tag ?a () = Xml.leaf ?a tag (* let nullary tag ?a () = Xml.node ?a tag [] *) let unary tag ?a elt = Xml.node ?a tag [ elt ] let binary tag ?a elt1 elt2 = Xml.node ?a tag [ elt1; elt2 ] let tri tag elt1 elt2 elt3 = Xml.node tag [ elt1; elt2; elt3 ] let star tag ?a elts = Xml.node ?a tag elts let plus tag ?a elt elts = Xml.node ?a tag (elt :: elts) let list_of_option = function | Some x -> [ x ] | None -> [] let list_of_list_option = function | Some x -> x | None -> [] let srcs_option = function | Some (`Srcs s) -> s | None -> [] let phrasing_option = function | Some (`Phras p) -> p | None -> [] let ruby_option = function | Some (`Rt_elt r) -> r | Some (`Group g) -> g | None -> [] let body_option = function | Some (`Body b) -> b | Some (`Trs t) -> t | None -> [] let colg_option = function | Some (`Colgroups c) -> c | None -> [] let opts_option = function | Some (`Options o) -> o | Some (`Optgroups o) -> o | None -> [] let li_option = function | Some (`Lis l) -> l | Some (`Flows f) -> f | None -> [] let opt_option = function | Some (`Options o) -> o | Some (`Phras p) -> p | None -> [] let param_option = function | Some (`Params p) -> p | None -> [] let cols_option = function | Some (`Cols c) -> c | Some (`Colgroups c) -> c | None -> [] let body = star "body" let head = plus "head" let title = unary "title" let html = binary "html" let footer = star "footer" let header = star "header" let section = star "section" let nav = star "nav" let pcdata = Xml.pcdata let entity = Xml.entity let space () = entity "nbsp" let cdata = Xml.cdata let cdata_script = Xml.cdata_script let cdata_style = Xml.cdata_style let unsafe_data s = Xml.encodedpcdata s let unsafe_data s = Xml.encodedpcdata s let h1 = star "h1" let h2 = star "h2" let h3 = star "h3" let h4 = star "h4" let h5 = star "h5" let h6 = star "h6" let hgroup = plus "hgroup" let address = star "address" let blockquote = star "blockquote" let div = star "div" let p = star "p" let pre = star "pre" let abbr = star "abbr" let br = terminal "br" let cite = star "cite" let code = star "code" let dfn = star "dfn" let em = star "em" let kbd = star "kbd" let q = star "q" let samp = star "samp" let span = star "span" let strong = star "strong" let time = star "time" let var = star "var" let a = star "a" let dl ?a list = Xml.node ?a "dl" (List.concat (List.map (fun ((elt, elts), (elt', elts')) -> (elt :: elts) @ (elt' :: elts')) list)) let ol = star "ol" let ul = star "ul" let dd = star "dd" let dt = star "dt" let li = star "li" let hr = terminal "hr" let b = star "b" let i = star "i" let u = star "u" let small = star "small" let sub = star "sub" let sup = star "sup" let mark = star "mark" let rp ?(a = []) elts = (a, elts) let rt ?rp ?a elts = match rp with | Some ((a1, e1), (a2, e2)) -> `Rpt (Xml.node ~a: a1 "rp" e1, Xml.node ?a "rt" elts, Xml.node ~a: a2 "rp" e2) | None -> `Rt (Xml.node ?a "rt" elts) let ruby ?a elt elts = let rec aux = function | [] -> [] | (pel, `Rt e) :: l -> pel @ (e :: (aux l)) | (pel, `Rpt (e1, e2, e3)) :: l -> pel @ (e1 :: e2 :: e3 :: (aux l)) in Xml.node ?a "ruby" (aux (elt :: elts)) let wbr = terminal "wbr" (* VB *) type shape = [ | `Rect | `Circle | `Poly | `Default ] let bdo ~dir ?(a = []) elts = Xml.node ~a: ((a_dir dir) :: a) "bdo" elts let a_datetime = string_attrib "datetime" let a_shape d = string_attrib "shape" (match d with | `Rect -> "rect" | `Circle -> "circle" | `Poly -> "poly" | `Default -> "default") let a_coords coords = string_attrib "coords" (String.concat "," (List.map string_of_int coords)) let a_usemap = string_attrib "usemap" let a_defer = function | `Defer -> string_attrib "defer" "defer" let a_label = string_attrib "label" let area ~alt ?(a = []) () = Xml.leaf ~a: ((a_alt alt) :: a) "area" let map = plus "map" let del = star "del" let ins = star "ins" let script ?(a = []) elt = Xml.node ~a "script" [ elt ] let noscript = plus "noscript" let article = star "article" let aside = star "aside" let video_audio name ?srcs ?(a = []) elts = let (a, children) = match srcs with | None -> (a, elts) | Some (uri, srcs) -> (((a_src uri) :: a), (srcs @ elts)) in Xml.node ~a name children let audio = video_audio "audio" let video = video_audio "video" let canvas = star "canvas" let command ~label ?(a = []) () = Xml.leaf ~a: ((a_label label) :: a) "command" let menu ?child ?a () = Xml.node ?a "menu" (li_option child) let embed = terminal "embed" let source = terminal "source" let meter = star "meter" let output_elt = star "output" let form = plus "form" let svg ?(xmlns = "http://www.w3.org/2000/svg") ?(a = []) children = star ~a:(string_attrib "xmlns" xmlns ::(Svg.to_xmlattribs a)) "svg" (Svg.toeltl children) type input_attr = [ | common | `Accept | `Alt | `Autocomplete | `Autofocus | `Checked | `Disabled | `Form | `Formation | `Formenctype | `Formmethod | `Formnovalidate | `Formtarget | `Height | `List | `Input_Max | `Maxlength | `Input_Min | `Multiple | `Name | `Pattern | `Placeholder | `ReadOnly | `Required | `Size | `Src | `Step | `Input_Type | `Value | `Width ] let input = terminal "input" let keygen = terminal "keygen" let label = star "label" let option = unary "option" let select = star "select" let textarea = unary "textarea" let button = star "button" let datalist ?children ?a () = let children = match children with | Some (`Options x) -> x | Some (`Phras x) -> x | None -> [] in Xml.node ?a "datalist" children let progress = star "proress" let legend = star "legend" let details summary ?a children = Xml.node "details" ?a (summary :: children) let summary = star "summary" let fieldset ?legend ?a elts = Xml.node ?a "fieldset" ((list_of_option legend) @ elts) let optgroup ~label ?(a = []) elts = Xml.node ~a: ((a_label label) :: a) "optgroup" elts let figcaption = star "figcaption" let figure ?figcaption ?a elts = Xml.node ?a "figure" ((list_of_option figcaption) @ elts) let caption = star "caption" let table ?caption ?(columns = []) ?thead ?tfoot ?a elt elts = Xml.node ?a "table" ((list_of_option caption) @ (columns @ ((list_of_option thead) @ ((list_of_option tfoot) @ (elt :: elts))))) let tablex ?caption ?(columns = []) ?thead ?tfoot ?a elts = Xml.node ?a "table" ((list_of_option caption) @ (columns @ ((list_of_option thead) @ ((list_of_option tfoot) @ elts)))) let td = star "td" let th = star "th" let tr = star "tr" let colgroup = star "colgroup" let col = terminal "col" let thead = star "thead" let tbody = star "tbody" let tfoot = star "tfoot" let iframe = star "iframe" let object_ ?(params = []) ?(a = []) elts = Xml.node ~a "object" (params @ elts) let param = terminal "param" let img ~src ~alt ?(a = []) () = let a = (a_src src) :: (a_alt alt) :: a in Xml.leaf ~a "img" let meta = terminal "meta" let style ?(a = []) elts = Xml.node ~a "style" elts let link ~rel ~href ?(a = []) () = Xml.leaf ~a: ((a_rel rel) :: (a_href href) :: a) "link" let base = terminal "base" (* VB *) type rt = [ | `Rt of [ | `Rt ] elt | `Rpt of (([ | `Rp ] elt) * ([ | `Rt ] elt) * ([ | `Rp ] elt)) ] type ruby_content = (((phrasing elt) list) * rt) type rp = (((common attrib) list) * ((phrasing elt) list)) (******************************************************************) (* In the following, my own stuffs for Ocsigen -- Vincent: *) let tot x = x let totl x = x let toelt x = x let toeltl x = x type doc = [ `Html ] elt let doc_toelt x = x end tyxml-2.2.0/lib/xml_sigs.mli0000644000000000000000000000750712060404012014152 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2004 Thorsten Ohl * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) module type T = sig type uri val string_of_uri : uri -> string val uri_of_string : string -> uri type aname = string type event_handler type attrib val float_attrib : aname -> float -> attrib val int_attrib : aname -> int -> attrib val string_attrib : aname -> string -> attrib val space_sep_attrib : aname -> string list -> attrib val comma_sep_attrib : aname -> string list -> attrib val event_handler_attrib : aname -> event_handler -> attrib val uri_attrib : aname -> uri -> attrib val uris_attrib : aname -> uri list -> attrib type elt type ename = string val empty : unit -> elt val comment : string -> elt val pcdata : string -> elt val encodedpcdata : string -> elt val entity : string -> elt val leaf : ?a:(attrib list) -> ename -> elt val node : ?a:(attrib list) -> ename -> elt list -> elt val cdata : string -> elt val cdata_script : string -> elt val cdata_style : string -> elt end module type Iterable = sig include T type separator = Space | Comma val aname : attrib -> aname type acontent = private | AFloat of float | AInt of int | AStr of string | AStrL of separator * string list val acontent : attrib -> acontent type econtent = private | Empty | Comment of string | EncodedPCDATA of string | PCDATA of string | Entity of string | Leaf of ename * attrib list | Node of ename * attrib list * elt list val content : elt -> econtent end module type Info = sig val content_type: string val alternative_content_types: string list val version: string val standard: string val namespace: string val doctype: string val emptytags: string list end module type Output = sig type out type m val empty: m val concat: m -> m -> m val put: string -> m val make: m -> out end module type Typed_xml = sig module Xml : T module Info : Info type 'a elt type doc val toelt : 'a elt -> Xml.elt val doc_toelt : doc -> Xml.elt end module type Iterable_typed_xml = sig module Xml : Iterable module Info : Info type 'a elt type doc val toelt : 'a elt -> Xml.elt val doc_toelt : doc -> Xml.elt end module type Printer = sig type xml_elt type out val print_list: ?encode:(string -> string) -> xml_elt list -> out end module type Simple_printer = sig type xml_elt val print_list: output:(string -> unit) -> ?encode:(string -> string) -> xml_elt list -> unit end module type Typed_printer = sig type 'a elt type doc type out val print_list: ?encode:(string -> string) -> 'a elt list -> out val print: ?encode:(string -> string) -> ?advert:string-> doc -> out end module type Typed_simple_printer = sig type 'a elt type doc val print_list: output:(string -> unit) -> ?encode:(string -> string) -> 'a elt list -> unit val print: output:(string -> unit) -> ?encode:(string -> string) -> ?advert:string-> doc -> unit end tyxml-2.2.0/lib/xml_print.mli0000644000000000000000000000576712060404012014347 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2008 Vincent Balat, Mauricio Fernandez * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Printer for XML. *) val encode_unsafe_char : string -> string (** The encoder maps strings to HTML and {e must} encode the unsafe characters ['<'], ['>'], ['"'], ['&'] and the control characters 0-8, 11-12, 14-31, 127 to HTML entities. [encode_unsafe] is the default for [?encode] in [output] and [pretty_print] below. Other implementations are provided by the module [Netencoding] in the {{:http://www.ocaml-programming.de/programming/ocamlnet.html}OcamlNet} library, e.g.: [let encode = Netencoding.Html.encode ~in_enc:`Enc_iso88591 ~out_enc:`Enc_usascii ()], Where national characters are replaced by HTML entities. The user is of course free to write her own implementation. @see OcamlNet *) val encode_unsafe_char_and_at : string -> string (** In addition, encode ["@"] as ["@"] in the hope that this will fool simple minded email address harvesters. *) val compose_decl : ?version:string -> ?encoding:string -> unit -> string (** [encoding] is the name of the character encoding, e.g. ["US-ASCII"] or ["UTF-8"] *) val compose_doctype : string -> string list -> string module Make(Xml : Xml_sigs.Iterable) (I : sig val emptytags : string list end) (O : Xml_sigs.Output) : Xml_sigs.Printer with type out := O.out and type xml_elt := Xml.elt module Make_typed(Xml : Xml_sigs.Iterable) (Typed_xml : Xml_sigs.Typed_xml with module Xml := Xml) (O : Xml_sigs.Output) : Xml_sigs.Typed_printer with type out := O.out and type 'a elt := 'a Typed_xml.elt and type doc := Typed_xml.doc module Make_simple(Xml : Xml_sigs.Iterable)(F : sig val emptytags : string list end) : Xml_sigs.Simple_printer with type xml_elt := Xml.elt module Make_typed_simple(Xml : Xml_sigs.Iterable) (Typed_xml : Xml_sigs.Typed_xml with module Xml := Xml) : Xml_sigs.Typed_simple_printer with type 'a elt := 'a Typed_xml.elt and type doc := Typed_xml.doc tyxml-2.2.0/lib/xml_print.ml0000644000000000000000000001462212060404012014164 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2008 Vincent Balat, Mauricio Fernandez * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) let is_control c = let cc = Char.code c in (cc <= 8 || cc = 11 || cc = 12 || (14 <= cc && cc <= 31) || cc = 127) let encode_unsafe_char s = let b = Buffer.create (String.length s) in String.iter (function | '<' -> Buffer.add_string b "<" | '>' -> Buffer.add_string b ">" | '"' -> Buffer.add_string b """ | '&' -> Buffer.add_string b "&" | c when is_control c -> Buffer.add_string b ("&#" ^ string_of_int (Char.code c) ^ ";") | c -> Buffer.add_char b c) s; Buffer.contents b let encode_unsafe_char_and_at s = let b = Buffer.create (String.length s) in String.iter (function | '<' -> Buffer.add_string b "<" | '>' -> Buffer.add_string b ">" | '"' -> Buffer.add_string b """ | '&' -> Buffer.add_string b "&" | '@' -> Buffer.add_string b "@" | c when is_control c -> Buffer.add_string b ("&#" ^ string_of_int (Char.code c) ^ ";") | c -> Buffer.add_char b c) s; Buffer.contents b let compose_decl ?(version = "1.0") ?(encoding = "UTF-8") () = "\n" let compose_doctype dt args = " "\"" ^ a ^ "\"") args)) ^ ">" module Make(Xml : Xml_sigs.Iterable)(F : sig val emptytags : string list end)(O : Xml_sigs.Output) = struct let (++) = O.concat open Xml let separator_to_string = function | Space -> " " | Comma -> ", " let attrib_value_to_string encode a = match acontent a with | AFloat f -> Printf.sprintf "\"%e\"" f | AInt i -> Printf.sprintf "\"%d\"" i | AStr s -> Printf.sprintf "\"%s\"" (encode s) | AStrL (sep, slist) -> Printf.sprintf "\"%s\"" (encode (String.concat (separator_to_string sep) slist)) let attrib_to_string encode a = Printf.sprintf "%s=%s" (aname a) (attrib_value_to_string encode a) let rec xh_print_attrs encode attrs = match attrs with | [] -> O.empty | attr::queue -> O.put (" "^ attrib_to_string encode attr) ++ xh_print_attrs encode queue and xh_print_text texte = O.put texte and xh_print_closedtag encode tag attrs = if F.emptytags = [] || List.mem tag F.emptytags then (O.put ("<"^tag) ++ xh_print_attrs encode attrs ++ O.put " />") else (O.put ("<"^tag) ++ xh_print_attrs encode attrs ++ O.put (">")) and xh_print_tag encode tag attrs taglist = if taglist = [] then xh_print_closedtag encode tag attrs else (O.put ("<"^tag) ++ xh_print_attrs encode attrs ++ O.put ">" ++ xh_print_taglist encode taglist ++ O.put ("")) and print_nodes encode name xh_attrs xh_taglist queue = xh_print_tag encode name xh_attrs xh_taglist ++ xh_print_taglist encode queue and xh_print_taglist encode taglist = match taglist with | [] -> O.empty | elt :: queue -> match content elt with | Comment texte -> O.put ("") ++ xh_print_taglist encode queue | Entity e -> O.put ("&"^e^";") (* no encoding *) ++ xh_print_taglist encode queue | PCDATA texte -> O.put (encode texte) ++ xh_print_taglist encode queue | EncodedPCDATA texte -> O.put texte ++ xh_print_taglist encode queue | Node (name, xh_attrs, xh_taglist) -> print_nodes encode name xh_attrs xh_taglist queue | Leaf (name, xh_attrs) -> print_nodes encode name xh_attrs [] queue | Empty -> xh_print_taglist encode queue let print_list ?(encode = encode_unsafe_char) foret = O.make (xh_print_taglist encode foret) end module Make_typed(Xml : Xml_sigs.Iterable) (Typed_xml : Xml_sigs.Iterable_typed_xml with module Xml := Xml) (O : Xml_sigs.Output) = struct module P = Make(Xml)(Typed_xml.Info)(O) let (++) = O.concat let print_list ?(encode = encode_unsafe_char) foret = O.make (P.xh_print_taglist encode (List.map Typed_xml.toelt foret)) let print ?(encode = encode_unsafe_char) ?(advert = "") doc = let doc = Typed_xml.doc_toelt doc in let doc = match Xml.content doc with | Xml.Node (n, a, c) -> let a = if List.exists (fun a -> Xml.aname a = "xmlns") a then a else Xml.string_attrib "xmlns" Typed_xml.Info.namespace :: a in Xml.node ~a n c | _ -> doc in O.make (O.put Typed_xml.Info.doctype ++ O.put (if advert <> "" then ("\n") else "\n") ++ P.xh_print_taglist encode [doc]) end module Simple_output(M : sig val put: string -> unit end) = struct type out = unit type m = unit -> unit let empty () = () let concat f1 f2 () = f1 (); f2 () let put s () = M.put s let make f = f () end module Make_simple(Xml : Xml_sigs.Iterable)(I : sig val emptytags : string list end) = struct type elt = Xml.elt type out = unit let print_list ~output = let module M = Make(Xml)(I)(Simple_output(struct let put = output end)) in M.print_list end module Make_typed_simple(Xml : Xml_sigs.Iterable) (Typed_xml : Xml_sigs.Typed_xml with module Xml := Xml) = struct type out = unit type 'a elt = 'a Typed_xml.elt type doc = Typed_xml.doc let print_list ~output = let module M = Make_typed(Xml)(Typed_xml)(Simple_output(struct let put = output end)) in M.print_list let print ~output = let module M = Make_typed(Xml)(Typed_xml)(Simple_output(struct let put = output end)) in M.print end tyxml-2.2.0/lib/svg_f.mli0000644000000000000000000000571112060404012013424 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Typesafe constructors for SVG documents (Functorial interface) *) (** This module defines basic data types for data, attributes and element occuring in SVG documents. It is based on the specification available at http://www.w3.org/TR/SVG/. This module is experimental, it may lack of some attributes, and the interface is very low level and do not take deeply into account the needs of SVG elements. *) (* open Svg_types module Unit : sig open Unit val rel: float -> 'a quantity (** Do not specify the unit *) val deg : float -> angle val grad : float -> angle val rad : float -> angle val s : float -> time val ms : float -> time val em : float -> length val ex : float -> length val px : float -> length val in_ : float -> length val cm : float -> length val mm : float -> length val pt : float -> length val pc : float -> length val hz : float -> frequency val khz : float -> frequency val string_of_angle : angle -> string val string_of_time : time -> string val string_of_length : length -> string val string_of_freq : frequency -> string end open Unit val string_of_number : number -> string val string_of_number_optional_number : number_optional_number -> string val string_of_percentage : percentage -> string val string_of_strings : strings -> string val string_of_spacestrings : spacestrings -> string val string_of_commastrings : commastrings -> string val string_of_fourfloats : fourfloats -> string val string_of_numbers : numbers -> string val string_of_numbers_semicolon : numbers_semicolon -> string val string_of_lengths : lengths -> string val string_of_coord : coord -> string val string_of_coords : coords -> string val string_of_transform : transform -> string val string_of_transforms : transforms -> string *) module Make(Xml : Xml_sigs.T) : Svg_sigs.T with type Xml.uri = Xml.uri and type Xml.event_handler = Xml.event_handler and type Xml.attrib = Xml.attrib and type Xml.elt = Xml.elt and type +'a elt = Xml.elt and type 'a attrib = Xml.attrib and type uri = Xml.uri tyxml-2.2.0/lib/xml_iter.ml0000644000000000000000000001546112060404012013775 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2004 Thorsten Ohl * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) module Make(Xml : Xml_sigs.Iterable) = struct open Xml (** Iterators *) let amap1 f n = match content n with | Empty | Comment _ | PCDATA _ | EncodedPCDATA _ | Entity _ -> n | Leaf (name, attribs) -> leaf ~a:(f name attribs) name | Node (name, attribs, elts) -> node ~a:(f name attribs) name elts let rec amap f n = match content n with | Empty | Comment _ | PCDATA _ | EncodedPCDATA _ | Entity _ -> n | Leaf (name, attribs) -> leaf ~a:(f name attribs) name | Node (name, attribs, elts) -> node ~a:(f name attribs) name (List.map (amap f) elts) let rec add_float_attrib name value = function | [] -> [float_attrib name value] | head :: tail when aname head = name -> float_attrib name value :: tail | head :: tail -> head :: add_float_attrib name value tail let rec map_float_attrib is_attrib f l = let aux head = match acontent head with | AFloat value when is_attrib (aname head) -> float_attrib (aname head) (f value) | _ -> head in List.map aux l let rec add_int_attrib name value = function | [] -> [int_attrib name value] | head :: tail when aname head = name -> int_attrib name value :: tail | head :: tail -> head :: add_int_attrib name value tail let rec rm_attrib is_attrib = function | [] -> [] | head :: tail when is_attrib (aname head) -> rm_attrib is_attrib tail | head :: tail -> head :: rm_attrib is_attrib tail let rec map_int_attrib is_attrib f l = let aux head = match acontent head with | AInt value when is_attrib (aname head) -> int_attrib (aname head) (f value) | _ -> head in List.map aux l let rec add_string_attrib name value = function | [] -> [string_attrib name value] | head :: tail when aname head = name -> string_attrib name value :: tail | head :: tail -> head :: add_string_attrib name value tail let rec map_string_attrib is_attrib f l = let aux head = match acontent head with | AStr value when is_attrib (aname head) -> string_attrib (aname head) (f value) | _ -> head in List.map aux l let rec add_space_sep_attrib name value = function | [] -> [space_sep_attrib name [value]] | head :: tail -> match acontent head with | AStrL (Space, values') when aname head = name -> space_sep_attrib name (value :: values') :: tail | _ when aname head = name -> space_sep_attrib name [value] :: tail | _ -> head :: add_space_sep_attrib name value tail let rec add_comma_sep_attrib name value = function | [] -> [comma_sep_attrib name [value]] | head :: tail -> match acontent head with | AStrL (Comma, values') when aname head = name -> comma_sep_attrib name (value :: values') :: tail | _ when aname head = name -> comma_sep_attrib name [value] :: tail | _ -> head :: add_comma_sep_attrib name value tail let rec rm_attrib_from_list is_attrib is_value = function | [] -> [] | head :: tail -> match acontent head with | AStrL (sep, values) when is_attrib (aname head) -> begin match List.filter (fun v -> not (is_value v)) values with | [] -> tail | values' -> match sep with | Space -> space_sep_attrib (aname head) values' :: tail | Comma -> comma_sep_attrib (aname head) values' :: tail end | _ -> head :: rm_attrib_from_list is_attrib is_value tail let rec map_string_attrib_in_list is_attrib f l = let aux head = match acontent head with | AStrL (sep, values) when is_attrib (aname head) -> begin match sep with | Comma -> comma_sep_attrib (aname head) (List.map f values) | Space -> space_sep_attrib (aname head) (List.map f values) end | _ -> head in List.map aux l let rec fold of_empty of_comment of_pcdata of_encodedpcdata of_entity of_leaf of_node n = match content n with | Empty -> of_empty () | Comment s -> of_comment s | PCDATA s -> of_pcdata s | EncodedPCDATA s -> of_encodedpcdata s | Entity s -> of_entity s | Leaf (name, attribs) -> of_leaf name attribs | Node (name, attribs, elts) -> of_node name attribs (List.map (fold of_empty of_comment of_pcdata of_encodedpcdata of_entity of_leaf of_node) elts) (* (* is this AT ALL useful??? *) let rec foldx of_empty of_comment of_pcdata of_entity of_leaf of_node update_state state = function | Empty -> of_empty () | Comment s -> of_comment s | PCDATA s -> of_pcdata s | Entity s -> of_entity s | Leaf (name, attribs) -> of_leaf state name attribs | Node (name, attribs, elts) -> of_node state name attribs (List.map (foldx of_empty of_comment of_pcdata of_entity of_leaf of_node update_state (update_state name attribs state)) elts) *) let all_attribs access ?(is_elt = fun ename -> true) aname elt = let access' ename attribs = if is_elt ename then try [access aname attribs] with Not_found -> [] else [] in fold (fun () -> []) (fun c -> []) (fun p -> []) (fun p -> []) (fun e -> []) access' (fun ename attribs elts -> access' ename attribs @ List.flatten elts) elt let all_entities elt = fold (fun () -> []) (fun c -> []) (fun p -> []) (fun p -> []) (fun e -> [e]) (fun ename attribs -> []) (fun ename attribs elts -> List.flatten elts) elt let rec flatmap f = function | [] -> [] | x :: rest -> f x @ flatmap f rest let translate root_leaf root_node sub_leaf sub_node update_state state n = let rec translate' state n = match content n with | (Empty | Comment _ | PCDATA _ | EncodedPCDATA _ | Entity _) -> [n] | Leaf (name, attribs) -> sub_leaf state name attribs | Node (name, attribs, elts) -> sub_node state name attribs (flatmap (translate' (update_state name attribs state)) elts) in match content n with | (Empty | Comment _ | PCDATA _ | EncodedPCDATA _ | Entity _) -> n | Leaf (name, attribs) -> root_leaf name attribs | Node (name, attribs, elts) -> root_node name attribs (flatmap (translate' state) elts) end tyxml-2.2.0/lib/xml.ml0000644000000000000000000000736612060404012012757 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2004 Thorsten Ohl * Copyright (C) 2007 Gabriel Kerneis * Copyright (C) 2010 Cecile Herbelin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Attributes *) module M = struct type uri = string let uri_of_string s = s let string_of_uri s = s type separator = Space | Comma type aname = string type acontent = | AFloat of float | AInt of int | AStr of string | AStrL of separator * string list type attrib = aname * acontent type event_handler = string let acontent (_, a) = a let aname (name, _) = name let float_attrib name value = name, AFloat value let int_attrib name value = name, AInt value let string_attrib name value = name, AStr value let space_sep_attrib name values = name, AStrL (Space, values) let comma_sep_attrib name values = name, AStrL (Comma, values) let event_handler_attrib name value = name, AStr value let uri_attrib name value = name, AStr value let uris_attrib name values = name, AStrL (Space, values) (* Deprecated alias. *) let event_attrib = event_handler_attrib (** Element *) type ename = string type econtent = | Empty | Comment of string | EncodedPCDATA of string | PCDATA of string | Entity of string | Leaf of ename * attrib list | Node of ename * attrib list * elt list and elt = { elt : econtent ; } let content elt = elt.elt let empty () = { elt = Empty } let comment c = { elt = Comment c } let pcdata d = { elt = PCDATA d } let encodedpcdata d = { elt = EncodedPCDATA d } let entity e = { elt = Entity e } let cdata s = (* GK *) (* For security reasons, we do not allow "]]>" inside CDATA (as this string is to be considered as the end of the cdata) *) let s' = "\n") "" s) ^"\n]]>\n" in encodedpcdata s' let cdata_script s = (* GK *) (* For security reasons, we do not allow "]]>" inside CDATA (as this string is to be considered as the end of the cdata) *) let s' = "\n//") "" s) ^"\n//]]>\n" in encodedpcdata s' let cdata_style s = (* GK *) (* For security reasons, we do not allow "]]>" inside CDATA (as this string is to be considered as the end of the cdata) *) let s' = "\n/* ") "" s) ^"\n/* ]]> */\n" in encodedpcdata s' let leaf ?a name = { elt = (match a with | Some a -> Leaf (name, a) | None -> Leaf (name, [])) } let node ?a name children = { elt = (match a with | Some a -> Node (name, a, children) | None -> Node (name, [], children)) } end include M include Xml_print.Make_simple(M)(struct let emptytags = [] end) include Xml_iter.Make(M) let print fmt x = print_list ~output:(Format.pp_print_string fmt) [x] let print fmt x = Format.fprintf fmt "<< %a >>" print x tyxml-2.2.0/lib/html5_f.mli0000644000000000000000000000264012060404012013654 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2004 by Thorsten Ohl * Copyright (C) 2007 by Vincent Balat, Gabriel Kerneis * Copyright (C) 2010 by Cecile Herbelin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Typesafe constructors for HTML5 documents (Functorial interface) *) module Make(Xml : Xml_sigs.T)(Svg : Svg_sigs.T with module Xml := Xml) : Html5_sigs.T with type Xml.uri = Xml.uri and type Xml.event_handler = Xml.event_handler and type Xml.attrib = Xml.attrib and type Xml.elt = Xml.elt and module Svg := Svg and type +'a elt = Xml.elt and type 'a attrib = Xml.attrib and type uri = Xml.uri tyxml-2.2.0/lib/xml_iter.mli0000644000000000000000000000552012060404012014141 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2004 Thorsten Ohl * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Basic iterators over XML tree (functorial interface). *) module Make(Xml : Xml_sigs.Iterable) : sig open Xml val amap : (ename -> attrib list -> attrib list) -> elt -> elt (** Recursively edit attributes for the element and all its children. *) val amap1 : (ename -> attrib list -> attrib list) -> elt -> elt (** Edit attributes only for one element. *) (** The following can safely be exported by higher level libraries, because removing an attribute from a element is always legal. *) val rm_attrib : (aname -> bool) -> attrib list -> attrib list val rm_attrib_from_list : (aname -> bool) -> (string -> bool) -> attrib list -> attrib list val map_int_attrib : (aname -> bool) -> (int -> int) -> attrib list -> attrib list val map_string_attrib : (aname -> bool) -> (string -> string) -> attrib list -> attrib list val map_string_attrib_in_list : (aname -> bool) -> (string -> string) -> attrib list -> attrib list (** Exporting the following by higher level libraries would drive a hole through a type system, because they allow to add {e any} attribute to {e any} element. *) val add_int_attrib : aname -> int -> attrib list -> attrib list val add_string_attrib : aname -> string -> attrib list -> attrib list val add_comma_sep_attrib : aname -> string -> attrib list -> attrib list val add_space_sep_attrib : aname -> string -> attrib list -> attrib list val fold : (unit -> 'a) -> (string -> 'a) -> (string -> 'a) -> (string -> 'a) -> (string -> 'a) -> (ename -> attrib list -> 'a) -> (ename -> attrib list -> 'a list -> 'a) -> elt -> 'a val all_entities : elt -> string list val translate : (ename -> attrib list -> elt) -> (ename -> attrib list -> elt list -> elt) -> ('state -> ename -> attrib list -> elt list) -> ('state -> ename -> attrib list -> elt list -> elt list) -> (ename -> attrib list -> 'state -> 'state) -> 'state -> elt -> elt end tyxml-2.2.0/lib/xhtml_f.ml0000644000000000000000000005651012060404012013613 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2004 by Thorsten Ohl * Copyright (C) 2007 by Vincent Balat, Gabriel Kerneis * Copyright (C) 2010 by Cecile Herbelin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (* IDEAS: The [a_] prefix would have to be maintained and the only advantage are a potentially better mapping of the XHTML modularization to O'Caml modules. *) (** Typesafe constructors for XHTML 1.1 documents. @see W3C Recommendation *) open Xhtml_types module Version(Xml : Xml_sigs.T) = struct module Xml = Xml type uri = Xml.uri let string_of_uri = Xml.string_of_uri let uri_of_string = Xml.uri_of_string (* Directly from http://www.w3.org/TR/xhtml-modularization/abstract_modules.html *) type core = [ `Class | `Id | `Title | `XML_space ] type i18n = [ `XML_lang | `Dir ] type events = [ `OnClick | `OnDblClick | `OnMouseDown | `OnMouseUp | `OnMouseOver | `OnMouseMove | `OnMouseOut | `OnKeyPress | `OnKeyDown | `OnKeyUp ] type common = [ core | i18n | events | `Style_Attr] type 'a attrib = Xml.attrib let to_xmlattribs x = x (* VB *) let to_attrib x = x let int_attrib = Xml.int_attrib let string_attrib = Xml.string_attrib let uri_attrib = Xml.uri_attrib let uris_attrib = Xml.uris_attrib let space_sep_attrib = Xml.space_sep_attrib let comma_sep_attrib = Xml.comma_sep_attrib let event_handler_attrib = Xml.event_handler_attrib (* Deprecated alias. *) let event_attrib = Xml.event_handler_attrib type cdata = string type id = string type idref = string type idrefs = idref list (* space-separated *) type name = string type nmtoken = string type nmtokens = nmtoken list (* space-separated *) type pcdata = string type character = char type charset = string type charsets = charset list (* space-separated *) type contenttype = string type contenttypes = contenttype list (* comma-separated *) type coords = string list (* Comma separated list of coordinates to use in defining areas. *) type datetime = string type fpi = string type frametarget = string type languagecode = string type length = [ `Pixels of int | `Percent of int ] type linktypes = [`Alternate | `Appendix | `Bookmark | `Chapter | `Contents | `Copyright | `Glossary | `Help | `Index | `Next | `Prev | `Section | `Start | `Stylesheet | `Subsection | `Other of string] list type mediadesc = [ `All | `Aural | `Braille | `Embossed | `Handheld | `Print | `Projection | `Screen | `Speech | `TTY | `TV ] list type multilength = [ length | `Relative of int ] type multilengths = multilength list (* comma-separated *) type number = int type pixels = int type script = string type text = string let length_attrib name = function | `Pixels p -> int_attrib name p | `Percent p -> string_attrib name (string_of_int p ^ "%") let multilength_attrib name = function | #length as l -> length_attrib name l | `Relative 1 -> string_attrib name "*" | `Relative i -> string_attrib name (string_of_int i ^ "*") let multilength_to_string = function | `Pixels p -> string_of_int p | `Percent p -> string_of_int p ^ "%" | `Relative 1 -> "*" | `Relative i -> string_of_int i ^ "*" let multilengths_attrib name multilengths = string_attrib name (String.concat ", " (List.map multilength_to_string multilengths)) let linktype_to_string = function | `Alternate -> "alternate" | `Appendix -> "appendix" | `Bookmark -> "bookmark" | `Chapter -> "chapter" | `Contents -> "contents" | `Copyright -> "copyright" | `Glossary -> "glossary" | `Help -> "help" | `Index -> "index" | `Next -> "next" | `Prev -> "prev" | `Section -> "section" | `Start -> "start" | `Stylesheet -> "stylesheet" | `Subsection -> "subsection" | `Other t -> t let linktypes_attrib name linktypes = string_attrib name (String.concat " " (List.map linktype_to_string linktypes)) let mediadesc_to_string = function | `All -> "all" | `Aural -> "aural" | `Braille -> "braille" | `Embossed -> "embossed" | `Handheld -> "handheld" | `Print -> "print" | `Projection -> "projection" | `Screen -> "screen" | `Speech -> "speech" | `TTY -> "tty" | `TV -> "tv" let mediadesc_attrib name mediadescs = string_attrib name (String.concat ", " (List.map mediadesc_to_string mediadescs)) (* Core: *) let a_class = space_sep_attrib "class" (* class is different on client side. We put the value in xml.ml because this file has a different implementation client side. *) let a_id = string_attrib "id" let a_title = string_attrib "title" (* I18N: *) let a_xml_lang = string_attrib "xml:lang" (* Style: *) let a_style = string_attrib "style" (* Events: *) let a_onblur = event_attrib "onblur" let a_onclick = event_attrib "onclick" let a_ondblclick = event_attrib "ondblclick" let a_onchange = event_attrib "onchange" let a_onfocus = event_attrib "onfocus" let a_onload = event_attrib "onload" let a_onunload = event_attrib "onunload" let a_onreset = event_attrib "onreset" let a_onselect = event_attrib "onselect" let a_onsubmit = event_attrib "onsubmit" let a_onmousedown = event_attrib "onmousedown" let a_onmouseup = event_attrib "onmouseup" let a_onmouseover = event_attrib "onmouseover" let a_onmousemove = event_attrib "onmousemove" let a_onmouseout = event_attrib "onmouseout" let a_onkeypress = event_attrib "onkeypress" let a_onkeydown = event_attrib "onkeydown" let a_onkeyup = event_attrib "onkeyup" (* Other Attributes *) let a_profile = uri_attrib "profile" let a_version = string_attrib "version" let a_xmlns = function | `W3_org_1999_xhtml -> string_attrib "xmlns" "http://www.w3.org/1999/xhtml" let a_cite = uri_attrib "cite" let a_xml_space = function | `Preserve -> string_attrib "xml:space" "preserve" let a_accesskey c = string_attrib "accesskey" (String.make 1 c) let a_charset = string_attrib "charset" let a_accept_charset = string_attrib "accept-charset" let a_accept = string_attrib "accept" let a_href = uri_attrib "href" let a_hreflang = string_attrib "hreflang" let a_rel = linktypes_attrib "rel" let a_rev = linktypes_attrib "rev" let a_tabindex = int_attrib "tabindex" let a_type = string_attrib "type" let a_alt = string_attrib "alt" let a_height p = length_attrib "height" p let a_longdesc = uri_attrib "longdesc" let a_src = uri_attrib "src" let a_width p = length_attrib "width" p let a_for = string_attrib "for" let a_selected = function | `Selected -> string_attrib "selected" "selected" let a_value = string_attrib "value" let a_action = uri_attrib "action" let a_method m = string_attrib "method" (match m with `Get -> "get" | `Post -> "post") let a_enctype = string_attrib "enctype" let a_ismap `Ismap = string_attrib "ismap" "ismap" let a_checked `Checked = string_attrib "checked" "checked" let a_disabled `Disabled = string_attrib "disabled" "disabled" let a_readonly `ReadOnly = string_attrib "readonly" "readonly" let a_maxlength = int_attrib "maxLength" let a_name = string_attrib "name" let a_span = int_attrib "span" let a_value_type it = string_attrib "valuetype" (match it with | `Data -> "data" | `Ref -> "ref" | `Object -> "object") (* XHTML 1.0 allows the name attribute for more elements:*) let a_name_01_00 = string_attrib "name" let a_size = int_attrib "size" let a_input_type it = string_attrib "type" (match it with | `Text -> "text" | `Password -> "password" | `Checkbox -> "checkbox" | `Radio -> "radio" | `Submit -> "submit" | `Reset -> "reset" | `File -> "file" | `Image -> "image" | `Button -> "button" | `Hidden -> "hidden") let a_button_type bt = string_attrib "type" (match bt with | `Button -> "button" | `Submit -> "submit" | `Reset -> "reset") let a_multiple = function | `Multiple -> string_attrib "multiple" "multiple" let a_cols = int_attrib "cols" let a_rows = int_attrib "rows" let a_summary = string_attrib "summary" let a_abbr = string_attrib "attrib" let a_align a = string_attrib "align" (match a with | `Left -> "left" | `Center -> "center" | `Right -> "right" | `Justify -> "justify" | `Char -> "char") let a_axis = string_attrib "axis" let a_colspan = int_attrib "colspan" let a_headers = space_sep_attrib "headers" let a_rowspan = int_attrib "rowspan" let a_scope s = string_attrib "scope" (match s with | `Row -> "row" | `Col -> "col" | `Rowgroup -> "rowgroup" | `Colgroup -> "colgroup") let a_valign v = string_attrib "valign" (match v with | `Top -> "top" | `Middle -> "middle" | `Bottom -> "bottom" | `Baseline -> "baseline") let a_border = int_attrib "border" let a_cellpadding = length_attrib "cellpadding" let a_cellspacing = length_attrib "cellspacing" let a_datapagesize = string_attrib "datapagesize" let a_frame f = string_attrib "frame" (match f with | `Void -> "void" | `Above -> "above" | `Below -> "below" | `Hsides -> "hsides" | `LHS -> "lhs" | `RHS -> "rhs" | `Vsides -> "vsides" | `Box -> "box" | `Border -> "border") let a_rules r = string_attrib "rules" (match r with | `None -> "none" | `Groups -> "groups" | `Rows -> "rows" | `Cols -> "cols" | `All -> "all") let a_char c = string_attrib "char" (String.make 1 c) let a_charoff = length_attrib "charoff" let a_declare `Declare = string_attrib "declare" "declare" let a_classid = uri_attrib "classid" let a_codebase = uri_attrib "codebase" let a_data = uri_attrib "data" let a_codetype = string_attrib "codetype" let a_archive = uris_attrib "archive" let a_standby = string_attrib "standby" let a_fs_rows mls = multilengths_attrib "rows" mls let a_fs_cols mls = multilengths_attrib "cols" mls let a_frameborder b = int_attrib "frameborder" (match b with `Zero -> 0 | `One -> 1) let a_marginheight = int_attrib "marginheight" let a_marginwidth = int_attrib "marginwidth" let a_noresize `Noresize = string_attrib "noresize" "noresize" let a_scrolling s = string_attrib "scrolling" (match s with | `Yes -> "yes" | `No -> "no" | `Auto -> "auto") let a_target = string_attrib "target" let a_content = string_attrib "content" let a_http_equiv = string_attrib "http-equiv" let a_scheme = string_attrib "scheme" let a_media = mediadesc_attrib "media" type 'a elt = Xml.elt type html = [`Html] elt (* NB: These are more general than the ones in xhtml.mli *) type ('a, 'b) nullary = ?a:('a attrib list) -> unit -> 'b elt type ('a, 'b, 'c) unary = ?a:('a attrib list) -> 'b elt -> 'c elt type ('a, 'b, 'c, 'd) binary = ?a:('a attrib list) -> 'b elt -> 'c elt -> 'd elt (* CH *) type ('a, 'b, 'c, 'd, 'e, 'f) quadry= ?a:('a attrib list) -> 'b elt -> 'c elt -> 'd elt -> 'e elt -> 'f elt (* CH *) type ('a, 'b, 'c) star = ?a:('a attrib list) -> 'b elt list -> 'c elt type ('a, 'b, 'c) plus = ?a:('a attrib list) -> 'b elt -> 'b elt list -> 'c elt let terminal tag ?a () = Xml.leaf ?a tag (* let nullary tag ?a () = Xml.node ?a tag [] *) let unary tag ?a elt = Xml.node ?a tag [elt] let binary tag ?a elt1 elt2 = Xml.node ?a tag [elt1; elt2] let star tag ?a elts = Xml.node ?a tag elts let plus tag ?a elt elts = Xml.node ?a tag (elt :: elts) (* CH *) let quadry tag ?a elt1 elt2 elt3 elt4 = Xml.node ?a tag [elt1; elt2; elt3; elt4] (* CH *) module STRUCTURE = struct type t = [ `Body | `Head | `Html | `Title ] end let body = star "body" let head = plus "head" let title = unary "title" let html = binary "html" let pcdata = Xml.pcdata let entity = Xml.entity let space () = entity "nbsp" let cdata = Xml.cdata let cdata_script = Xml.cdata_script let cdata_style = Xml.cdata_style let unsafe_data s = Xml.encodedpcdata s module TEXT = struct type heading = [ `H1 | `H2 | `H3 | `H4 | `H5 | `H6 ] type block = [ `Address | `Blockquote | `Div | `P | `Pre ] type inline = [ `Abbr | `Acronym | `Br | `Cite | `Code | `Dfn | `Em | `Kbd | `Q | `Samp | `Span | `Strong | `Var ] type flow = [ heading | block | inline ] end let h1 = star "h1" let h2 = star "h2" let h3 = star "h3" let h4 = star "h4" let h5 = star "h5" let h6 = star "h6" let address = star "address" let blockquote = star "blockquote" let div = star "div" let p = star "p" let pre = star "pre" let abbr = star "abbr" let acronym = star "acronym" let br = terminal "br" let cite = star "cite" let code = star "code" let dfn = star "dfn" let em = star "em" let kbd = star "kbd" let q = star "q" let samp = star "samp" let span = star "span" let strong = star "strong" let var = star "var" module HYPERTEXT = struct type inline = [ `A ] type flow = inline end let a = star "a" module LIST = struct type list = [ `Dl | `Ol | `Ul ] type t = [ `Dd | `Dt | `Li ] type flow = list end let dl = plus "dl" let ol = plus "ol" let ul = plus "ul" let dd = star "dd" let dt = star "dt" let li = star "li" module PRESENTATION = struct type block = [ `Hr ] type inline = [ `B | `Big | `I | `Small | `Sub | `Sup | `Tt ] type flow = [ inline | block ] end let hr = terminal "hr" let b = star "b" let big = star "big" let i = star "i" let small = star "small" let sub = star "sub" let sup = star "sup" let tt = star "tt" (* VB *) type i18nclass = [ `Bdo ] type shape = [ `Rect | `Circle | `Poly | `Default ] let a_datetime = string_attrib "datetime" let a_dir d = string_attrib "dir" (match d with `Rtl -> "rtl" | `Ltr -> "ltr") (* CH *) let bdo ~dir ?(a = []) elts = Xml.node ~a:(a_dir dir :: a) "bdo" elts (* CH *) let a_shape d = string_attrib "shape" (match d with `Rect -> "rect" | `Circle -> "circle" | `Poly -> "poly" | `Default -> "default") let a_coords coords = string_attrib "coords" (String.concat "," (List.map string_of_int coords)) let a_nohref `Nohref = string_attrib "nohref" "nohref" let a_usemap = string_attrib "usemap" let a_defer `Defer = string_attrib "defer" "defer" let a_label = string_attrib "label" let area ~alt ?(a = []) () = Xml.leaf ~a:(a_alt alt :: a) "area" let map ~id ?(a = []) elt elts = Xml.node ~a:(a_id id :: a) "map" (elt::elts) let del = star "del" let ins = star "ins" let script ~contenttype ?(a = []) elt = Xml.node ~a:(a_type contenttype :: a) "script" [elt] let noscript = plus "noscript" (* VB *) module FORMS = struct type t = [ `Option ] type form = [ `Form ] type formctrl_sans_label = [ `Input | `Select | `Textarea | `Button ] type formctrl = [ `Label | formctrl_sans_label ] type block = form type inline_sans_label = formctrl_sans_label type inline = formctrl type flow_sans_label = [block | inline_sans_label ] type flow = [ block | inline ] end module Basic_Forms = struct let form ~action ?(a = []) elt elts = Xml.node ~a:(a_action action :: a) "form" (elt::elts) let input = terminal "input" let label = star "label" let option = unary "option" let select = plus "select" let textarea ~rows ~cols ?(a = []) elt = Xml.node ~a:(a_rows rows :: a_cols cols :: a) "textarea" [elt] end let form ~action ?(a = []) elt elts = Xml.node ~a:(a_action action :: a) "form" (elt::elts) let input = terminal "input" let label = star "label" let option = unary "option" let select = plus "select" let textarea ~rows ~cols ?(a = []) elt = Xml.node ~a:(a_rows rows :: a_cols cols :: a) "textarea" [elt] let button = star "button" let legend = star "legend" let fieldset = star "fieldset" let optgroup ~label ?(a = []) elt elts = Xml.node ~a:(a_label label :: a) "optgroup" (elt :: elts) module TABLES = struct type t = [ `Caption | `Td | `Th | `Tr ] type block = [ `Table ] type flow = block end let list_of_option = function | Some x -> [x] | None -> [] let list_of_list_option = function | Some x -> x | None -> [] module Basic_Tables = struct let a_align = a_align let a_scope = a_scope let a_valign = a_valign let caption = star "caption" let table ?caption ?a elt elts = Xml.node ?a "table" (list_of_option caption @ elt :: elts) let td = star "td" let th = star "th" let tr = plus "tr" end let caption = star "caption" let cols_option = function | Some (`Cols c) -> c | Some (`Colgroups c) -> c | None -> [] let table ?caption ?columns ?a elt elts = Xml.node ?a "table" (list_of_option caption @ cols_option columns @ elt :: elts) let tablex ?caption ?columns ?thead ?tfoot ?a elt elts = Xml.node ?a "table" (list_of_option caption @ cols_option columns @ list_of_option thead @ list_of_option tfoot @ elt :: elts) let td = star "td" let th = star "th" let tr = plus "tr" let col = terminal "col" let colgroup = star "colgroup" let thead = plus "thead" let tbody = plus "tbody" let tfoot = plus "tfoot" let object_ = star "object" let param ~name ?(a = []) () = Xml.leaf ~a:(a_name name :: a) "param" let img ~src ~alt ?(a = []) () = Xml.leaf ~a:(a_src src :: a_alt alt :: a) "img" let frameset ?noframes ?a elt elts = Xml.node ?a "frameset" (elt :: elts @ (match noframes with None -> [] | Some e -> [e])) let frame ~src ?(a = []) () = Xml.leaf ~a:(a_src src :: a) "frame" let noframes = unary "noframes" let iframe = star "iframe" module METAINFORMATION = struct type t = [ `Meta ] end let meta ~content ?(a = []) () = Xml.leaf ~a:(a_content content :: a) "meta" module STYLE_SHEET = struct type t = [ `Style ] end let style ~contenttype ?(a = []) elts = Xml.node ~a:(a_type contenttype :: a) "style" elts module LINK = struct type t = [ `Link ] end let link = terminal "link" module BASE = struct type t = [ `Base ] end let base ~href ?(a = []) ()= Xml.leaf ~a:(a_href href :: a) "base" let ruby_simple1 = binary "ruby" let ruby_simple2 = quadry "ruby" let ruby_complex = binary "ruby" let rbc = plus "rbc" let rtc = plus "rtc" let rtc_complex= plus "rtc" let rb = star "rb" let rt = star "rt" let rt_complex = star "rt" let rp = star "rp" let a_rbspan = int_attrib "rbspan" (* VB *) type edit = [ `Ins | `Del ] type scripttag = [ `Script | `Noscript ] type misc = [ edit | scripttag ] module SPECIAL = struct type inline = [ `Img | `Map | `Object ] type block = [ `Table | `Form | `Fieldset ] type flow = [ inline | block ] end (* VB *) (* CH *) module RUBY = struct type inline = [ `Ruby_simple1 | `Ruby_simple2 | `Ruby_complex ] type flow = inline end type no_ruby_inline = [ TEXT.inline | PRESENTATION.inline | HYPERTEXT.inline | SPECIAL.inline | FORMS.inline | i18nclass ] type no_ruby_content = [ `PCDATA | no_ruby_inline | misc ] (* CH *) type block = [ TEXT.block | PRESENTATION.block | FORMS.block | TABLES.block | SPECIAL.block | TEXT.heading | LIST.list | misc ] type block_sans_form = [ TEXT.block | PRESENTATION.block | TABLES.block | TEXT.heading | LIST.list | misc ] type flow = [ TEXT.flow | HYPERTEXT.flow | LIST.flow | FORMS.flow | TABLES.flow | PRESENTATION.flow | SPECIAL.flow | i18nclass | misc | RUBY.flow ] type flow_sans_table = [ TEXT.flow | HYPERTEXT.flow | LIST.flow | FORMS.flow | PRESENTATION.flow | SPECIAL.flow | i18nclass | misc | RUBY.flow ] type inline = [ TEXT.inline | HYPERTEXT.inline | PRESENTATION.inline | FORMS.inline | SPECIAL.inline | i18nclass | misc | RUBY.inline ] type inline_sans_a_mix = [ TEXT.inline | PRESENTATION.inline | FORMS.inline | SPECIAL.inline | i18nclass | misc | RUBY.inline ] type buttoncontent = (* VB *) [ TEXT.inline | PRESENTATION.inline | SPECIAL.inline | i18nclass | block_sans_form ] type precontent = inline type inline_sans_label = [ TEXT.inline | HYPERTEXT.inline | PRESENTATION.inline | FORMS.inline_sans_label | SPECIAL.inline | i18nclass | misc ] type heading = TEXT.heading (* let validator = "http://validator.w3.org/check/referer" let compose_validator_icon icon alt = a ~a:[a_href validator] [img ~src:icon ~alt ~a:[a_height (`Pixels 31); a_width (`Pixels 88)] ()] let validator_icon = function | `XHTML_01_00 -> compose_validator_icon "http://www.w3.org/Icons/valid-xhtml10" "Valid XHTML 1.0!" | `XHTML_01_01 -> compose_validator_icon "http://www.w3.org/Icons/valid-xhtml11" "Valid XHTML 1.1!" *) (******************************************************************) (* In the following, my own stuffs for Ocsigen -- Vincent: *) let tot x = x let totl x = x let toelt x = x let toeltl x = x type doc = [ `Html ] elt let doc_toelt x = x end (* The following tags are written
, etc. The other empty tags are written

for html compatibility. See guidelines here: http://www.w3.org/TR/xhtml1/#guidelines *) let emptytags = [ "hr"; "br"; "img"; "meta"; "link"; "input"; "col"; "area"; "param"; "base"; "basefont"; "isindex"; "frame" ] module Make_01_00(Xml : Xml_sigs.T) = struct module M = Version(Xml) include M module Info = struct let content_type = "text/html" let alternative_content_types = ["application/xhtml+xml"] let version = "XHTML 1.0" let standard = "http://www.w3.org/TR/xhtml1/" let namespace = "http://www.w3.org/1999/xhtml" let doctype = Xml_print.compose_doctype "html" ["-//W3C//DTD XHTML 1.0 Strict//EN"; "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"] let emptytags = emptytags end end module Make_01_01(Xml : Xml_sigs.T) = struct module M = Version(Xml) include M module Info = struct let content_type = "text/html" let alternative_content_types = ["application/xhtml+xml"] let version = "XHTML 1.1" let standard = "http://www.w3.org/TR/xhtml11/" let namespace = "http://www.w3.org/1999/xhtml" let doctype = Xml_print.compose_decl () ^ Xml_print.compose_doctype "html" ["-//W3C//DTD XHTML 1.1//EN"; "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"] let emptytags = emptytags end end module Make = Make_01_01 tyxml-2.2.0/lib/svg_sigs.mli0000644000000000000000000005510512060404012014146 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) module type T = sig open Svg_types open Unit module Xml : Xml_sigs.T module Info : Xml_sigs.Info type uri = Xml.uri val string_of_uri : uri -> string val uri_of_string : string -> uri (** {1 Abstraction over XML's types} *) type 'a attrib type +'a elt type +'a elts type ('a, 'b) nullary = ?a: (('a attrib) list) -> unit -> 'b elt type ('a, 'b, 'c) unary = ?a: (('a attrib) list) -> 'b elt -> 'c elt type ('a, 'b, 'c) star = ?a: (('a attrib) list) -> ('b elt) list -> 'c elt type ('a, 'b, 'c) plus = ?a: (('a attrib) list) -> 'b elt -> ('b elt) list -> 'c elt (* to be processed by a script *) type altglyphdef_content = [ | `Ref of (glyphref elt) list | `Item of (altglyphitem elt) list ] (** {1 attributes } *) val a_version : string -> [> | `Version ] attrib val a_baseprofile : string -> [> | `BaseProfile ] attrib val a_x : coord -> [> | `X ] attrib val a_y : coord -> [> | `Y ] attrib val a_width : Unit.length -> [> | `Width ] attrib val a_height : Unit.length -> [> | `Height ] attrib val a_preserveaspectratio : string -> [> | `PreserveAspectRatio ] attrib val a_contentscripttype : string -> [> | `ContentScriptType ] attrib val a_contentstyletype : string -> [> | `ContentStyleType ] attrib val a_zoomAndPan : [< | `Disable | `Magnify ] -> [> | `ZoomAndSpan ] attrib val a_xlink_href : iri -> [> | `Xlink_href ] attrib val a_requiredfeatures : spacestrings -> [> | `RequiredFeatures ] attrib val a_requiredextensions : spacestrings -> [> | `RequiredExtension ] attrib val a_systemlanguage : commastrings -> [> | `SystemLanguage ] attrib val a_externalressourcesrequired : bool -> [> | `ExternalRessourcesRequired ] attrib val a_id : string -> [> | `Id ] attrib val a_xml_base : iri -> [> | `Xml_Base ] attrib val a_xml_lang : iri -> [> | `Xml_Lang ] attrib val a_xml_space : [< `Default | `Preserve ] -> [> | `Xml_Space ] attrib val a_type : string -> [> | `Type ] attrib val a_media : commastrings -> [> | `Media ] attrib val a_title : string -> [> | `Title ] attrib val a_class : spacestrings -> [> | `Class ] attrib val a_style : string -> [> | `Style ] attrib val a_transform : transform -> [> | `Transform ] attrib val a_viewbox : fourfloats -> [> | `Viewbox ] attrib val a_d : string -> [> | `D ] attrib val a_pathlength : float -> [> | `PathLength ] attrib (* XXX: better language support *) val a_rx : Unit.length -> [> | `Rx ] attrib val a_ry : Unit.length -> [> | `Ry ] attrib val a_cx : Unit.length -> [> | `Cx ] attrib val a_cy : Unit.length -> [> | `Cy ] attrib val a_r : Unit.length -> [> | `R ] attrib val a_x1 : coord -> [> | `X1 ] attrib val a_y1 : coord -> [> | `Y1 ] attrib val a_x2 : coord -> [> | `X2 ] attrib val a_y2 : coord -> [> | `Y2 ] attrib val a_points : coords -> [> | `Points ] attrib val a_x_list : lengths -> [> | `X__list ] attrib val a_y_list : lengths -> [> | `Y__list ] attrib val a_dx : lengths -> [> | `Dx ] attrib val a_dy : lengths -> [> | `Dy ] attrib val a_dx_single : Unit.length -> [> | `Dx__single ] attrib val a_dy_single : Unit.length -> [> | `Dy__single ] attrib val a_dx_number : number -> [> | `Dx__number ] attrib val a_dy_number : number -> [> | `Dy__number ] attrib val a_lengthadjust : [< `Spacing | `SpacingAndGlyphs ] -> [> | `LengthAdjust ] attrib val a_textlength : Unit.length -> [> | `TextLength ] attrib val a_rotate : numbers -> [> | `Rotate ] attrib val a_startoffset : Unit.length -> [> | `StartOffset ] attrib val a_method : [< `Align | `Stretch ] -> [> | `Method ] attrib val a_spacing : [< `Auto | `Exact ] -> [> | `Spacing ] attrib val a_glyphref : string -> [> | `GlyphRef ] attrib val a_format : string -> [> | `Format ] attrib val a_markerunits : [< `StrokeWidth | `UserSpaceOnUse ] -> [> | `MarkerUnits ] attrib val a_refx : coord -> [> | `RefX ] attrib val a_refy : coord -> [> | `RefY ] attrib val a_markerwidth : Unit.length -> [> | `MarkerWidth ] attrib val a_markerheight : Unit.length -> [> | `MarkerHeight ] attrib val a_orient : [< `Auto | `Angle of angle ] -> [> | `Orient ] attrib val a_local : string -> [> | `Local ] attrib val a_renderingindent : [< | `Auto | `Perceptual | `Relative_colorimetric | `Saturation | `Absolute_colorimetric ] -> [> | `Rendering_Indent ] attrib val a_gradientunits : [< `UserSpaceOnUse | `ObjectBoundingBox ] -> [ | `GradientUnits ] attrib val a_gradienttransform : transforms -> [> | `Gradient_Transform ] attrib val a_spreadmethod : [< `Pad | `Reflect | `Repeat ] -> [> | `SpreadMethod ] attrib val a_fx : coord -> [> | `Fx ] attrib val a_fy : coord -> [> | `Fy ] attrib val a_offset : [< `Number of number | `Percentage of percentage ] -> [> | `Offset ] attrib val a_patternunits : [< `UserSpaceOnUse | `ObjectBoundingBox ] -> [> | `PatternUnits ] attrib val a_patterncontentunits : [< `UserSpaceOnUse | `ObjectBoundingBox ] -> [> | `PatternContentUnits ] attrib val a_patterntransform : transforms -> [> | `PatternTransform ] attrib val a_clippathunits : [< `UserSpaceOnUse | `ObjectBoundingBox ] -> [> | `ClipPathUnits ] attrib val a_maskunits : [< | `UserSpaceOnUse | `ObjectBoundingBox ] -> [> | `MaskUnits ] attrib val a_maskcontentunits : [< | `UserSpaceOnUse | `ObjectBoundingBox ] -> [> | `MaskContentUnits ] attrib val a_primitiveunits : [< | `UserSpaceOnUse | `ObjectBoundingBox ] -> [> | `PrimitiveUnits ] attrib val a_filterres : number_optional_number -> [> | `FilterResUnits ] attrib val a_result : string -> [> | `Result ] attrib val a_in : [< | `SourceGraphic | `SourceAlpha | `BackgroundImage | `BackgroundAlpha | `FillPaint | `StrokePaint | `Ref of string ] -> [> | `In ] attrib val a_in2 : [< | `SourceGraphic | `SourceAlpha | `BackgroundImage | `BackgroundAlpha | `FillPaint | `StrokePaint | `Ref of string ] -> [> | `In2 ] attrib val a_aizmuth : float -> [> | `Azimuth ] attrib val a_elevation : float -> [> | `Elevation ] attrib val a_pointatx : float -> [> | `PointsAtX ] attrib val a_pointaty : float -> [> | `PointsAtY ] attrib val a_pointatz : float -> [> | `PointsAtZ ] attrib val a_specularexponent : float -> [> | `SpecularExponent ] attrib val a_specularconstant : float -> [> | `SpecularConstant ] attrib val a_limitingconeangle : float -> [> | `LimitingConeAngle ] attrib val a_mode : [< | `Normal | `Multiply | `Screen | `Darken | `Lighten ] -> [> | `Mode ] attrib val a_typefecolor : [< | `Matrix | `Saturate | `HueRotate | `LuminanceToAlpha ] -> [> | `Type__fecolor ] attrib val a_values : numbers -> [> | `Values ] attrib val a_transferttype : [< | `Identity | `Table | `Discrete | `Linear | `Gamma ] -> [> | `Type__transfert ] attrib val a_tablevalues : numbers -> [> | `TableValues ] attrib val a_slope : number -> [> | `Slope ] attrib val a_intercept : number -> [> | `Intercept ] attrib val a_amplitude : number -> [> | `Amplitude ] attrib val a_exponent : number -> [> | `Exponent ] attrib val a_offsettransfer : number -> [> | `Offset__transfer ] attrib val a_operator : [< | `Over | `In | `Out | `Atop | `Xor | `Arithmetic ] -> [> | `Operator ] attrib val a_k1 : number -> [> | `K1 ] attrib val a_k2 : number -> [> | `K2 ] attrib val a_k3 : number -> [> | `K3 ] attrib val a_k4 : number -> [> | `K4 ] attrib val a_order : number_optional_number -> [> | `Order ] attrib val a_kernelmatrix : numbers -> [> | `KernelMatrix ] attrib val a_divisor : number -> [> | `Divisor ] attrib val a_bias : number -> [> | `Bias ] attrib val a_kernelunitlength : number_optional_number -> [> | `KernelUnitLength ] attrib val a_targetX : int -> [> | `TargetX ] attrib val a_targetY : int -> [> | `TargetY ] attrib val a_edgemode : [< | `Duplicate | `Wrap | `None ] -> [> | `TargetY ] attrib val a_preservealpha : bool -> [> | `TargetY ] attrib val a_surfacescale : number -> [> | `SurfaceScale ] attrib val a_diffuseconstant : number -> [> | `DiffuseConstant ] attrib val a_scale : number -> [> | `Scale ] attrib val a_xchannelselector : [< | `R | `G | `B | `A ] -> [> | `XChannelSelector ] attrib val a_ychannelselector : [< | `R | `G | `B | `A ] -> [> | `YChannelSelector ] attrib val a_stddeviation : number_optional_number -> [> | `StdDeviation ] attrib val a_operatormorphology : [< | `Erode | `Dilate ] -> [> | `OperatorMorphology ] attrib val a_radius : number_optional_number -> [> | `Radius ] attrib val a_basefrenquency : number_optional_number -> [> | `BaseFrequency ] attrib val a_numoctaves : int -> [> | `NumOctaves ] attrib val a_seed : number -> [> | `Seed ] attrib val a_stitchtiles : [< | `Stitch | `NoStitch ] -> [> | `StitchTiles ] attrib val a_stitchtype : [< | `FractalNoise | `Turbulence ] -> [> | `TypeStitch ] attrib val a_xlinkshow : [< | `New | `Replace ] -> [> | `Xlink_show ] attrib val a_xlinkactuate : [< | `OnRequest ] -> [> | `Xlink_actuate ] attrib val a_target : string -> [> | `Xlink_target ] attrib val a_viewtarget : string -> [> | `ViewTarget ] attrib val a_attributename : string -> [> | `AttributeName ] attrib val a_attributetype : [< | `CSS | `XML | `Auto ] -> [> | `AttributeType ] attrib val a_begin : string -> [> | `Begin ] attrib val a_dur : string -> [> | `Dur ] attrib (* XXX*) val a_min : string -> [> | `Min ] attrib (* XXX *) val a_max : string -> [> | `Max ] attrib (* XXX *) val a_restart : [< | `Always | `WhenNotActive | `Never ] -> [> | `Restart ] attrib val a_repeatcount : string -> [> | `RepeatCount ] attrib (* XXX *) val a_repeatdur : string -> [> | `RepeatDur ] attrib (* XXX *) val a_fill : [< | `Freeze | `Remove ] -> [> | `Fill ] attrib val a_calcmode : [< | `Discrete | `Linear | `Paced | `Spline ] -> [> | `CalcMode ] attrib val a_values_anim : strings -> [> | `Values__anim ] attrib val a_keytimes : strings -> [> | `KeyTimes ] attrib val a_keysplines : strings -> [> | `KeySplines ] attrib val a_from : string -> [> | `From ] attrib val a_to : string -> [> | `To ] attrib val a_by : string -> [> | `By ] attrib val a_additive : [< | `Replace | `Sum ] -> [> | `Additive ] attrib val a_accumulate : [< | `None | `Sum ] -> [> | `Accumulate ] attrib val a_keypoints : numbers_semicolon -> [> | `KeyPoints ] attrib val a_path : string -> [> | `Path ] attrib val a_typeanimatecolor : [ | `Translate | `Scale | `Rotate | `SkewX | `SkewY ] -> [ | `Type__animatecolor ] attrib val a_horiz_origin_x : number -> [> | `Horiz___origin___x ] attrib val a_horiz_origin_y : number -> [> | `Horiz___origin___y ] attrib val a_horiz_adv_x : number -> [> | `Horiz___adv___x ] attrib val a_vert_origin_x : number -> [> | `Vert___origin___x ] attrib val a_vert_origin_y : number -> [> | `Vert___origin___y ] attrib val a_vert_adv_y : number -> [> | `Vert___adv___y ] attrib val a_unicode : string -> [> | `Unicode ] attrib val a_glyphname : string -> [> | `glyphname ] attrib val a_orientation : [< | `H | `V ] -> [> | `Orientation ] attrib val a_arabicform : [< | `Initial | `Medial | `Terminal | `Isolated ] -> [> | `Arabic___form ] attrib val a_lang : string -> [> | `Lang ] attrib val a_u1 : string -> [> | `U1 ] attrib val a_u2 : string -> [> | `U2 ] attrib val a_g1 : string -> [> | `G1 ] attrib val a_g2 : string -> [> | `G2 ] attrib val a_k : string -> [> | `K ] attrib val a_fontfamily : string -> [> | `Font___Family ] attrib val a_fontstyle : string -> [> | `Font___Style ] attrib val a_fontvariant : string -> [> | `Font___Variant ] attrib val a_fontweight : string -> [> | `Font___Weight ] attrib val a_fontstretch : string -> [> | `Font___Stretch ] attrib val a_fontsize : string -> [> | `Font___Size ] attrib val a_unicoderange : string -> [> | `Unicode___Range ] attrib val a_unitsperem : string -> [> | `Units___Per___Em ] attrib val a_stemv : number -> [> | `Stemv ] attrib val a_stemh : number -> [> | `Stemh ] attrib val a_slope : number -> [> | `Slope ] attrib val a_capheight : number -> [> | `Cap___Height ] attrib val a_xheight : number -> [> | `X___Height ] attrib val a_accentheight : number -> [> | `Accent___Height ] attrib val a_ascent : number -> [> | `Ascent ] attrib val a_widths : string -> [> | `Widths ] attrib val a_bbox : string -> [> | `Bbox ] attrib val a_ideographic : number -> [> | `Ideographic ] attrib val a_alphabetic : number -> [> | `Alphabetic ] attrib val a_mathematical : number -> [> | `Mathematical ] attrib val a_hanging : number -> [> | `Hanging ] attrib val a_videographic : number -> [> | `V___Ideographic ] attrib val a_valphabetic : number -> [> | `V___Alphabetic ] attrib val a_vmathematical : number -> [> | `V___Mathematical ] attrib val a_vhanging : number -> [> | `V___Hanging ] attrib val a_underlineposition : number -> [> | `Underline___Position ] attrib val a_underlinethickness : number -> [> | `Underline___Thickness ] attrib val a_strikethroughposition : number -> [> | `Strikethrough___Position ] attrib val a_strikethroughthickness : number -> [> | `Strikethrough___Thickness ] attrib val a_overlineposition : number -> [> | `Overline___Position ] attrib val a_overlinethickness : number -> [> | `Overline___Thickness ] attrib val a_string : string -> [> | `String ] attrib val a_name : string -> [> | `Name ] attrib val a_onabort : string -> [> | `Onabort ] attrib val a_onactivate : string -> [> | `Onactivate ] attrib val a_onbegin : string -> [> | `Onbegin ] attrib val a_onclick : string -> [> | `Onclick ] attrib val a_onend : string -> [> | `Onend ] attrib val a_onerror : string -> [> | `Onerror ] attrib val a_onfocusin : string -> [> | `Onfocusin ] attrib val a_onfocusout : string -> [> | `Onfocusout ] attrib val a_onload : string -> [> | `Onload ] attrib val a_onmousedown : string -> [> | `Onmousdown ] attrib val a_onmouseup : string -> [> | `Onmouseup ] attrib val a_onmouseover : string -> [> | `Onmouseover ] attrib val a_onmouseout : string -> [> | `Onmouseout ] attrib val a_onmousemove : string -> [> | `Onmousemove ] attrib val a_onrepeat : string -> [> | `Onrepeat ] attrib val a_onresize : string -> [> | `Onresize ] attrib val a_onscroll : string -> [> | `Onscroll ] attrib val a_onunload : string -> [> | `Onunload ] attrib val a_onzoom : string -> [> | `Onzoom ] attrib val metadata : ?a: ((metadata_attr attrib) list) -> Xml.elt list -> [> | metadata] elt val foreignobject : ?a: ((foreignobject_attr attrib) list) -> Xml.elt list -> [> | foreignobject] elt (** {1 Elements} *) (* generated *) val svg : ([< | svg_attr], [< | svg_content], [> | svg]) star val g : ([< | g_attr], [< | g_content], [> | g]) star val defs : ([< | defs_attr], [< | defs_content], [> | defs]) star val desc : ([< | desc_attr], [< | desc_content], [> | desc]) unary val title : ([< | title_attr], [< | title_content], [> | title]) unary val symbol : ([< | symbol_attr], [< | symbol_content], [> | symbol]) star val use : ([< | use_attr], [< | use_content], [> | use]) star val image : ([< | image_attr], [< | image_content], [> | image]) star val switch : ([< | switch_attr], [< | switch_content], [> | switch]) star val style : ([< | style_attr], [< | style_content], [> | style]) unary val path : ([< | path_attr], [< | path_content], [> | path]) star val rect : ([< | rect_attr], [< | rect_content], [> | rect]) star val circle : ([< | circle_attr], [< | circle_content], [> | circle]) star val ellipse : ([< | ellipse_attr], [< | ellipse_content], [> | ellipse]) star val line : ([< | line_attr], [< | line_content], [> | line]) star val polyline : ([< | polyline_attr], [< | polyline_content], [> | polyline]) star val polygon : ([< | polygon_attr], [< | polygon_content], [> | polygon]) star val text : ([< | text_attr], [< | text_content], [> | text]) star val tspan : ([< | tspan_attr], [< | tspan_content], [> | tspan]) star val tref : ([< | tref_attr], [< | tref_content], [> | tref]) star val textpath : ([< | textpath_attr], [< | textpath_content], [> | textpath]) star val altglyph : ([< | altglyph_attr], [< | altglyph_content], [> | altglyph]) unary val altglyphdef : ([< | altglyphdef_attr], [< | altglyphdef_content], [> | altglyphdef]) unary val altglyphitem : ([< | altglyphitem_attr], [< | altglyphitem_content], [> | altglyphitem ]) plus val glyphref : ([< | glyphref_attr], [> | glyphref]) nullary val marker : ([< | marker_attr], [< | marker_content], [> | marker]) star val colorprofile : ([< | colorprofile_attr], [< | colorprofile_content], [> | colorprofile ]) star val lineargradient : ([< | lineargradient_attr], [< | lineargradient_content], [> | lineargradient]) star val radialgradient : ([< | radialgradient_attr], [< | radialgradient_content], [> | radialgradient]) star val gradientstop : ([< | gradientstop_attr], [< | gradientstop_content], [> | gradientstop ]) star val pattern : ([< | pattern_attr], [< | pattern_content], [> | pattern]) star val clippath : ([< | clippath_attr], [< | clippath_content], [> | clippath]) star val filter : ([< | filter_attr], [< | filter_content], [> | filter]) star val fedistantlight : ([< | fedistantlight_attr], [< | fedistantlight_content], [> | fedistantlight]) star val fepointlight : ([< | fepointlight_attr], [< | fepointlight_content], [> | fepointlight ]) star val fespotlight : ([< | fespotlight_attr], [< | fespotlight_content], [> | fespotlight]) star val feblend : ([< | feblend_attr], [< | feblend_content], [> | feblend]) star val fecolormatrix : ([< | fecolormatrix_attr], [< | fecolormatrix_content], [> | fecolormatrix]) star val fecomponenttransfer : ([< | fecomponenttransfer_attr], [< | fecomponenttransfer_content], [> | fecomponenttransfer]) star val fefunca : ([< | fefunca_attr], [< | fefunca_content], [> | fefunca]) star val fefuncg : ([< | fefuncg_attr], [< | fefuncg_content], [> | fefuncg]) star val fefuncb : ([< | fefuncb_attr], [< | fefuncb_content], [> | fefuncb]) star val fefuncr : ([< | fefuncr_attr], [< | fefuncr_content], [> | fefuncr]) star val fecomposite : ([< | fecomposite_attr], [< | fecomposite_content], [> | fecomposite]) star val feconvolvematrix : ([< | feconvolvematrix_attr], [< | feconvolvematrix_content], [> | feconvolvematrix]) star val fediffuselighting : ([< | fediffuselighting_attr], [< | fediffuselighting_content], [> | fediffuselighting]) star val fedisplacementmap : ([< | fedisplacementmap_attr], [< | fedisplacementmap_content], [> | fedisplacementmap]) star val feflood : ([< | feflood_attr], [< | feflood_content], [> | feflood]) star val fegaussianblur : ([< | fegaussianblur_attr], [< | fegaussianblur_content], [> | fegaussianblur]) star val feimage : ([< | feimage_attr], [< | feimage_content], [> | feimage]) star val femerge : ([< | femerge_attr], [< | femerge_content], [> | femerge]) star val femorphology : ([< | femorphology_attr], [< | femorphology_content], [> | femorphology ]) star val feoffset : ([< | feoffset_attr], [< | feoffset_content], [> | feoffset]) star val fespecularlighting : ([< | fespecularlighting_attr], [< | fespecularlighting_content], [> | fespecularlighting]) star val fetile : ([< | fetile_attr], [< | fetile_content], [> | fetile]) star val feturbulence : ([< | feturbulence_attr], [< | feturbulence_content], [> | feturbulence ]) star val cursor : ([< | cursor_attr], [< | cursor_content], [> | cursor]) star val a : ([< | a_attr], [< | a_content], [> | a]) star val view : ([< | view_attr], [< | view_content], [> | view]) star val script : ([< | script_attr], [< | script_content], [> | script]) unary val animation : ([< | animation_attr], [< | animation_content], [> | animation]) star val set : ([< | set_attr], [< | set_content], [> | set]) star val animatemotion : ([< | animatemotion_attr], [< | animatemotion_content], [> | animatemotion]) star val mpath : ([< | mpath_attr], [< | mpath_content], [> | mpath]) star val animatecolor : ([< | animatecolor_attr], [< | animatecolor_content], [> | animatecolor ]) star val animatetransform : ([< | animatetransform_attr], [< | animatetransform_content], [> | animatetransform]) star val font : ([< | font_attr], [< | font_content], [> | font]) star val glyph : ([< | glyph_attr], [< | glyph_content], [> | glyph]) star val missingglyph : ([< | missingglyph_attr], [< | missingglyph_content], [> | missingglyph ]) star val hkern : ([< | hkern_attr], [> | hkern]) nullary val vkern : ([< | vkern_attr], [> | vkern]) nullary val fontface : ([< | fontface_attr], [> | fontface]) nullary val fontfacesrc : ([< | fontfacesrc_attr], [< | fontfacesrc_content], [> | fontfacesrc]) star val fontfaceuri : ([< | fontfaceuri_attr], [< | fontfaceuri_content], [> | fontfaceuri]) star val fontfaceformat : ([< | fontfaceformat_attr], [> | fontfaceformat]) nullary val fontfacename : ([< | fontfacename_attr], [> | fontfacename]) nullary val tot : Xml.elt -> 'a elt val totl : Xml.elt list -> ('a elt) list val toelt : 'a elt -> Xml.elt val toeltl : ('a elt) list -> Xml.elt list val to_xmlattribs : ('a attrib) list -> Xml.attrib list val to_attrib : Xml.attrib -> 'a attrib (** {2 ... } *) type doc = [ `Svg ] elt val doc_toelt : doc -> Xml.elt end tyxml-2.2.0/lib/xhtml.mli0000644000000000000000000000660112060404012013453 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Typesafe constructors and printers for XHTML 1.0 and 1.1 documents @see W3C Recommendation *) (** {1 Current version } *) (** Concrete implementation of XHTML typesafe constructors *) module M : Xhtml_sigs.T with type Xml.uri = Xml.uri and type Xml.event_handler = Xml.event_handler and type Xml.attrib = Xml.attrib and type Xml.elt = Xml.elt (** Simple printer for XHTML documents (HTML compatible printer) *) module P : Xml_sigs.Typed_simple_printer with type 'a elt := 'a M.elt and type doc := M.doc (** Parametrized stream printer for XHTML documents (HTML compatible printer) *) module Make_printer(O : Xml_sigs.Output) : Xml_sigs.Typed_printer with type out := O.out and type 'a elt := 'a M.elt and type doc := M.doc (** {1 XHTML 1.1} *) (** Concrete implementation of XHTML 1.1 typesafe constructors *) module M_01_01 : Xhtml_sigs.T_01_01 with type Xml.uri = Xml.uri and type Xml.event_handler = Xml.event_handler and type Xml.attrib = Xml.attrib and type Xml.elt = Xml.elt (** Simple printer for XHTML 1.1 documents (HTML compatible printer) *) module P_01_01 : Xml_sigs.Typed_simple_printer with type 'a elt := 'a M_01_01.elt and type doc := M_01_01.doc (** Parametrized stream printer for XHTML 1.1 documents (HTML compatible printer) *) module Make_printer_01_01(O : Xml_sigs.Output) : Xml_sigs.Typed_printer with type out := O.out and type 'a elt := 'a M_01_01.elt and type doc := M_01_01.doc (** {1 XHTML 1.0 } *) (** Concrete implementation of XHTML 1.0 typesafe constructors *) module M_01_00 : Xhtml_sigs.T_01_00 with type Xml.uri = Xml.uri and type Xml.event_handler = Xml.event_handler and type Xml.attrib = Xml.attrib and type Xml.elt = Xml.elt (** Simple printer for XHTML 1.0 documents (HTML compatible printer) *) module P_01_00 : Xml_sigs.Typed_simple_printer with type 'a elt := 'a M_01_00.elt and type doc := M_01_00.doc (** Parametrized stream printer for XHTML 1.0 documents *) module Make_printer_01_00(O : Xml_sigs.Output) : Xml_sigs.Typed_printer with type out := O.out and type 'a elt := 'a M_01_00.elt and type doc := M_01_00.doc tyxml-2.2.0/lib/html5.ml0000644000000000000000000000175312060404012013202 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) module M = Html5_f.Make(Xml)(Svg.M) module P = Xml_print.Make_typed_simple(Xml)(M) module Make_printer = Xml_print.Make_typed(Xml)(M) tyxml-2.2.0/lib/xml.mli0000644000000000000000000001075212060404012013121 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2004 Thorsten Ohl * Copyright (C) 2007 Gabriel Kerneis * Copyright (C) 2010 Cecile Herbelin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Basic functions for construction and manipulation of XML tree. *) type uri = string val string_of_uri : uri -> string val uri_of_string : string -> uri type aname = string type separator = Space | Comma type event_handler = string type attrib val aname : attrib -> aname type acontent = private | AFloat of float | AInt of int | AStr of string | AStrL of separator * string list val acontent : attrib -> acontent val float_attrib : aname -> float -> attrib val int_attrib : aname -> int -> attrib val string_attrib : aname -> string -> attrib val space_sep_attrib : aname -> string list -> attrib val comma_sep_attrib : aname -> string list -> attrib val event_handler_attrib : aname -> event_handler -> attrib (**/**) (* Deprecated alias. *) val event_attrib : aname -> event_handler -> attrib (**/**) val uri_attrib : aname -> uri -> attrib val uris_attrib : aname -> uri list -> attrib type ename = string type elt type econtent = private | Empty | Comment of string | EncodedPCDATA of string | PCDATA of string | Entity of string | Leaf of ename * attrib list | Node of ename * attrib list * elt list val content : elt -> econtent val empty : unit -> elt val comment : string -> elt val pcdata : string -> elt val encodedpcdata : string -> elt val entity : string -> elt (** Neither [comment], [pcdata] nor [entity] check their argument for invalid characters. Unsafe characters will be escaped later by the output routines. *) val leaf : ?a:(attrib list) -> ename -> elt val node : ?a:(attrib list) -> ename -> elt list -> elt val cdata : string -> elt val cdata_script : string -> elt val cdata_style : string -> elt (** {2 Iterators} *) val amap : (ename -> attrib list -> attrib list) -> elt -> elt (** Recursively edit attributes for the element and all its children. *) val amap1 : (ename -> attrib list -> attrib list) -> elt -> elt (** Edit attributes only for one element. *) (** The following can safely be exported by higher level libraries, because removing an attribute from a element is always legal. *) val rm_attrib : (aname -> bool) -> attrib list -> attrib list val rm_attrib_from_list : (aname -> bool) -> (string -> bool) -> attrib list -> attrib list val map_int_attrib : (aname -> bool) -> (int -> int) -> attrib list -> attrib list val map_string_attrib : (aname -> bool) -> (string -> string) -> attrib list -> attrib list val map_string_attrib_in_list : (aname -> bool) -> (string -> string) -> attrib list -> attrib list (** Exporting the following by higher level libraries would drive a hole through a type system, because they allow to add {e any} attribute to {e any} element. *) val add_int_attrib : aname -> int -> attrib list -> attrib list val add_string_attrib : aname -> string -> attrib list -> attrib list val add_comma_sep_attrib : aname -> string -> attrib list -> attrib list val add_space_sep_attrib : aname -> string -> attrib list -> attrib list val fold : (unit -> 'a) -> (string -> 'a) -> (string -> 'a) -> (string -> 'a) -> (string -> 'a) -> (ename -> attrib list -> 'a) -> (ename -> attrib list -> 'a list -> 'a) -> elt -> 'a val all_entities : elt -> string list val translate : (ename -> attrib list -> elt) -> (ename -> attrib list -> elt list -> elt) -> ('state -> ename -> attrib list -> elt list) -> ('state -> ename -> attrib list -> elt list -> elt list) -> (ename -> attrib list -> 'state -> 'state) -> 'state -> elt -> elt (** {2 Printer} *) val print_list: output:(string -> unit) -> ?encode:(string -> string) -> elt list -> unit val print : Format.formatter -> elt -> unit tyxml-2.2.0/lib/xhtml_sigs.mli0000644000000000000000000005754712060404012014517 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) open Xhtml_types module type T_01_01 = sig module Xml : Xml_sigs.T module Info : Xml_sigs.Info (** The elements, attributes, attribute types and data types are given names that match the names in the W3C recommendation as closely as allowed by a strict typing discipline and the lexical conventions of O'Caml: {ul {- {e elements} are implemented as O'Caml constructors with the same name as in the W3C recommendation. The domain and codomain are specified as ['a elt], where ['a] is a concrete phantom type build out of polymorphic variants.} {- {e attributes} are implemented as O'Caml constructors with [a_] prefixed to the name. The name is the same as in the W3C recommendation, unless an additional prefix is required to disambiguate: {ul {- [a_fs_rows] and [a_fs_cols] instead of [a_rows] and [a_cols] for framesets, because of the different argument types.}}} {- {e attribute types} are implemented as O'Caml types that all have the same names as in the W3C recommendation, but are all lowercase.} {- {e data types} are also implemented as O'Caml types that all have the same names as in the W3C recommendation and are again all lowercase.}} Finite sets of alternatives are mapped to polymorphic variants. The phantom type is always the {e most general} required by any (supported) version of the standard. Type discipline is enforced by exporting or not-exporting the corresponding constructor. The type defining group of html elements are in {!Xhtml_types} *) type uri = Xml.uri val string_of_uri : uri -> string val uri_of_string : string -> uri (** {1 Common Attributes} *) type +'a attrib val to_xmlattribs : 'a attrib list -> Xml.attrib list (* VB *) val to_attrib : Xml.attrib -> 'a attrib (* GH *) (** ['a] is known as a {i phantom type}. The implementation is actually monomorphic (the different element types are distinguished by a homogeneous variable, such as their textual representation) and the type variable [`a] is just used by the type checker. NB: It might be possible to use polymorphic variants directly, without phantom types, but the implementation is likely to be more involved. *) (** {2 Core} *) (** This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. *) val a_class : nmtokens -> [>`Class] attrib (** This attribute assigns a name to an element. This name must be unique in a document. *) val a_id : id -> [>`Id] attrib (** This attribute offers advisory information about the element for which it is set. *) val a_title : cdata -> [>`Title] attrib (** Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a {i tool tip} (a short message that appears when the pointing device pauses over an object). Audio user agents may speak the title information in a similar context. *) (** The title attribute has an additional role when used with the [link] element to designate an external style sheet. Please consult the section on links and style sheets for details. *) (** {2 I18N} *) val a_xml_lang : nmtoken -> [>`XML_lang] attrib (** {2 Style} The Style collection is deprecated, because the Style Attribute Module is deprecated. *) (** {2 Events} *) (** Javascript events *) val a_onblur : Xml.event_handler -> [>`OnBlur] attrib val a_onclick : Xml.event_handler -> [>`OnClick] attrib val a_ondblclick : Xml.event_handler -> [>`OnDblClick] attrib val a_onchange : Xml.event_handler -> [>`OnChange] attrib val a_onfocus : Xml.event_handler -> [>`OnFocus] attrib val a_onload : Xml.event_handler -> [>`OnLoad] attrib val a_onunload : Xml.event_handler -> [>`OnUnload] attrib val a_onreset : Xml.event_handler -> [>`OnReset] attrib val a_onselect : Xml.event_handler -> [>`OnSelect] attrib val a_onsubmit : Xml.event_handler -> [>`OnSubmit] attrib val a_onmousedown : Xml.event_handler -> [>`OnMouseDown] attrib val a_onmouseup : Xml.event_handler -> [>`OnMouseUp] attrib val a_onmouseover : Xml.event_handler -> [>`OnMouseOver] attrib val a_onmousemove : Xml.event_handler -> [>`OnMouseMove] attrib val a_onmouseout : Xml.event_handler -> [>`OnMouseOut] attrib val a_onkeypress : Xml.event_handler -> [>`OnKeyPress] attrib val a_onkeydown : Xml.event_handler -> [>`OnKeyDown] attrib val a_onkeyup : Xml.event_handler -> [>`OnKeyUp] attrib (** {1 Modules, Element Sets and Attributes } *) val a_profile : Xml.uri -> [>`Profile] attrib val a_version : cdata -> [>`Version] attrib val a_xmlns : [< `W3_org_1999_xhtml ] -> [>`XMLns] attrib val a_cite : Xml.uri -> [>`Cite] attrib val a_xml_space : [< `Preserve ] -> [>`XML_space] attrib (** This attribute assigns an access key to an element. An access key is a single character from the document character set. NB: authors should consider the input method of the expected reader when specifying an accesskey. *) val a_accesskey : character -> [>`Accesskey] attrib (** This attribute specifies the character encoding of the resource designated by the link. Please consult the section on character encodings for more details. *) val a_charset : charset -> [>`Charset] attrib val a_accept_charset : charset -> [>`Accept_charset] attrib val a_accept : contenttype -> [>`Accept] attrib (** This attribute specifies the location of a Web resource, thus defining a link between the current element (the source anchor) and the destination anchor defined by this attribute. *) val a_href : Xml.uri -> [>`Href] attrib (** This attribute specifies the base language of the resource designated by href and may only be used when href is specified. *) val a_hreflang : languagecode -> [>`Hreflang] attrib (** This attribute describes the relationship from the current document to the anchor specified by the href attribute. The value of this attribute is a space-separated list of link types. *) val a_rel : linktypes -> [>`Rel] attrib (** This attribute is used to describe a reverse link from the anchor specified by the href attribute to the current document. The value of this attribute is a space-separated list of link types. *) val a_rev : linktypes -> [>`Rev] attrib (** This attribute specifies the position of the current element in the tabbing order for the current document. This value must be a number between 0 and 32767. User agents should ignore leading zeros. *) val a_tabindex : number -> [>`Tabindex] attrib (** This attribute gives an advisory hint as to the content type of the content available at the link target address. It allows user agents to opt to use a fallback mechanism rather than fetch the content if they are advised that they will get content in a content type they do not support.Authors who use this attribute take responsibility to manage the risk that it may become inconsistent with the content available at the link target address. *) val a_type : contenttype -> [>`Type] attrib val a_datetime : cdata -> [>`Datetime] attrib (** {3 Bi-directional Text Attributes} *) val a_dir : [< `Ltr | `Rtl ] -> [>`Dir] attrib (** {3 Forms attributes} *) (** This attribute specifies a form processing agent. User agent behavior for a value other than an HTTP URI is undefined. *) val a_action : Xml.uri -> [>`Action] attrib (** When the [type] attribute has the value ["radio"] or ["checkbox"], this boolean attribute specifies that the button is on. User agents must ignore this attribute for other control types. *) val a_checked : [< `Checked ] -> [>`Checked] attrib (** This attribute specifies the visible width in average character widths. Users should be able to enter longer lines than this, so user agents should provide some means to scroll through the contents of the control when the contents extend beyond the visible area. User agents may wrap visible text lines to keep long lines visible without the need for scrolling. *) val a_cols : number -> [>`Cols] attrib val a_enctype : contenttype -> [>`Enctype] attrib val a_for : idref -> [>`For] attrib val a_maxlength : number -> [>`Maxlength] attrib val a_method : [< `Get | `Post ] -> [>`Method] attrib val a_multiple : [< `Multiple ] -> [>`Multiple] attrib (** This attribute assigns the control name. *) val a_name : cdata -> [>`Name] attrib (** This attribute specifies the number of visible text lines. Users should be able to enter more lines than this, so user agents should provide some means to scroll through the contents of the control when the contents extend beyond the visible area. *) val a_rows : number -> [>`Rows] attrib (** When set, this boolean attribute specifies that this option is pre-selected. *) val a_selected : [< `Selected ] -> [>`Selected] attrib val a_size : number -> [>`Size] attrib val a_src : Xml.uri -> [>`Src] attrib val a_input_type : [< `Text | `Password | `Checkbox | `Radio | `Submit | `Reset | `Hidden | `File | `Image | `Button ] -> [>`Input_Type] attrib (** This attribute specifies the initial value of the control. If this attribute is not set, the initial value is set to the contents of the [option] element. *) val a_value : cdata -> [>`Value] attrib val a_value_type : [< `Data | `Ref | `Object ] -> [>`Value_Type] attrib val a_disabled : [< `Disabled ] -> [>`Disabled] attrib val a_readonly : [< `ReadOnly ] -> [>`ReadOnly] attrib val a_button_type : [< `Button | `Submit | `Reset ] -> [>`Button_Type] attrib val a_label : text -> [> `Label ] attrib (** {2 Attributes for tables} *) val a_abbr : text -> [>`Abbr] attrib val a_align : [< `Left | `Center | `Right | `Justify | `Char ] -> [>`Align] attrib val a_axis : cdata -> [>`Axis] attrib val a_colspan : number -> [>`Colspan] attrib val a_headers : idrefs -> [>`Headers] attrib val a_rowspan : number -> [>`Rowspan] attrib val a_scope : [< `Row | `Col | `Rowgroup | `Colgroup ] -> [>`Scope] attrib val a_summary : text -> [>`Summary] attrib val a_valign : [< `Top | `Middle | `Bottom | `Baseline ] -> [>`Valign] attrib val a_border : pixels -> [>`Border] attrib val a_cellpadding : length -> [>`Cellpadding] attrib val a_cellspacing : length -> [>`Cellspacing] attrib val a_datapagesize : cdata -> [>`Datapagesize] attrib val a_frame : [< `Void | `Above | `Below | `Hsides | `LHS | `RHS | `Vsides | `Box | `Border ] -> [>`Frame] attrib val a_rules : [< `None | `Groups | `Rows | `Cols | `All ] -> [>`Rules] attrib val a_char : character -> [>`Char] attrib val a_charoff : length -> [>`Charoff] attrib val a_span : number -> [>`Span] attrib val a_alt : text -> [>`Alt] attrib val a_height : length -> [>`Height] attrib val a_longdesc : Xml.uri -> [>`Longdesc] attrib val a_width : length -> [>`Width] attrib (** {2 Attributes for client-side image map} *) type shape = [ `Rect | `Circle | `Poly | `Default ] val a_shape : shape -> [>`Shape] attrib val a_coords : int list -> [>`Coords] attrib val a_nohref : [< `Nohref ] -> [>`Nohref] attrib val a_usemap : idref -> [>`Usemap] attrib (** {2 Attributes for Server-side Image Map} *) val a_ismap : [< `Ismap ] -> [>`Ismap] attrib (** {2 Attributes for Object} *) val a_declare : [< `Declare ] -> [> `Declare ] attrib val a_classid : Xml.uri -> [> `Classid ] attrib val a_codebase : Xml.uri -> [> `Codebase ] attrib val a_data : Xml.uri -> [> `Data ] attrib val a_codetype : contenttype -> [>`Codetype] attrib val a_archive : Xml.uri list -> [>`Archive] attrib val a_standby : text -> [>`Standby] attrib (** {2 Attributes for Frames } *) val a_fs_rows : multilengths -> [>`FS_Rows] attrib val a_fs_cols : multilengths -> [>`FS_Cols] attrib val a_frameborder : [< `Zero | `One ] -> [>`Frameborder] attrib val a_marginheight : pixels -> [>`Marginheight] attrib val a_marginwidth : pixels -> [>`Marginwidth] attrib val a_noresize : [< `Noresize ] -> [>`Noresize] attrib val a_scrolling : [< `Yes | `No | `Auto ] -> [>`Scrolling] attrib val a_target : frametarget -> [>`Target] attrib (** {2 Attributes for metadata} *) val a_content : cdata -> [>`Content] attrib val a_http_equiv : nmtoken -> [>`Http_equiv] attrib val a_scheme : cdata -> [>`Scheme] attrib val a_defer : [< `Defer ] -> [>`Defer] attrib (** {3 Style attributes }*) val a_media : mediadesc -> [>`Media] attrib val a_style : string -> [>`Style_Attr] attrib (** {1 Elements} *) type +'a elt (** {2 Element Constructor Types} *) type ('a, 'b) nullary = ?a:('a attrib list) -> unit -> 'b elt type ('a, 'b, 'c) unary = ?a:('a attrib list) -> 'b elt -> 'c elt type ('a, 'b, 'c, 'd) binary = ?a:('a attrib list) -> 'b elt -> 'c elt -> 'd elt type ('a, 'b, 'c, 'd, 'e, 'f) quadry= ?a:('a attrib list) -> 'b elt -> 'c elt -> 'd elt -> 'e elt -> 'f elt (** Star '*' denotes any number of children, uncluding zero. *) type ('a, 'b, 'c) star = ?a:('a attrib list) -> 'b elt list -> 'c elt (** Plus '+' requires at least one child. *) type ('a, 'b, 'c) plus = ?a:('a attrib list) -> 'b elt -> 'b elt list -> 'c elt (** {2 Structure} *) type html = [`Html] elt val html : ?a:([< i18n | `Version | `XMLns | `Id ] attrib list) -> [< `Head ] elt -> [< `Body | `Frameset ] elt -> html val head : ?a:([< i18n | `Profile | `Id ] attrib list) -> [< `Base | `Title ] elt -> [< `Meta | `Link | `Style | `Object | `Script ] elt list -> [>`Head] elt val title : ([< title_attrib] , [< title_content], [> title ]) unary val body : ([< body_attrib] , [< body_content], [> body ]) star (** {2 Data} *) val pcdata : string -> [>`PCDATA] elt val entity : string -> [>`PCDATA] elt val space : unit -> [>`PCDATA] elt val cdata : string -> [>`PCDATA] elt (* GK *) val cdata_script : string -> [>`PCDATA] elt (* GK *) val cdata_style : string -> [>`PCDATA] elt (* GK *) (**/**) val unsafe_data : string -> 'a elt (**/**) (** {2 Text} *) val h1 : ([< h1_attrib] , [< h1_content], [> h1 ]) star val h2 : ([< h2_attrib] , [< h2_content], [> h2 ]) star val h3 : ([< h3_attrib] , [< h3_content], [> h3 ]) star val h4 : ([< h4_attrib] , [< h4_content], [> h4 ]) star val h5 : ([< h5_attrib] , [< h5_content], [> h5 ]) star val h6 : ([< h6_attrib] , [< h6_content], [> h6 ]) star val address : ([< address_attrib] , [< address_content], [> address ]) star val blockquote : ([< common | `Cite ], [< `PCDATA | block ], [>`Blockquote]) star val div : ([< div_attrib] , [< div_content], [> div ]) star val p : ([< p_attrib] , [< p_content], [> p ]) star val pre : ([< common | `XML_space ], [< `PCDATA | precontent ], [>`Pre]) star val abbr : ([< abbr_attrib] , [< abbr_content], [> abbr ]) star val acronym : ([< acronym_attrib] , [< acronym_content], [> acronym ]) star val br : ([< br_attrib ], [> br]) nullary val cite : ([< cite_attrib] , [< cite_content], [> cite ]) star val code : ([< code_attrib] , [< code_content], [> code ]) star val dfn : ([< dfn_attrib] , [< dfn_content], [> dfn ]) star val em : ([< em_attrib] , [< em_content], [> em ]) star val kbd : ([< kbd_attrib] , [< kbd_content], [> kbd ]) star val q : ([< q_attrib] , [< q_content], [> q ]) star val samp : ([< samp_attrib] , [< samp_content], [> samp ]) star val span : ([< span_attrib] , [< span_content], [> span ]) star val strong : ([< strong_attrib] , [< strong_content], [> strong ]) star val var : ([< var_attrib] , [< var_content], [> var ]) star (** {2 Hypertext} *) val a : ([< a_attrib] , [< a_content], [> a ]) star (** {2 List} *) val dl : ([< dl_attrib] , [< dl_content], [> dl ]) plus val ol : ([< ol_attrib] , [< ol_content], [> ol ]) plus val ul : ([< ul_attrib] , [< ul_content], [> ul ]) plus val dd : ([< dd_attrib] , [< dd_content], [> dd ]) star val dt : ([< dt_attrib] , [< dt_content], [> dt ]) star val li : ([< li_attrib] , [< li_content], [> li ]) star (** {2 Presentation} *) val hr : ([< hr_attrib ], [> hr]) nullary val b : ([< b_attrib] , [< b_content], [> b ]) star val big : ([< big_attrib] , [< big_content], [> big ]) star val i : ([< i_attrib] , [< i_content], [> i ]) star val small : ([< small_attrib] , [< small_content], [> small ]) star val sub : ([< sub_attrib] , [< sub_content], [> sub ]) star val sup : ([< sup_attrib] , [< sup_content], [> sup ]) star val tt : ([< tt_attrib] , [< tt_content], [> tt ]) star (* CH *) val bdo : dir:[< `Ltr | `Rtl ] ->([< bdo_attrib] , [< bdo_content], [> bdo ]) star (* CH *) val area : alt:text ->([< area_attrib ], [> area]) nullary val map : id:id ->([< map_attrib] , [< map_content], [> map ]) plus val del : ([< del_attrib] , [< del_content], [> del ]) star val ins : ([< ins_attrib] , [< ins_content], [> ins ]) star val script : contenttype:contenttype ->([< script_attrib] , [< script_content], [> script ]) unary val noscript : ([< noscript_attrib] , [< noscript_content], [> noscript ]) plus (** {2 Forms} *) (** {3 Basic Forms} *) (** One can use [open Basic_Forms] to enable basic forms. *) module Basic_Forms : sig val form : action:Xml.uri ->([< form_attrib] , [< form_content], [> form ]) plus val input : ([< input_attrib ], [> input]) nullary val label : ([< label_attrib] , [< label_content], [> label ]) star val option : ([< option_attrib] , [< option_content], [> selectoption ]) unary val select : ([< select_attrib] , [< select_content], [> select ]) plus val textarea : rows:number -> cols:number ->([< textarea_attrib] , [< textarea_content], [> textarea ]) unary end (** {3 Forms} *) (** Generic forms. WARNING: If you find a bug or if something is missing please send a bug report to the Ocsigen project! -- VB *) val form : action:Xml.uri ->([< form_attrib] , [< form_content], [> form ]) plus val input : ([< input_attrib ], [> input]) nullary val label : ([< label_attrib] , [< label_content], [> label ]) star val optgroup : label:text ->([< optgroup_attrib] , [< optgroup_content], [> optgroup ]) plus val option : ([< option_attrib] , [< option_content], [> selectoption ]) unary val select : ([< select_attrib] , [< select_content], [> select ]) plus val textarea : rows:number -> cols:number ->([< textarea_attrib] , [< textarea_content], [> textarea ]) unary val fieldset : ([< fieldset_attrib] , [< fieldset_content], [> fieldset ]) star val legend : ([< legend_attrib] , [< legend_content], [> legend ]) star val button : ([< button_attrib] , [< button_content], [> button ]) star (** {2 Tables} *) (** {3 Basic Tables} *) (** One can use [open Basic_Tables] to switch globally to basic tables. *) module Basic_Tables : sig val a_align : [< `Left | `Center | `Right ] -> [>`Align] attrib val a_scope : [< `Row | `Col ] -> [>`Scope] attrib val a_valign : [< `Top | `Middle | `Bottom ] -> [>`Valign] attrib val caption : ([< caption_attrib] , [< caption_content], [> caption ]) star val table : ?caption:([< `Caption ] elt) ->([< table_attrib] , [< table_content], [> table ]) plus val td : ([< td_attrib] , [< td_content], [> td ]) star val th : ([< th_attrib] , [< th_content], [> th ]) star val tr : ([< tr_attrib] , [< tr_content], [> tr ]) plus end (** {3 Tables} *) val caption : ([< caption_attrib] , [< caption_content], [> caption ]) star val table : ?caption:([< `Caption ] elt) -> ?columns:([< `Cols of ([< `Col ] elt list) | `Colgroups of ([< `Colgroup ] elt list) ]) -> ([< common | `Border | `Cellpadding | `Cellspacing | `Datapagesize | `Frame | `Rules | `Summary | `Width ], [< `Tr ], [>`Table]) plus val tablex : ?caption:([< `Caption ] elt) -> ?columns:([< `Cols of ([< `Col ] elt list) | `Colgroups of ([< `Colgroup ] elt list) ]) -> ?thead:([< `Thead ] elt) -> ?tfoot:([< `Tfoot ] elt) -> ([< common | `Border | `Cellpadding | `Cellspacing | `Datapagesize | `Frame | `Rules | `Summary | `Width ], [< `Tbody ], [>`Table]) plus val td : ([< td_attrib] , [< td_content], [> td ]) star val th : ([< th_attrib] , [< th_content], [> th ]) star val tr : ([< tr_attrib] , [< tr_content], [> tr ]) plus val col : ([< col_attrib ], [> col]) nullary val colgroup : ([< colgroup_attrib] , [< colgroup_content], [> colgroup ]) star val thead : ([< thead_attrib] , [< thead_content], [> thead ]) plus val tbody : ([< tbody_attrib] , [< tbody_content], [> tbody ]) plus val tfoot : ([< tfoot_attrib] , [< tfoot_content], [> tfoot ]) plus (** {2 Image} *) val img : src:Xml.uri -> alt:text ->([< img_attrib ], [> img]) nullary (** {2 Object} VB *) val object_ : ([< object__attrib] , [< object__content], [> object_ ]) star val param : name:text ->([< param_attrib ], [> param]) nullary (** {2 Frames} *) val frameset : ?noframes:([< `Noframes ] elt) ->([< frameset_attrib] , [< frameset_content], [> frameset ]) plus val frame : src:Xml.uri ->([< frame_attrib ], [> frame]) nullary val noframes : ([< noframes_attrib], [< noframes_content], [> noframes ]) unary val iframe : ([< iframe_attrib], [< iframe_content], [> iframe ]) star (** {2 Meta} *) val meta : content:cdata -> ([< meta_attrib ], [> meta]) nullary (** {2 Style Sheets} *) val style : contenttype:contenttype -> ([< style_attrib] , [< style_content], [> style ]) star (** {2 Link} *) val link : ([< link_attrib ], [> link]) nullary (** {2 Base} *) (* in the DTD of xHTML1.1 xmlns attribute in the doc of xHTML1.1 id attribute *) val base : href:Xml.uri ->([< base_attrib ], [> base]) nullary (** {2 Ruby} *) val ruby_simple1 : ?a:([< common] attrib list) -> [< `Rb ] elt -> [< `Rt ] elt -> [>`Ruby_simple1] elt val ruby_simple2 : ?a:([< common] attrib list) -> [< `Rb ] elt -> [< `Rp ] elt -> [< `Rt ] elt -> [< `Rp ] elt -> [>`Ruby_simple2] elt val ruby_complex : ?a:([< common] attrib list) -> [< `Rbc ] elt -> [< `Rtc_complex ] elt -> [>`Ruby_complex] elt val rbc : ([< rbc_attrib] , [< rbc_content], [> rbc ]) plus val rtc : ([< rtc_attrib] , [< rtc_content], [> rtc ]) plus val rtc_complex : ([< rtc_complex_attrib] , [< rtc_complex_content], [> rtc_complex ]) plus val rb : ([< rb_attrib] , [< rb_content], [> rb ]) star val rt : ([< rt_attrib] , [< rt_content], [> rt ]) star val rt_complex : ([< rt_complex_attrib] , [< rt_complex_content], [> rt_complex ]) star val rp : ([< rp_attrib] , [< rp_content], [> rp ]) star val a_rbspan : number -> [>`Rbspan] attrib (** {2 ... } *) val tot : Xml.elt -> 'a elt val totl : Xml.elt list -> 'a elt list val toelt : 'a elt -> Xml.elt val toeltl : 'a elt list -> Xml.elt list (** {2 ... }*) type doc = [ `Html ] elt val doc_toelt : doc -> Xml.elt end module type T_01_00 = sig include T_01_01 val a_name_01_00 : cdata -> [>`Name_01_00] attrib end module type T = T_01_01 tyxml-2.2.0/lib/svg.ml0000644000000000000000000000174212060404012012746 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) module M = Svg_f.Make(Xml) module P = Xml_print.Make_typed_simple(Xml)(M) module Make_printer = Xml_print.Make_typed(Xml)(M) tyxml-2.2.0/lib/.depend0000644000000000000000000000404112060404012013050 0ustar0000000000000000html5_f.cmi: xml_sigs.cmi svg_sigs.cmi html5_sigs.cmi html5.cmi: xml_sigs.cmi xml.cmi svg.cmi html5_sigs.cmi html5_sigs.cmi: xml_sigs.cmi svg_sigs.cmi html5_types.cmi html5_types.cmi: svg_types.cmi svg_f.cmi: xml_sigs.cmi svg_sigs.cmi svg.cmi: xml_sigs.cmi xml.cmi svg_sigs.cmi svg_sigs.cmi: xml_sigs.cmi svg_types.cmi svg_types.cmi: xhtml_f.cmi: xml_sigs.cmi xhtml_sigs.cmi xhtml.cmi: xml_sigs.cmi xml.cmi xhtml_sigs.cmi xhtml_sigs.cmi: xml_sigs.cmi xhtml_types.cmi xhtml_types.cmi: xml_iter.cmi: xml_sigs.cmi xml.cmi: xml_print.cmi: xml_sigs.cmi xml_sigs.cmi: html5_f.cmo: xml_sigs.cmi xml_print.cmi svg_sigs.cmi html5_types.cmi \ html5_f.cmi html5_f.cmx: xml_sigs.cmi xml_print.cmx svg_sigs.cmi html5_types.cmi \ html5_f.cmi html5.cmo: xml_print.cmi xml.cmi svg.cmi html5_f.cmi html5.cmi html5.cmx: xml_print.cmx xml.cmx svg.cmx html5_f.cmx html5.cmi svg_f.cmo: xml_sigs.cmi xml_print.cmi svg_types.cmi svg_f.cmi svg_f.cmx: xml_sigs.cmi xml_print.cmx svg_types.cmi svg_f.cmi svg.cmo: xml_print.cmi xml.cmi svg_f.cmi svg.cmi svg.cmx: xml_print.cmx xml.cmx svg_f.cmx svg.cmi xhtml_f.cmo: xml_sigs.cmi xml_print.cmi xhtml_types.cmi xhtml_f.cmi xhtml_f.cmx: xml_sigs.cmi xml_print.cmx xhtml_types.cmi xhtml_f.cmi xhtml.cmo: xml_print.cmi xml.cmi xhtml_f.cmi xhtml.cmi xhtml.cmx: xml_print.cmx xml.cmx xhtml_f.cmx xhtml.cmi xml_iter.cmo: xml_sigs.cmi xml_iter.cmi xml_iter.cmx: xml_sigs.cmi xml_iter.cmi xml.cmo: xml_print.cmi xml_iter.cmi xml.cmi xml.cmx: xml_print.cmx xml_iter.cmx xml.cmi xml_print.cmo: xml_sigs.cmi xml_print.cmi xml_print.cmx: xml_sigs.cmi xml_print.cmi xml_print_duce.cmo: xml_sigs_duce.cmi xml_print.cmi xml_print_duce.cmi xml_print_duce.cmx: xml_sigs_duce.cmi xml_print.cmx xml_print_duce.cmi xhtml_duce.cmo: xml_sigs_duce.cmi xml_print_duce.cmi xhtml_types_duce.cmi \ xhtml.cmi xhtml_duce.cmi xhtml_duce.cmx: xml_sigs_duce.cmi xml_print_duce.cmx xhtml_types_duce.cmi \ xhtml.cmx xhtml_duce.cmi xml_sigs_duce.cmi: xml_sigs.cmi xhtml_types_duce.cmi: xml_print_duce.cmi: xml_sigs_duce.cmi xhtml_duce.cmi: xml_sigs_duce.cmi xhtml_types_duce.cmi tyxml-2.2.0/lib/xhtml_duce.mli0000644000000000000000000000237712060404012014461 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** OCamlduce printers for XHTML 1.0 and 1.1 documents. *) module type T = Xml_sigs_duce.Typed_xml with type doc = Xhtml_types_duce.html and type elt = {{ Xhtml_types_duce.block | Xhtml_types_duce.form | Xhtml_types_duce.misc }} module M : T module P : Xml_sigs_duce.Typed_printer with module Typed_xml := M module P_01_00 : Xml_sigs_duce.Typed_printer with module Typed_xml := M tyxml-2.2.0/lib/svg.mli0000644000000000000000000000317312060404012013117 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Typesafe constructors and printers for SVG documents. @see W3C Recommendation *) (** Concrete implementation of SVG typesafe constructors *) module M : Svg_sigs.T with type Xml.uri = Xml.uri and type Xml.event_handler = Xml.event_handler and type Xml.attrib = Xml.attrib and type Xml.elt = Xml.elt (** Simple printer for SVG documents *) module P : Xml_sigs.Typed_simple_printer with type 'a elt := 'a M.elt and type doc := M.doc (** Parametrized stream printer for SVG documents *) module Make_printer(O : Xml_sigs.Output) : Xml_sigs.Typed_printer with type out := O.out and type 'a elt := 'a M.elt and type doc := M.doc tyxml-2.2.0/lib/xml_print_duce.ml0000644000000000000000000000577012060404012015170 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2010 Jaap Boender * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Pretty printer for XHTML with Ocamlduce that handles browser specificities properly. *) module Make(I: sig val emptytags : string list end) = struct let print_list ~output ?(encode = Xml_print.encode_unsafe_char) (v: Ocamlduce.Load.anyxml list) : unit = let open_markup tag attrs = output ("<" ^ tag); List.iter (fun (n, v) -> output " "; output n; output "=\""; output (encode v); output "\"") attrs in List.iter (Ocamlduce.Print.serialize ~start_elem:(fun tag attrs -> open_markup tag attrs; output ">") ~end_elem:(fun tag -> output ("")) ~empty_elem:(fun tag attrs -> if I.emptytags = [] || List.mem tag I.emptytags then (open_markup tag attrs; output " />") else (open_markup tag attrs; output (">"))) ~text:(fun v -> output (encode v))) v end (* module MakeTypedRaw(Typed_xml : Xml_sigs_duce.Typed_xml) = struct *) (* module P = Make(Typed_xml.Info) *) (* type elt *) (* type doc *) (* let print_list ~output ?(encode = Xml_print.encode_unsafe_char) elts = *) (* P.print_list ~output ~encode elts *) (* (\* let print ~(output: string -> unit) ?(encode = Xml_print.encode_unsafe_char) ?(advert = "") *\) *) (* doc = *) (* output Typed_xml.Info.doctype; *) (* if advert <> "" then output ("\n"); *) (* P.print_list ~output ~encode [doc] *) (* end *) module Make_typed(Typed_xml : Xml_sigs_duce.Typed_xml) = struct module P = Make(Typed_xml.Info) type elt = Typed_xml.elt type doc = Typed_xml.doc let print_list ~output ?(encode = Xml_print.encode_unsafe_char) elts = P.print_list ~output ~encode (List.map Typed_xml.of_elt elts) let print ~(output: string -> unit) ?(encode = Xml_print.encode_unsafe_char) ?(advert = "") doc = output Typed_xml.Info.doctype; if advert <> "" then output ("\n"); P.print_list ~output ~encode [Typed_xml.of_doc doc] end let print ~output ?(encode = Xml_print.encode_unsafe_char) elt = let module P = Make(struct let emptytags = [] end) in P.print_list ~output ~encode [elt] tyxml-2.2.0/lib/xhtml_types_duce.mli0000644000000000000000000002711112060404012015676 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2010 Jaap Boender * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** This interface corresponds to the XHTML 1.0 Strict DTD, for Ocamlduce. *) type events = {{ { onkeyup=?String onkeydown=?String onkeypress=?String onmouseout=?String onmousemove=?String onmouseover=?String onmouseup=?String onmousedown=?String ondblclick=?String onclick=?String } }} type valign = {{ "top" | "middle" | "bottom" | "baseline" }} type align = {{ "left" | "center" | "right" | "justify" | "char" }} type scope = {{ "row" | "col" | "rowgroup" | "colgroup" }} type shape = {{ "rect" | "circle" | "poly" | "default" }} type id = {{ { id=?String } }} type coreattrs = {{ { title=?String style=?String class=?String } ++ id }} type i18n = {{ { dir=?"ltr"|"rtl" xml:lang=?String lang=?String } }} type focus = {{ { onblur=?String onfocus=?String tabindex=?String accesskey=?String } }} type attrs = {{ coreattrs ++ i18n ++ events }} type align_attrs = {{ attrs ++ { valign =? valign align =? align char =? String charoff =? String } }} (* Text elements *) type special_pre = {{ br | span | bdo | _map }} and special = {{ special_pre | _object | img }} and fontstyle = {{ tt | i | b | big | small }} and phrase = {{ em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup }} and inline_forms = {{ input | select | textarea | label | button }} and misc_inline = {{ ins | del | script }} and misc = {{ noscript | misc_inline }} and inline = {{ a | special | fontstyle | phrase | inline_forms }} and inlines = {{ [ (Char | inline | misc_inline)* ] }} (* Block level elements *) and heading = {{ h1 | h2 | h3 | h4 | h5 | h6 }} and lists = {{ ul | ol | dl }} and blocktext = {{ pre | hr | blockquote | address }} and block = {{ p | heading | _div | lists | blocktext | fieldset | table }} and blocks = {{ [ (block | form | misc)* ] }} and div_content = {{ Char | block | form | inline | misc }} and flows = {{ [ div_content* ] }} (* Content models for exclusions *) (* Document structure *) and xmlns = {{ { xmlns="http://www.w3.org/1999/xhtml" } }} and html = {{ [ head body ] }} and head_misc = {{ script|style|meta|link|_object }} and head = {{ [ head_misc* title head_misc* base? head_misc* | head_misc* base head_misc* title head_misc* ] }} and title = {{ [ PCDATA ] }} and base = {{ <base (id ++ { href=String })>[ ] }} and meta = {{ <meta (i18n ++ id ++ { scheme=?String content=String name=?String http-equiv=?String })>[ ] }} and link_attrs = {{ attrs ++ { media=?String rev=?String rel=?String type=?String hreflang=?String href=?String charset=?String } }} and link = {{ <link (link_attrs)>[ ] }} and links = {{ [ link* ] }} and style = {{ <style (i18n ++ id ++ { title=?String media=?String type=String })>[ PCDATA ] }} and script_attrs = {{ id ++ { defer=?"defer" src=?String type=String charset=?String } }} and script = {{ <script (script_attrs)>[PCDATA] }} and noscript = {{ <noscript (attrs)>blocks }} (* Document body *) and body = {{ <body (attrs ++ { onload=?String onunload=?String })>blocks }} and _div = {{ <div (attrs)>flows }} (* Paragraphs *) and p = {{ <p (attrs)>inlines }} (* Headings *) and h1 = {{ <h1 (attrs)>inlines }} and h2 = {{ <h2 (attrs)>inlines }} and h3 = {{ <h3 (attrs)>inlines }} and h4 = {{ <h4 (attrs)>inlines }} and h5 = {{ <h5 (attrs)>inlines }} and h6 = {{ <h6 (attrs)>inlines }} (* Lists *) and ul = {{ <ul (attrs)>[ li+ ] }} and ol = {{ <ol (attrs)>[ li+ ] }} and li = {{ <li (attrs)>flows }} and dl = {{ <dl (attrs)>[ (dt|dd)+ ] }} and dt = {{ <dt (attrs)>inlines }} and dd = {{ <dd (attrs)>flows }} (* Address *) and address = {{ <address (attrs)>inlines }} (* Horizontal rule *) and hr = {{ <hr (attrs)>[] }} (* Preformatted Text *) and pre = {{ <pre (attrs)>[ (Char | a | fontstyle | phrase | special_pre | misc_inline | inline_forms)* ] }} (* Block-like quotes *) and blockquote = {{ <blockquote (attrs ++ { cite =? String })>blocks }} (* Inserted/Deleted Text *) and ins = {{ <ins (attrs ++ { cite =? String datetime =? String })>flows }} and del = {{ <del (attrs ++ { cite =? String datetime =? String })>flows }} (* The Anchor Element *) and a_attrs = {{ attrs ++ focus ++ { charset =? String type =? String name =? String href =? String hreflang =? String rel =? String rev =? String shape =? shape coords =? String} }} and a_content = {{ Char | special | fontstyle | phrase | inline_forms | misc_inline }} and a_contents = {{ [ a_content* ] }} and a = {{ <a (a_attrs)> a_contents }} (* Inline elements *) and span = {{ <span (attrs)>inlines }} and bdo = {{ <bdo (attrs & { dir=Any .. })>inlines }} and br = {{ <br (coreattrs)>[] }} and em = {{ <em (attrs)>inlines }} and strong = {{ <strong (attrs)>inlines }} and dfn = {{ <dfn (attrs)>inlines }} and code = {{ <code (attrs)>inlines }} and samp = {{ <samp (attrs)>inlines }} and kbd = {{ <kbd (attrs)>inlines }} and var = {{ <var (attrs)>inlines }} and cite = {{ <cite (attrs)>inlines }} and abbr = {{ <abbr (attrs)>inlines }} and acronym = {{ <acronym (attrs)>inlines }} and q = {{ <q (attrs ++ { cite =? String })>inlines }} and sub = {{ <sub (attrs)>inlines }} and sup = {{ <sup (attrs)>inlines }} and tt = {{ <tt (attrs)>inlines }} and i = {{ <i (attrs)>inlines }} and b = {{ <b (attrs)>inlines }} and big = {{ <big (attrs)>inlines }} and small = {{ <small (attrs)>inlines }} (* Object *) and _object = {{ <object (attrs ++ { tabindex=?String name=?String usemap=?String width=?String height=?String standby=?String archive=?String codetype=?String type=?String data=?String codebase=?String classid=?String declare=?"declare" })> [ (Char|param|block|form|inline|misc)* ] }} and param = {{ <param type=?String valuetype=?"data"|"ref"|"object" value=?String name=?String id=?String>[ ] }} (* Images *) and img = {{ <img (attrs ++ { ismap=?"ismap" usemap=?String width=?String height=?String longdesc=?String alt=String src=String })>[] }} (* Client-side image maps *) and _map = {{ <map ((attrs ++ { name=?String }) & { id = Any .. })>[ (block | form | misc)+ | area+ ] }} and area = {{ <area (attrs ++ focus ++ { alt=String nohref=?"nohref" href=?String coords=?String shape=?shape })>[ ] }} (* Forms *) and form_attrs = {{ attrs ++ { accept-charset=?String accept=?String onreset=?String onsubmit=?String enctype=?String method=?"get"|"post" action=String} }} and form_content = {{ block|misc }} and form_contents = {{ [form_content*] }} and form = {{ <form (form_attrs)> form_contents }} and label = {{ <label (attrs ++ { for=?String accesskey=?String onfocus=?String onblur=?String })> inlines }} and input_type_values = {{ "text"|"password"|"checkbox"|"radio"|"submit" |"reset"|"file"|"hidden"|"image"|"button" }} and input_attrs = {{ attrs ++ focus ++ {accept=?String onchange=?String onselect=?String usemap=?String alt=?String src=?String maxlength=?String size=?String readonly=?"readonly" disabled=?"disabled" checked=?"checked" value=?String name=?String type=?input_type_values } }} and input = {{ <input (input_attrs)>[] }} and select_attrs = {{ attrs ++ {onchange=?String onblur=?String onfocus=?String tabindex=?String disabled=?"disabled" multiple=?"multiple" size=?String name=?String} }} and select_content = {{ (optgroup|option) }} and select = {{ <select (select_attrs)>[ select_content+ ]}} and optgroup_attrs = {{ attrs ++ { disabled=?"disabled" label=String } }} and optgroup = {{ <optgroup (optgroup_attrs)>[ option+ ] }} and option_attrs = {{ attrs ++ { selected=?"selected" disabled=?"disabled" label=?String value=?String } }} and option = {{ <option (option_attrs)>[ PCDATA ] }} and textarea_attrs = {{ attrs ++ focus ++ { onchange=?String onselect=?String readonly=?"readonly" disabled=?"disabled" cols=String rows=String name=?String } }} and textarea = {{ <textarea (textarea_attrs)>[ PCDATA ] }} and fieldset = {{ <fieldset (attrs)>[ (Char|legend|block|form|inline|misc)* ] }} and legend = {{ <legend (attrs ++ { accesskey=?String })>inlines }} and button_content = {{ Char | p | heading | _div | lists | blocktext | table | special | fontstyle | phrase | misc }} and button_type_values = {{ "button"|"submit"|"reset" }} and button_attrs = {{ attrs ++ focus ++ { name=?String value=?String type=?button_type_values disabled=?"disabled" } }} and button = {{ <button (button_attrs)>[ button_content* ] }} and button_contents = {{ [ button_content* ] }} (* Tables *) and table_attrs = {{ attrs ++ { cellpadding=?String cellspacing=?String rules=?"none"|"groups"|"rows"|"cols"|"all" frame=?"void"|"above"|"below"|"hsides" |"lhs"|"rhs"|"vsides"|"box"|"border" border=?String width=?String summary=?String } }} and table = {{ <table (table_attrs)>[ ( caption? (col* | colgroup* ) thead? tfoot? (tbody+ | tr+) ) ]}} and caption = {{ <caption (attrs)>inlines }} and thead = {{ <thead (align_attrs)>[ tr+ ] }} and tfoot = {{ <tfoot (align_attrs)>[ tr+ ] }} and tbody = {{ <tbody (align_attrs)>[ tr+ ] }} and colgroup = {{ <colgroup (align_attrs ++ { span =? String width =? String})> [ col* ] }} and col = {{ <col (align_attrs ++ { span=?String width=?String }) >[] }} and tr = {{ <tr (align_attrs)>[ (th|td)+ ] }} and th = {{ <th (thd_attribs)>flows }} and td = {{ <td (thd_attribs)>flows }} and thd_attribs = {{ align_attrs ++ { colspan=?String rowspan=?String scope=?scope headers=?String axis=?String abbr=?String } }} �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tyxml-2.2.0/lib/xhtml.ml����������������������������������������������������������������������������0000644�0000000�0000000�00000002452�12060404012�013302� 0����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) module M = Xhtml_f.Make(Xml) module M_01_00 = Xhtml_f.Make_01_00(Xml) module M_01_01 = Xhtml_f.Make_01_01(Xml) module P = Xml_print.Make_typed_simple(Xml)(M) module P_01_00 = Xml_print.Make_typed_simple(Xml)(M_01_00) module P_01_01 = Xml_print.Make_typed_simple(Xml)(M_01_01) module Make_printer = Xml_print.Make_typed(Xml)(M) module Make_printer_01_00 = Xml_print.Make_typed(Xml)(M_01_00) module Make_printer_01_01 = Xml_print.Make_typed(Xml)(M_01_01) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tyxml-2.2.0/lib/xhtml_types.mli���������������������������������������������������������������������0000644�0000000�0000000�00000111144�12060404012�014676� 0����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2005 Vincent Balat * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** XHTML types with variants. (See also {!Xhtml.M}) *) (** The elements, attributes, attribute types and data types are given names that match the names in the W3C recommendation as closely as allowed by a strict typing discipline and the lexical conventions of O'Caml: {ul {- {e elements} are implemented as O'Caml constructors with the same name as in the W3C recommendation. The domain and codomain are specified as ['a elt], where ['a] is a concrete phantom type build out of polymorphic variants.} {- {e attributes} are implemented as O'Caml constructors with [a_] prefixed to the name. The name is the same as in the W3C recommendation, unless an additional prefix is required to disambiguate: {ul {- [a_fs_rows] and [a_fs_cols] instead of [a_rows] and [a_cols] for framesets, because of the different argument types.}}} {- {e attribute types} are implemented as O'Caml types that all have the same names as in the W3C recommendation, but are all lowercase.} {- {e data types} are also implemented as O'Caml types that all have the same names as in the W3C recommendation and are again all lowercase.}} Finite sets of alternatives are mapped to polymorphic variants. The phantom type is always the {e most general} required by any (supported) version of the standard. Type discipline is enforced by exporting or not-exporting the corresponding constructor. *) (** {1 Attribute Types} @see <http://www.w3.org/TR/xhtml-modularization/abstraction.html#s_common_attrtypes> Modularization of XHTML *) type cdata = string (** Character data *) type id = string (** A document-unique identifier *) type idref = string (** A reference to a document-unique identifier *) type idrefs = idref list (** A space-separated list of references to document-unique identifiers *) type name = string (** A name with the same character constraints as ID above *) type nmtoken = string (** A name composed of only name tokens as defined in XML 1.0 @see <http://www.w3.org/TR/2000/REC-xml-20001006> XML 1.0 *) type nmtokens = nmtoken list (** One or more white space separated NMTOKEN values *) (** {2 Data Types} *) type character = char (** A single character from ISO 10646. *) type charset = string (** A character encoding, as per RFC2045 (MIME). @see <http://tools.ietf.org/html/rfc2045> RFC2045 *) type charsets = charset list (** A space-separated list of character encodings, as per RFC2045 (MIME). @see <http://tools.ietf.org/html/rfc2045> RFC2045 *) type contenttype = string (** A media type, as per RFC2045 (MIME). @see <http://tools.ietf.org/html/rfc2045> RFC2045 *) type contenttypes = contenttype list (** A comma-separated list of media types, as per RFC2045 (MIME). @see <http://tools.ietf.org/html/rfc2045> RFC 2045 *) type coords = string list (** Comma- separated list of coordinates to use in defining areas. *) type datetime = string (** Date and time information. *) type fpi = string (** A character string representing an SGML Formal Public Identifier. *) type frametarget = string (** Frame name used as destination for results of certain actions. *) type languagecode = string (** A language code, as per RFC5646. @see <http://tools.ietf.org/html/rfc5646> RFC5646 *) type length = [ | `Pixels of int | `Percent of int ] (** The value may be either in pixels or a percentage of the available horizontal or vertical space. Thus, the value [`Percent 50] means half of the available space. *) type linktypes = [ | `Alternate | `Appendix | `Bookmark | `Chapter | `Contents | `Copyright | `Glossary | `Help | `Index | `Next | `Prev | `Section | `Start | `Stylesheet | `Subsection | `Other of string ] list (** Authors may use the following recognized link types, listed here with their conventional interpretations. A LinkTypes value refers to a space-separated list of link types. White space characters are not permitted within link types. These link types are case-insensitive, i.e., ["Alternate"] has the same meaning as ["alternate"]. User agents, search engines, etc. may interpret these link types in a variety of ways. For example, user agents may provide access to linked documents through a navigation bar. {ul {- [`Alternate]: Designates substitute versions for the document in which the link occurs. When used together with the hreflang attribute, it implies a translated version of the document. When used together with the media attribute, it implies a version designed for a different medium (or media).} {- [`Stylesheet]: Refers to an external style sheet. See the Style Module for details. This is used together with the link type ["Alternate"] for user-selectable alternate style sheets.} {- [`Start]: Refers to the first document in a collection of documents. This link type tells search engines which document is considered by the author to be the starting point of the collection.} {- [`Next]: Refers to the next document in a linear sequence of documents. User agents may choose to pre-load the "next" document, to reduce the perceived load time.} {- [`Prev]: Refers to the previous document in an ordered series of documents. Some user agents also support the synonym "Previous".} {- [`Contents]: Refers to a document serving as a table of contents. Some user agents also support the synonym ToC (from "Table of Contents").} {- [`Index]: Refers to a document providing an index for the current document.} {- [`Glossary]: Refers to a document providing a glossary of terms that pertain to the current document.} {- [`Copyright]: Refers to a copyright statement for the current document.} {- [`Chapter]: Refers to a document serving as a chapter in a collection of documents.} {- [`Section]: Refers to a document serving as a section in a collection of documents.} {- [`Subsection]: Refers to a document serving as a subsection in a collection of documents.} {- [`Appendix]: Refers to a document serving as an appendix in a collection of documents.} {- [`Help]: Refers to a document offering help (more information, links to other sources information, etc.)} {- [`Bookmark]: Refers to a bookmark. A bookmark is a link to a key entry point within an extended document. The title attribute may be used, for example, to label the bookmark. Note that several bookmarks may be defined in each document.} {- [`Other]: refers to any other type (for example [icon] or [shortcut]). }} *) type mediadesc = [ | `All | `Aural | `Braille | `Embossed | `Handheld | `Print | `Projection | `Screen | `Speech | `TTY | `TV ] list (** The MediaDesc attribute is a comma-separated list of media descriptors. The following is a list of recognized media descriptors: {ul {- [`Screen]: Intended for non-paged computer screens.} {- [`TTY]: Intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities.} {- [`TV]: Intended for television-type devices (low resolution, color, limited scrollability).} {- [`Projection]: Intended for projectors.} {- [`Handheld]: Intended for handheld devices (small screen, monochrome, bitmapped graphics, limited bandwidth).} {- [`Print]: Intended for paged, opaque material and for documents viewed on screen in print preview mode.} {- [`Braille]: Intended for braille tactile feedback devices.} {- [`Aural]: Intended for speech synthesizers.} {- [`All]: Suitable for all devices.}} Future versions of XHTML may introduce new values and may allow parameterized values. To facilitate the introduction of these extensions, conforming user agents must be able to parse the media attribute value as follows: {ol {- The value is a comma-separated list of entries. For example, [media="screen, 3d-glasses, print and resolution > 90dpi"] is mapped to: ["screen"], ["3d-glasses"], ["print and resolution > 90dpi"].} {- Each entry is truncated just before the first character that isn't a US ASCII letter [\[a-zA-Z\]] (ISO 10646 hex 41-5a, 61-7a), digit [\[0-9\]] (hex 30-39), or hyphen-minus (hex 2d). In the example, this gives: ["screen"], ["3d-glasses"], ["print"].} {- A case-insensitive match is then made with the set of media types defined above. User agents may ignore entries that don't match. In the example we are left with ["screen"] and ["print"].}} Note. Style sheets may include media-dependent variations within them (e.g., the [CSS \@media] construct). In such cases it may be appropriate to use ["media=all"]. *) type multilength = [ | length | `Relative of int ] (** The value may be a Length or a relative length. A relative length has the form ["i*"], where ["i"] is an integer. When allotting space among elements competing for that space, user agents allot pixel and percentage lengths first, then divide up remaining available space among relative lengths. Each relative length receives a portion of the available space that is proportional to the integer preceding the ["*"]. The value ["*"] is equivalent to ["1*"]. Thus, if 60 pixels of space are available after the user agent allots pixel and percentage space, and the competing relative lengths are ["1*"], ["2*"], and ["3*"], the ["1*"] will be allotted 10 pixels, the ["2*"] will be allotted 20 pixels, and the ["3*"] will be allotted 30 pixels. *) type multilengths = multilength list (** A comma separated list of items of type MultiLength. *) type number = int (** One or more digits. *) type pixels = int (** The value is an integer that represents the number of pixels of the canvas (screen, paper). Thus, the value ["50"] means fifty pixels. For normative information about the definition of a pixel, please consult CSS2. @see <http://www.w3.org/TR/1998/REC-CSS2-19980512> CSS2 *) type text = string (** Arbitrary textual data, likely meant to be human-readable. *) (** Attributes *) type core = [ | `Class | `Id | `Title | `XML_space ] type i18n = [ | `XML_lang | `Dir ] type events = [ | `OnClick | `OnDblClick | `OnMouseDown | `OnMouseUp | `OnMouseOver | `OnMouseMove | `OnMouseOut | `OnKeyPress | `OnKeyDown | `OnKeyUp ] type common = [ | core | i18n | events | `Style_Attr ] module HYPERTEXT : sig type inline = [ | `A ] type flow = inline end module LIST : sig type list = [ | `Dl | `Ol | `Ul ] type t = [ | `Dd | `Dt | `Li ] type flow = list end module PRESENTATION : sig type block = [ | `Hr ] type inline = [ | `B | `Big | `I | `Small | `Sub | `Sup | `Tt ] type flow = [ | inline | block ] end module FORMS : sig type t = [ | `Option ] type form = [ | `Form ] type formctrl_sans_label = [ | `Input | `Select | `Textarea | `Button ] type formctrl = [ | formctrl_sans_label | `Label ] type block = form type inline_sans_label = formctrl_sans_label type inline = formctrl type flow_sans_label = [ | block | inline_sans_label ] type flow = [ | block | inline ] end module TABLES : sig type t = [ | `Caption | `Td | `Th | `Tr ] type block = [ | `Table ] type flow = block end module STYLE_SHEET : sig type t = [ | `Style ] end module LINK : sig type t = [ | `Link ] end module BASE : sig type t = [ | `Base ] end module TEXT : sig type heading = [ | `H1 | `H2 | `H3 | `H4 | `H5 | `H6 ] type block = [ | `Address | `Blockquote | `Div | `P | `Pre ] type inline = [ | `Abbr | `Acronym | `Br | `Cite | `Code | `Dfn | `Em | `Iframe | `Kbd | `Q | `Samp | `Span | `Strong | `Var ] type flow = [ | heading | block | inline ] end type edit = [ | `Ins | `Del ] type scripttag = [ | `Script | `Noscript ] type misc = [ | edit | scripttag ] module SPECIAL : sig type inline = [ | `Img | `Map | `Object ] type block = [ | `Table | `Form | `Fieldset ] type flow = [ | inline | block ] end type i18nclass = [ | `Bdo ] module RUBY : sig type inline = [ | `Ruby_simple1 | `Ruby_simple2 | `Ruby_complex ] type flow = inline end type no_ruby_inline = [ | TEXT. inline | PRESENTATION. inline | HYPERTEXT. inline | SPECIAL. inline | FORMS. inline | i18nclass ] type no_ruby_content = [ | `PCDATA | no_ruby_inline | misc ] (** {1 Combined Element Sets:} *) type block = [ | TEXT. block | PRESENTATION. block | FORMS. block | TABLES. block | SPECIAL. block | TEXT. heading | LIST. list | misc ] type block_sans_form = [ | TEXT. block | PRESENTATION. block | TABLES. block | TEXT. heading | LIST. list | misc ] type flow = [ | TEXT. flow | HYPERTEXT. flow | LIST. flow | FORMS. flow | TABLES. flow | PRESENTATION. flow | SPECIAL. flow | i18nclass | misc | RUBY. flow ] type flow_sans_table = [ | TEXT. flow | HYPERTEXT. flow | LIST. flow | FORMS. flow | PRESENTATION. flow | SPECIAL. flow | i18nclass | misc | RUBY. flow ] type inline = [ | TEXT. inline | HYPERTEXT. inline | PRESENTATION. inline | FORMS. inline | SPECIAL. inline | i18nclass | misc | RUBY. inline ] type inline_sans_a_mix = [ | TEXT. inline | PRESENTATION. inline | FORMS. inline | SPECIAL. inline | i18nclass | misc | RUBY. inline ] type buttoncontent = (* VB *) [ | TEXT. inline | PRESENTATION. inline | SPECIAL. inline | i18nclass | block_sans_form ] type precontent = inline type inline_sans_label = [ | TEXT. inline | HYPERTEXT. inline | PRESENTATION. inline | FORMS. inline_sans_label | SPECIAL. inline | i18nclass | misc ] type heading = TEXT.heading type xhtml = [ | `Html ] type pcdata = [ | `PCDATA ] type notag type html = [ | `Html ] type html_attrib = [ | i18n | `Version | `XMLns | `Id ] type html_content = [ | `Body | `Head ] type head = [ | `Head ] type head_content = [ | `Title | `Base | `Meta | `Link | `Style | `Object | `Script ] type head_attrib = [ | i18n | `Profile | `Id ] type table = [ `Table ] type table_attrib = [ common | `Summary | `Width | `Tr ] type table_content = [ `Tr ] type inlinemix = [ | `PCDATA | inline ] (* NAME: title - KIND: nary - ATTRIB: [= i18n | `Id ] - CONTENT: [= `PCDATA ] - OUT: [=`Title] *) type title = [ | `Title ] type title_attrib = [ | i18n | `Id ] type title_content = [ | `PCDATA ] (* NAME: body - KIND: star - ATTRIB: [= common |`OnLoad |`OnUnload ] - CONTENT: [= block ] - OUT: [=`Body] *) type body = [ | `Body ] type body_attrib = [ | common | `OnLoad | `OnUnload ] type body_content = [ | block ] (* NAME: h1 - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`H1] *) type h1 = [ | `H1 ] type h1_attrib = [ | common ] type h1_content = [ | `PCDATA | inline ] (* NAME: h2 - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`H2] *) type h2 = [ | `H2 ] type h2_attrib = [ | common ] type h2_content = [ | `PCDATA | inline ] (* NAME: h3 - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`H3] *) type h3 = [ | `H3 ] type h3_attrib = [ | common ] type h3_content = [ | `PCDATA | inline ] (* NAME: h4 - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`H4] *) type h4 = [ | `H4 ] type h4_attrib = [ | common ] type h4_content = [ | `PCDATA | inline ] (* NAME: h5 - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`H5] *) type h5 = [ | `H5 ] type h5_attrib = [ | common ] type h5_content = [ | `PCDATA | inline ] (* NAME: h6 - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`H6] *) type h6 = [ | `H6 ] type h6_attrib = [ | common ] type h6_content = [ | `PCDATA | inline ] (* NAME: address - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Address] *) type address = [ | `Address ] type address_attrib = [ | common ] type address_content = [ | `PCDATA | inline ] (* NAME: div - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | flow ] - OUT: [=`Div] *) type div = [ | `Div ] type div_attrib = [ | common ] type div_content = [ | `PCDATA | flow ] (* NAME: p - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`P] *) type p = [ | `P ] type p_attrib = [ | common ] type p_content = [ | `PCDATA | inline ] (* NAME: abbr - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Abbr] *) type abbr = [ | `Abbr ] type abbr_attrib = [ | common ] type abbr_content = [ | `PCDATA | inline ] (* NAME: acronym - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Acronym] *) type acronym = [ | `Acronym ] type acronym_attrib = [ | common ] type acronym_content = [ | `PCDATA | inline ] (* NAME: br - KIND: nullary - ATTRIB: [= core ] - CONTENT: notag - OUT: [=`Br] *) type br = [ | `Br ] type br_attrib = [ | core ] type br_content = notag (* NAME: cite - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Cite] *) type cite = [ | `Cite ] type cite_attrib = [ | common ] type cite_content = [ | `PCDATA | inline ] (* NAME: code - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Code] *) type code = [ | `Code ] type code_attrib = [ | common ] type code_content = [ | `PCDATA | inline ] (* NAME: dfn - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Dfn] *) type dfn = [ | `Dfn ] type dfn_attrib = [ | common ] type dfn_content = [ | `PCDATA | inline ] (* NAME: em - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Em] *) type em = [ | `Em ] type em_attrib = [ | common ] type em_content = [ | `PCDATA | inline ] (* NAME: kbd - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Kbd] *) type kbd = [ | `Kbd ] type kbd_attrib = [ | common ] type kbd_content = [ | `PCDATA | inline ] (* NAME: q - KIND: star - ATTRIB: [= common | `Cite ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Q] *) type q = [ | `Q ] type q_attrib = [ | common | `Cite ] type q_content = [ | `PCDATA | inline ] (* NAME: samp - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Samp] *) type samp = [ | `Samp ] type samp_attrib = [ | common ] type samp_content = [ | `PCDATA | inline ] (* NAME: span - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Span] *) type span = [ | `Span ] type span_attrib = [ | common ] type span_content = [ | `PCDATA | inline ] (* NAME: strong - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Strong] *) type strong = [ | `Strong ] type strong_attrib = [ | common ] type strong_content = [ | `PCDATA | inline ] (* NAME: var - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Var] *) type var = [ | `Var ] type var_attrib = [ | common ] type var_content = [ | `PCDATA | inline ] (* NAME: a - KIND: star - ATTRIB: [= common | `Accesskey | `Charset | `Href | `Hreflang | `Name_01_00 | `Rel | `Rev | `Tabindex | `Target | `Type | `Shape | `Coords | `OnBlur |`OnFocus] - CONTENT: [= `PCDATA | inline_sans_a_mix ] - OUT: [=`A] *) type a = [ | `A ] type a_attrib = [ | common | `Accesskey | `Charset | `Href | `Hreflang | `Name_01_00 | `Rel | `Rev | `Tabindex | `Target | `Type | `Shape | `Coords | `OnBlur | `OnFocus ] type a_content = [ | `PCDATA | inline_sans_a_mix ] (* NAME: dl - KIND: plus - ATTRIB: [= common ] - CONTENT: [= `Dt | `Dd ] - OUT: [=`Dl] *) type dl = [ | `Dl ] type dl_attrib = [ | common ] type dl_content = [ | `Dt | `Dd ] (* NAME: ol - KIND: plus - ATTRIB: [= common ] - CONTENT: [= `Li ] - OUT: [=`Ol] *) type ol = [ | `Ol ] type ol_attrib = [ | common ] type ol_content = [ | `Li ] (* NAME: ul - KIND: plus - ATTRIB: [= common ] - CONTENT: [= `Li ] - OUT: [=`Ul] *) type ul = [ | `Ul ] type ul_attrib = [ | common ] type ul_content = [ | `Li ] (* NAME: dd - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | flow ] - OUT: [=`Dd] *) type dd = [ | `Dd ] type dd_attrib = [ | common ] type dd_content = [ | `PCDATA | flow ] (* NAME: dt - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Dt] *) type dt = [ | `Dt ] type dt_attrib = [ | common ] type dt_content = [ | `PCDATA | inline ] (* NAME: li - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | flow ] - OUT: [=`Li] *) type li = [ | `Li ] type li_attrib = [ | common ] type li_content = [ | `PCDATA | flow ] (* NAME: hr - KIND: nullary - ATTRIB: [= common ] - CONTENT: notag - OUT: [=`Hr] *) type hr = [ | `Hr ] type hr_attrib = [ | common ] type hr_content = notag (* NAME: b - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`B] *) type b = [ | `B ] type b_attrib = [ | common ] type b_content = [ | `PCDATA | inline ] (* NAME: big - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Big] *) type big = [ | `Big ] type big_attrib = [ | common ] type big_content = [ | `PCDATA | inline ] (* NAME: i - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`I] *) type i = [ | `I ] type i_attrib = [ | common ] type i_content = [ | `PCDATA | inline ] (* NAME: small - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Small] *) type small = [ | `Small ] type small_attrib = [ | common ] type small_content = [ | `PCDATA | inline ] (* NAME: sub - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Sub] *) type sub = [ | `Sub ] type sub_attrib = [ | common ] type sub_content = [ | `PCDATA | inline ] (* NAME: sup - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Sup] *) type sup = [ | `Sup ] type sup_attrib = [ | common ] type sup_content = [ | `PCDATA | inline ] (* NAME: tt - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Tt] *) type tt = [ | `Tt ] type tt_attrib = [ | common ] type tt_content = [ | `PCDATA | inline ] (* NAME: bdo - KIND: star - ATTRIB: [= core | `XML_lang ] - CONTENT: [= `PCDATA | inline ] - OUT: [= `Bdo ] *) type bdo = [ | `Bdo ] type bdo_attrib = [ | core | `XML_lang ] type bdo_content = [ | `PCDATA | inline ] (* NAME: area - KIND: nullary - ATTRIB: [= common | `Href | `Shape | `Coords | `Nohref | `Tabindex | `Accesskey |`OnBlur |`OnFocus] - CONTENT: notag - OUT: [=`Area] *) type area = [ | `Area ] type area_attrib = [ | common | `Href | `Shape | `Coords | `Nohref | `Tabindex | `Accesskey | `OnBlur | `OnFocus ] type area_content = notag (* NAME: map - KIND: plus - ATTRIB: [= events | core | `XMLns | `Class | `Title | i18n ] - CONTENT: [= block | `Area ] - OUT: [=`Map] *) type map = [ | `Map ] type map_attrib = [ | events | core | `XMLns | `Class | `Title | i18n ] type map_content = [ | block | `Area ] (* NAME: del - KIND: star - ATTRIB: [= common | `Cite | `Datetime ] - CONTENT: [= `PCDATA | flow ] - OUT: [=`Del] *) type del = [ | `Del ] type del_attrib = [ | common | `Cite | `Datetime ] type del_content = [ | `PCDATA | flow ] (* NAME: ins - KIND: star - ATTRIB: [= common | `Cite | `Datetime ] - CONTENT: [= `PCDATA | flow ] - OUT: [=`Ins] *) type ins = [ | `Ins ] type ins_attrib = [ | common | `Cite | `Datetime ] type ins_content = [ | `PCDATA | flow ] (* NAME: script - KIND: nary - ATTRIB: [= `XMLns | `Id | `Charset | `Src | `Defer | `XML_space ] - CONTENT: [= `PCDATA ] - OUT: [=`Script] *) type script = [ | `Script ] type script_attrib = [ | `XMLns | `Id | `Charset | `Src | `Defer | `XML_space ] type script_content = [ | `PCDATA ] (* NAME: noscript - KIND: plus - ATTRIB: [= common ] - CONTENT: [= block ] - OUT: [=`Noscript] *) type noscript = [ | `Noscript ] type noscript_attrib = [ | common ] type noscript_content = [ | block ] (* NAME: form - KIND: plus - ATTRIB: [= common | `Enctype | `Method | `Name_01_00 | `Target | `Accept_charset | `Accept |`OnReset | `OnSubmit] - CONTENT: [= block_sans_form | `Fieldset ] - OUT: [=`Form] *) type form = [ | `Form ] type form_attrib = [ | common | `Enctype | `Method | `Name_01_00 | `Target | `Accept_charset | `Accept | `OnReset | `OnSubmit ] type form_content = [ | block_sans_form | `Fieldset ] (* NAME: input - KIND: nullary - ATTRIB: [= common | `Accesskey | `Checked | `Maxlength | `Name | `Size | `Src | `Tabindex | `Input_Type | `Value | `Disabled | `ReadOnly | `Alt | `Accept | `Usemap |`Ismap |`OnBlur |`OnChange |`OnFocus | `OnSelect] - CONTENT: notag - OUT: [=`Input] *) type input = [ | `Input ] type input_attrib = [ | common | `Accesskey | `Checked | `Maxlength | `Name | `Size | `Src | `Tabindex | `Input_Type | `Value | `Disabled | `ReadOnly | `Alt | `Accept | `Usemap | `Ismap | `OnBlur | `OnChange | `OnFocus | `OnSelect ] type input_content = notag (* NAME: label - KIND: star - ATTRIB: [= common | `Accesskey | `For |`OnBlur |`OnFocus] - CONTENT: [= `PCDATA | inline_sans_label ] - OUT: [=`Label] *) type label = [ | `Label ] type label_attrib = [ | common | `Accesskey | `For | `OnBlur | `OnFocus ] type label_content = [ | `PCDATA | inline_sans_label ] (* NAME: optgroup - KIND: plus - ATTRIB: [= common | `Disabled ] - CONTENT: [= `Option ] - OUT: [=`Optgroup] *) type optgroup = [ | `Optgroup ] type optgroup_attrib = [ | common | `Disabled ] type optgroup_content = [ | `Option ] (* NAME: option - KIND: nary - ATTRIB: [= common | `Selected | `Value | `Disabled | `Label ] - CONTENT: [= `PCDATA ] - OUT: [=`Option] *) type selectoption = [ | `Option ] type option_attrib = [ | common | `Selected | `Value | `Disabled | `Label ] type option_content = [ | `PCDATA ] (* NAME: select - KIND: plus - ATTRIB: [= common | `Multiple | `Name | `Size | `Tabindex | `Disabled |`OnBlur |`OnChange |`OnFocus ] - CONTENT: [= `Option | `Optgroup ] - OUT: [=`Select] *) type select = [ | `Select ] type select_attrib = [ | common | `Multiple | `Name | `Size | `Tabindex | `Disabled | `OnBlur | `OnChange | `OnFocus ] type select_content = [ | `Option | `Optgroup ] (* NAME: textarea - KIND: nary - ATTRIB: [= common | `Accesskey | `Name | `Tabindex | `Disabled | `ReadOnly |`OnBlur |`OnChange |`OnFocus | `OnSelect] - CONTENT: [= `PCDATA ] - OUT: [=`Textarea] *) type textarea = [ | `Textarea ] type textarea_attrib = [ | common | `Accesskey | `Name | `Tabindex | `Disabled | `ReadOnly | `OnBlur | `OnChange | `OnFocus | `OnSelect ] type textarea_content = [ | `PCDATA ] (* NAME: fieldset - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | `Legend | flow ] - OUT: [=`Fieldset] *) type fieldset = [ | `Fieldset ] type fieldset_attrib = [ | common ] type fieldset_content = [ | `PCDATA | `Legend | flow ] (* NAME: legend - KIND: star - ATTRIB: [= common | `Accesskey ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Legend] *) type legend = [ | `Legend ] type legend_attrib = [ | common | `Accesskey ] type legend_content = [ | `PCDATA | inline ] (* NAME: button - KIND: star - ATTRIB: [= common | `Name | `Value | `Button_Type | `Disabled | `Accesskey | `Tabindex |`OnBlur |`OnFocus] - CONTENT: [= `PCDATA | buttoncontent ] - OUT: [=`Button] *) type button = [ | `Button ] type button_attrib = [ | common | `Name | `Value | `Button_Type | `Disabled | `Accesskey | `Tabindex | `OnBlur | `OnFocus ] type button_content = [ | `PCDATA | buttoncontent ] (* NAME: caption - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA | inline ] - OUT: [=`Caption] *) type caption = [ | `Caption ] type caption_attrib = [ | common ] type caption_content = [ | `PCDATA | inline ] (* NAME: td - KIND: star - ATTRIB: [= common | `Abbr | `Align | `Axis | `Char | `Charoff | `Colspan | `Headers | `Rowspan | `Scope | `Valign ] - CONTENT: [= `PCDATA | flow ] - OUT: [=`Td] *) type td = [ | `Td ] type td_attrib = [ | common | `Abbr | `Align | `Axis | `Char | `Charoff | `Colspan | `Headers | `Rowspan | `Scope | `Valign ] type td_content = [ | `PCDATA | flow ] (* NAME: th - KIND: star - ATTRIB: [= common | `Abbr | `Align | `Axis | `Char | `Charoff | `Colspan | `Headers | `Rowspan | `Scope | `Valign ] - CONTENT: [= `PCDATA | flow ] - OUT: [=`Th] *) type th = [ | `Th ] type th_attrib = [ | common | `Abbr | `Align | `Axis | `Char | `Charoff | `Colspan | `Headers | `Rowspan | `Scope | `Valign ] type th_content = [ | `PCDATA | flow ] (* NAME: tr - KIND: plus - ATTRIB: [= common | `Align | `Char | `Charoff | `Valign ] - CONTENT: [= `Td | `Th ] - OUT: [=`Tr] *) type tr = [ | `Tr ] type tr_attrib = [ | common | `Align | `Char | `Charoff | `Valign ] type tr_content = [ | `Td | `Th ] (* NAME: col - KIND: nullary - ATTRIB: [= common | `Align | `Char | `Charoff | `Span | `Valign | `Width ] - CONTENT: notag - OUT: [=`Col] *) type col = [ | `Col ] type col_attrib = [ | common | `Align | `Char | `Charoff | `Span | `Valign | `Width ] type col_content = notag (* NAME: colgroup - KIND: star - ATTRIB: [= common | `Align | `Char | `Charoff | `Span | `Valign | `Width ] - CONTENT: [= `Col ] - OUT: [=`Colgroup] *) type colgroup = [ | `Colgroup ] type colgroup_attrib = [ | common | `Align | `Char | `Charoff | `Span | `Valign | `Width ] type colgroup_content = [ | `Col ] (* NAME: thead - KIND: plus - ATTRIB: [= common | `Align | `Char | `Charoff | `Valign ] - CONTENT: [= `Tr ] - OUT: [=`Thead] *) type thead = [ | `Thead ] type thead_attrib = [ | common | `Align | `Char | `Charoff | `Valign ] type thead_content = [ | `Tr ] (* NAME: tbody - KIND: plus - ATTRIB: [= common | `Align | `Char | `Charoff | `Valign ] - CONTENT: [= `Tr ] - OUT: [=`Tbody] *) type tbody = [ | `Tbody ] type tbody_attrib = [ | common | `Align | `Char | `Charoff | `Valign ] type tbody_content = [ | `Tr ] (* NAME: tfoot - KIND: plus - ATTRIB: [= common | `Align | `Char | `Charoff | `Valign ] - CONTENT: [= `Tr ] - OUT: [=`Tfoot] *) type tfoot = [ | `Tfoot ] type tfoot_attrib = [ | common | `Align | `Char | `Charoff | `Valign ] type tfoot_content = [ | `Tr ] (* NAME: img - KIND: nullary - ATTRIB: [= common | `Height | `Longdesc | `Name_01_00 | `Width | `Usemap |`Ismap ] - CONTENT: notag - OUT: [=`Img] *) type img = [ | `Img ] type img_attrib = [ | common | `Height | `Longdesc | `Name_01_00 | `Width | `Usemap | `Ismap ] type img_content = notag (* NAME: object_ - KIND: star - ATTRIB: [= common | `Declare | `Classid | `Codebase | `Data | `Type | `Codetype | `Archive | `Standby | `Height | `Width | `Name | `Tabindex | `Usemap] - CONTENT: [= `PCDATA | flow | `Param ] - OUT: [= `Object ] *) type object_ = [ | `Object ] type object__attrib = [ | common | `Declare | `Classid | `Codebase | `Data | `Type | `Codetype | `Archive | `Standby | `Height | `Width | `Name | `Tabindex | `Usemap ] type object__content = [ | `PCDATA | flow | `Param ] (* NAME: param - KIND: nullary - ATTRIB: [= `XMLns |`Id | `Value | `Value_Type | `Type ] - CONTENT: notag - OUT: [= `Param ] *) type param = [ | `Param ] type param_attrib = [ | `XMLns | `Id | `Value | `Value_Type | `Type ] type param_content = notag (* NAME: frameset - KIND: plus - ATTRIB: [= core | `FS_Rows | `FS_Cols |`OnLoad |`OnUnload] - CONTENT: [= `Frameset | `Frame ] - OUT: [=`Frameset] *) type frameset = [ | `Frameset ] type frameset_attrib = [ | core | `FS_Rows | `FS_Cols | `OnLoad | `OnUnload ] type frameset_content = [ | `Frameset | `Frame ] (* NAME: frame - KIND: nullary - ATTRIB: [= core | `Frameborder | `Longdesc | `Marginheight | `Marginwidth | `Name_01_00 | `Noresize | `Scrolling ] - CONTENT: notag - OUT: [=`Frame] *) type frame = [ | `Frame ] type frame_attrib = [ | core | `Frameborder | `Longdesc | `Marginheight | `Marginwidth | `Name_01_00 | `Noresize | `Scrolling ] type frame_content = notag (* NAME: noframes - KIND: nary - ATTRIB: [= common ] - CONTENT: [= `Body ] - OUT: [=`Noframes] *) type noframes = [ | `Noframes ] type noframes_attrib = [ | common ] type noframes_content = [ | `Body ] (* NAME: iframe - KIND: star - ATTRIB: [= core | `Frameborder | `Longdesc | `Marginheight | `Marginwidth | `Src | `Scrolling | `Name_01_00 | `Width | `Height ] - CONTENT: [= `PCDATA | flow ] - OUT: [=`Iframe] *) type iframe = [ | `Iframe ] type iframe_attrib = [ | core | `Frameborder | `Longdesc | `Marginheight | `Marginwidth | `Src | `Scrolling | `Name_01_00 | `Width | `Height ] type iframe_content = [ | `PCDATA | flow ] (* NAME: meta - KIND: nullary - ATTRIB: [= i18n |`Id | `Http_equiv | `Name | `Scheme ] - CONTENT: notag - OUT: [=`Meta] *) type meta = [ | `Meta ] type meta_attrib = [ | i18n | `Id | `Http_equiv | `Name | `Scheme ] type meta_content = notag (* NAME: style - KIND: star - ATTRIB: [= i18n |`XMLns |`Id | `Media | `Title | `XML_space ] - CONTENT: [= `PCDATA ] - OUT: [=`Style] *) type style = [ | `Style ] type style_attrib = [ | i18n | `XMLns | `Id | `Media | `Title | `XML_space ] type style_content = [ | `PCDATA ] (* NAME: link - KIND: nullary - ATTRIB: [= common | `Charset | `Href | `Hreflang | `Media | `Rel | `Rev | `Target | `Type ] - CONTENT: notag - OUT: [=`Link] *) type link = [ | `Link ] type link_attrib = [ | common | `Charset | `Href | `Hreflang | `Media | `Rel | `Rev | `Target | `Type ] type link_content = notag (* NAME: base - KIND: nullary - ATTRIB: [= `XMLns | `Target ] - CONTENT: notag - OUT: [=`Base] *) type base = [ | `Base ] type base_attrib = [ | `XMLns | `Target ] type base_content = notag (* NAME: rbc - KIND: plus - ATTRIB: [= common ] - CONTENT: [= `Rb ] - OUT: [=`Rbc] *) type rbc = [ | `Rbc ] type rbc_attrib = [ | common ] type rbc_content = [ | `Rb ] (* NAME: rtc - KIND: plus - ATTRIB: [= common ] - CONTENT: [= `Rt ] - OUT: [=`Rtc] *) type rtc = [ | `Rtc ] type rtc_attrib = [ | common ] type rtc_content = [ | `Rt ] (* NAME: rtc_complex - KIND: plus - ATTRIB: [= common ] - CONTENT: [= `Rt_complex ] - OUT: [=`Rtc] *) type rtc_complex = [ | `Rtc ] type rtc_complex_attrib = [ | common ] type rtc_complex_content = [ | `Rt_complex ] (* NAME: rb - KIND: star - ATTRIB: [= common ] - CONTENT: [= no_ruby_content ] - OUT: [=`Rb] *) type rb = [ | `Rb ] type rb_attrib = [ | common ] type rb_content = [ | no_ruby_content ] (* NAME: rt - KIND: star - ATTRIB: [= common ] - CONTENT: [= no_ruby_content ] - OUT: [=`Rt] *) type rt = [ | `Rt ] type rt_attrib = [ | common ] type rt_content = [ | no_ruby_content ] (* NAME: rt_complex - KIND: star - ATTRIB: [= common | `Rbspan] - CONTENT: [= no_ruby_content ] - OUT: [=`Rt] *) type rt_complex = [ | `Rt ] type rt_complex_attrib = [ | common | `Rbspan ] type rt_complex_content = [ | no_ruby_content ] (* NAME: rp - KIND: star - ATTRIB: [= common ] - CONTENT: [= `PCDATA ] - OUT: [=`Rp] *) type rp = [ | `Rp ] type rp_attrib = [ | common ] type rp_content = [ | `PCDATA ] ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tyxml-2.2.0/lib/html5_sigs.mli����������������������������������������������������������������������0000644�0000000�0000000�00000113301�12060404012�014371� 0����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) module type T = sig open Html5_types module Xml : Xml_sigs.T module Svg : Svg_sigs.T with module Xml := Xml module Info : Xml_sigs.Info type uri = Xml.uri val string_of_uri : uri -> string val uri_of_string : string -> uri (** {1 Common Attributes} *) type +'a attrib val to_xmlattribs : ('a attrib) list -> Xml.attrib list (* VB *) val to_attrib : Xml.attrib -> 'a attrib (* GH *) (** ['a] is known as a {i phantom type}. The implementation is actually monomorphic (the different element types are distinguished by a homogeneous variable, such as their textual representation) and the type variable [`a] is just used by the type checker. NB: It might be possible to use polymorphic variants directly, without phantom types, but the implementation is likely to be more involved. *) val a_autocomplete : [< | `On | `Off] -> [> | `Autocomplete] attrib val a_async : [< | `Async] -> [> | `Async] attrib val a_autofocus : [< | `Autofocus] -> [> | `Autofocus] attrib val a_autoplay : [< | `Autoplay] -> [> | `Autoplay] attrib val a_challenge : text -> [> | `Challenge] attrib val a_contenteditable : [< | `True | `False] -> [> | `Contexteditable] attrib val a_contextmenu : idref -> [> | `Contextmenu] attrib val a_controls : [< | `Controls] -> [> | `Controls] attrib val a_dir : [< | `Rtl | `Ltr] -> [> | `Dir] attrib val a_draggable : [< | `True | `False] -> [> | `Draggable] attrib val a_form : idref -> [> | `Form] attrib val a_formaction : Xml.uri -> [> | `Formaction] attrib val a_formenctype : contenttype -> [> | `Formenctype] attrib val a_formmethod : [< | `Get | `Post | `Put | `Delete] -> [> | `Formmethod] attrib val a_formnovalidate : [< | `Formnovalidate] -> [> | `Formnovalidate] attrib val a_formtarget : text -> [> | `Formtarget] attrib val a_hidden : [< | `Hidden] -> [> | `Hidden] attrib val a_high : float_number -> [> | `High] attrib val a_icon : Xml.uri -> [> | `Icon] attrib val a_ismap : [< | `Ismap] -> [> | `Ismap] attrib val a_keytype : text -> [> | `Keytype] attrib val a_list : idref -> [> | `List] attrib val a_loop : [< | `Loop] -> [> | `Loop] attrib val a_low : float_number -> [> | `High] attrib val a_max : float_number -> [> | `Max] attrib val a_input_max : number -> [> | `Max] attrib val a_min : float_number -> [> | `Min] attrib val a_input_min : number -> [> | `Min] attrib val a_novalidate : [< | `Novalidate] -> [> | `Novalidate] attrib val a_open : [< | `Open] -> [> | `Open] attrib val a_optimum : float_number -> [> | `Optimum] attrib val a_pattern : text -> [> | `Pattern] attrib val a_placeholder : text -> [> | `Placeholder] attrib val a_poster : Xml.uri -> [> | `Poster] attrib val a_preload : [< | `None | `Metadata | `Audio] -> [> | `Preload] attrib val a_pubdate : [< | `Pubdate] -> [> | `Pubdate] attrib val a_radiogroup : text -> [> | `Radiogroup] attrib val a_required : [< | `Required] -> [> | `Required] attrib val a_reversed : [< | `Reversed] -> [> | `Reversed] attrib val a_sandbox : [< | `AllowSameOrigin | `AllowForms | `AllowScript] list -> [> | `Sandbox] attrib val a_spellcheck : [< | `True | `False] -> [> | `Spellcheck] attrib val a_scoped : [< | `Scoped] -> [> | `Scoped] attrib val a_seamless : [< | `Seamless] -> [> | `Seamless] attrib val a_sizes : numbers -> [> | `Sizes] attrib val a_span : number -> [> | `Span] attrib (*val a_srcdoc*) val a_srclang : nmtoken -> [> | `XML_lang] attrib val a_start : number -> [> | `Start] attrib val a_step : float_number -> [> | `Step] attrib val a_wrap : [< | `Soft | `Hard] -> [> | `Wrap] attrib val a_class : nmtokens -> [> | `Class] attrib (** This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. *) val a_user_data : nmtoken -> text -> [> | `User_data] attrib (** May be used to specify custom attribs. The example given by the W3C is as follows : {v <ol> <li data-length="2m11s">Beyond The Sea</li> </ol> v} It should be used for preprocessing ends only. *) val a_id : text -> [> | `Id] attrib (** This attribute assigns a name to an element. This name must be unique in a document. The text should be without any space. *) val a_title : text -> [> | `Title] attrib (** This attribute offers advisory information about the element for which it is set. *) (** Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a {i tool tip} (a short message that appears when the pointing device pauses over an object). Audio user agents may speak the title information in a similar context. *) (** The title attribute has an additional role when used with the [link] element to designate an external style sheet. Please consult the section on links and style sheets for details. *) (** {2 I18N} *) val a_xml_lang : nmtoken -> [> | `XML_lang] attrib (** {2 Events} *) (** Javascript events *) val a_onabort : Xml.event_handler -> [> | `OnAbort] attrib val a_onafterprint : Xml.event_handler -> [> | `OnAfterPrint] attrib val a_onbeforeprint : Xml.event_handler -> [> | `OnBeforePrint] attrib val a_onbeforeunload : Xml.event_handler -> [> | `OnBeforeUnload] attrib val a_onblur : Xml.event_handler -> [> | `OnBlur] attrib val a_oncanplay : Xml.event_handler -> [> | `OnCanPlay] attrib val a_oncanplaythrough : Xml.event_handler -> [> | `OnCanPlayThrough] attrib val a_onchange : Xml.event_handler -> [> | `OnChange] attrib val a_onclick : Xml.event_handler -> [> | `OnClick] attrib val a_oncontextmenu : Xml.event_handler -> [> | `OnContextMenu] attrib val a_ondblclick : Xml.event_handler -> [> | `OnDblClick] attrib val a_ondrag : Xml.event_handler -> [> | `OnDrag] attrib val a_ondragend : Xml.event_handler -> [> | `OnDragEnd] attrib val a_ondragenter : Xml.event_handler -> [> | `OnDragEnter] attrib val a_ondragleave : Xml.event_handler -> [> | `OnDragLeave] attrib val a_ondragover : Xml.event_handler -> [> | `OnDragOver] attrib val a_ondragstart : Xml.event_handler -> [> | `OnDragStart] attrib val a_ondrop : Xml.event_handler -> [> | `OnDrop] attrib val a_ondurationchange : Xml.event_handler -> [> | `OnDurationChange] attrib val a_onemptied : Xml.event_handler -> [> | `OnEmptied] attrib val a_onended : Xml.event_handler -> [> | `OnEnded] attrib val a_onerror : Xml.event_handler -> [> | `OnError] attrib val a_onfocus : Xml.event_handler -> [> | `OnFocus] attrib val a_onformchange : Xml.event_handler -> [> | `OnFormChange] attrib val a_onforminput : Xml.event_handler -> [> | `OnFormInput] attrib val a_onhashchange : Xml.event_handler -> [> | `OnHashChange] attrib val a_oninput : Xml.event_handler -> [> | `OnInput] attrib val a_oninvalid : Xml.event_handler -> [> | `OnInvalid] attrib val a_onmousedown : Xml.event_handler -> [> | `OnMouseDown] attrib val a_onmouseup : Xml.event_handler -> [> | `OnMouseUp] attrib val a_onmouseover : Xml.event_handler -> [> | `OnMouseOver] attrib val a_onmousemove : Xml.event_handler -> [> | `OnMouseMove] attrib val a_onmouseout : Xml.event_handler -> [> | `OnMouseOut] attrib val a_onmousewheel : Xml.event_handler -> [> | `OnMouseWheel] attrib val a_onoffline : Xml.event_handler -> [> | `OnOffLine] attrib val a_ononline : Xml.event_handler -> [> | `OnOnLine] attrib val a_onpause : Xml.event_handler -> [> | `OnPause] attrib val a_onplay : Xml.event_handler -> [> | `OnPlay] attrib val a_onplaying : Xml.event_handler -> [> | `OnPlaying] attrib val a_onpagehide : Xml.event_handler -> [> | `OnPageHide] attrib val a_onpageshow : Xml.event_handler -> [> | `OnPageShow] attrib val a_onpopstate : Xml.event_handler -> [> | `OnPopState] attrib val a_onprogress : Xml.event_handler -> [> | `OnProgress] attrib val a_onratechange : Xml.event_handler -> [> | `OnRateChange] attrib val a_onreadystatechange : Xml.event_handler -> [> | `OnReadyStateChange] attrib val a_onredo : Xml.event_handler -> [> | `OnRedo] attrib val a_onresize : Xml.event_handler -> [> | `OnResize] attrib val a_onscroll : Xml.event_handler -> [> | `OnScroll] attrib val a_onseeked : Xml.event_handler -> [> | `OnSeeked] attrib val a_onseeking : Xml.event_handler -> [> | `OnSeeking] attrib val a_onselect : Xml.event_handler -> [> | `OnSelect] attrib val a_onshow : Xml.event_handler -> [> | `OnShow] attrib val a_onstalled : Xml.event_handler -> [> | `OnStalled] attrib val a_onstorage : Xml.event_handler -> [> | `OnStorage] attrib val a_onsubmit : Xml.event_handler -> [> | `OnSubmit] attrib val a_onsuspend : Xml.event_handler -> [> | `OnSuspend] attrib val a_ontimeupdate : Xml.event_handler -> [> | `OnTimeUpdate] attrib val a_onundo : Xml.event_handler -> [> | `OnUndo] attrib val a_onunload : Xml.event_handler -> [> | `OnUnload] attrib val a_onvolumechange : Xml.event_handler -> [> | `OnVolumeChange] attrib val a_onwaiting : Xml.event_handler -> [> | `OnWaiting] attrib val a_onkeypress : Xml.event_handler -> [> | `OnKeyPress] attrib val a_onkeydown : Xml.event_handler -> [> | `OnKeyDown] attrib val a_onkeyup : Xml.event_handler -> [> | `OnKeyUp] attrib val a_onload : Xml.event_handler -> [> | `OnLoad] attrib val a_onloadeddata : Xml.event_handler -> [> | `OnLoadedData] attrib val a_onloadedmetadata : Xml.event_handler -> [> | `OnLoadedMetaData] attrib val a_onloadstart : Xml.event_handler -> [> | `OnLoadStart] attrib val a_onmessage : Xml.event_handler -> [> | `OnMessage] attrib val a_version : cdata -> [> | `Version] attrib val a_xmlns : [< | `W3_org_1999_xhtml] -> [> | `XMLns] attrib val a_manifest : Xml.uri -> [> | `Manifest] attrib val a_cite : Xml.uri -> [> | `Cite] attrib val a_xml_space : [< | `Preserve] -> [> | `XML_space] attrib val a_accesskey : character -> [> | `Accesskey] attrib (** This attribute assigns an access key to an element. An access key is a single character from the document character set. NB: authors should consider the input method of the expected reader when specifying an accesskey. *) val a_charset : charset -> [> | `Charset] attrib (** This attribute specifies the character encoding of the resource designated by the link. Please consult the section on character encodings for more details. *) val a_accept_charset : charsets -> [> | `Accept_charset] attrib val a_accept : contenttypes -> [> | `Accept] attrib val a_href : Xml.uri -> [> | `Href] attrib (** This attribute specifies the location of a Web resource, thus defining a link between the current element (the source anchor) and the destination anchor defined by this attribute. *) val a_hreflang : languagecode -> [> | `Hreflang] attrib (** This attribute specifies the base language of the resource designated by href and may only be used when href is specified. *) val a_rel : linktypes -> [> | `Rel] attrib (** This attribute describes the relationship from the current document to the anchor specified by the href attribute. The value of this attribute is a space-separated list of link types. *) (** This attribute is used to describe a reverse link from the anchor specified by the href attribute to the current document. The value of this attribute is a space-separated list of link types. *) val a_tabindex : number -> [> | `Tabindex] attrib (** This attribute specifies the position of the current element in the tabbing order for the current document. This value must be a number between 0 and 32767. User agents should ignore leading zeros. *) val a_mime_type : contenttype -> [> | `Mime_type] attrib (** This attribute gives an advisory hint as to the content type of the content available at the link target address. It allows user agents to opt to use a fallback mechanism rather than fetch the content if they are advised that they will get content in a content type they do not support.Authors who use this attribute take responsibility to manage the risk that it may become inconsistent with the content available at the link target address. *) val a_datetime : cdata -> [> | `Datetime] attrib val a_action : Xml.uri -> [> | `Action] attrib (** This attribute specifies a form processing agent. User agent behavior for a value other than an HTTP URI is undefined. *) val a_checked : [< | `Checked] -> [> | `Checked] attrib (** When the [type] attribute has the value ["radio"] or ["checkbox"], this boolean attribute specifies that the button is on. User agents must ignore this attribute for other control types. *) val a_cols : number -> [> | `Cols] attrib (** This attribute specifies the visible width in average character widths. Users should be able to enter longer lines than this, so user agents should provide some means to scroll through the contents of the control when the contents extend beyond the visible area. User agents may wrap visible text lines to keep long lines visible without the need for scrolling. *) val a_enctype : contenttype -> [> | `Enctype] attrib val a_for : idref -> [> | `For] attrib val a_for_list : idrefs -> [> | `For_List] attrib val a_maxlength : number -> [> | `Maxlength] attrib val a_method : [< | `Get | `Post | `Put | `Delete] -> [> | `Method] attrib val a_multiple : [< | `Multiple] -> [> | `Multiple] attrib val a_name : text -> [> | `Name] attrib (** This attribute assigns the control name. *) val a_rows : number -> [> | `Rows] attrib (** This attribute specifies the number of visible text lines. Users should be able to enter more lines than this, so user agents should provide some means to scroll through the contents of the control when the contents extend beyond the visible area. *) val a_selected : [< | `Selected] -> [> | `Selected] attrib (** When set, this boolean attribute specifies that this option is pre-selected. *) val a_size : number -> [> | `Size] attrib val a_src : Xml.uri -> [> | `Src] attrib val a_input_type : [< | `Url | `Tel | `Text | `Time | `Search | `Password | `Checkbox | `Range | `Radio | `Submit | `Reset | `Number | `Hidden | `Month | `Week | `File | `Email | `Image | `Datetime_local | `Datetime | `Date | `Color | `Button] -> [> | `Input_Type] attrib val a_text_value : text -> [> | `Text_Value] attrib (** This attribute specifies the initial value of the control. If this attribute is not set, the initial value is set to the contents of the [option] element. *) val a_int_value : number -> [> | `Int_Value] attrib (*VVV NO *) val a_value : cdata -> [> | `Value] attrib val a_float_value : float_number -> [> | `Float_Value] attrib val a_disabled : [< | `Disabled] -> [> | `Disabled] attrib val a_readonly : [< | `ReadOnly] -> [> | `ReadOnly] attrib val a_button_type : [< | `Button | `Submit | `Reset] -> [> | `Button_Type] attrib val a_command_type : [< | `Command | `Checkbox | `Radio] -> [> | `Command_Type] attrib val a_menu_type : [< | `Context | `Toolbar] -> [> | `Menu_Type] attrib val a_label : text -> [> | `Label] attrib val a_align : [< | `Left | `Right | `Justify | `Char] -> [> | `Align] attrib val a_axis : cdata -> [> | `Axis] attrib val a_colspan : number -> [> | `Colspan] attrib val a_headers : idrefs -> [> | `Headers] attrib val a_rowspan : number -> [> | `Rowspan] attrib val a_scope : [< | `Row | `Col | `Rowgroup | `Colgroup] -> [> | `Scope] attrib val a_summary : text -> [> | `Summary] attrib val a_border : pixels -> [> | `Border] attrib val a_cellpadding : length -> [> | `Cellpadding] attrib val a_cellspacing : length -> [> | `Cellspacing] attrib val a_datapagesize : cdata -> [> | `Datapagesize] attrib val a_rules : [< | `None | `Groups | `Rows | `Cols | `All] -> [> | `Rules] attrib val a_char : character -> [> | `Char] attrib val a_charoff : length -> [> | `Charoff] attrib val a_alt : text -> [> | `Alt] attrib val a_height : number -> [> | `Height] attrib val a_width : number -> [> | `Width] attrib type shape = [ | `Rect | `Circle | `Poly | `Default ] val a_shape : shape -> [> | `Shape] attrib val a_coords : numbers -> [> | `Coords] attrib val a_usemap : idref -> [> | `Usemap] attrib val a_data : Xml.uri -> [> | `Data] attrib val a_codetype : contenttype -> [> | `Codetype] attrib val a_fs_rows : multilengths -> [> | `FS_Rows] attrib val a_fs_cols : multilengths -> [> | `FS_Cols] attrib val a_frameborder : [< | `Zero | `One] -> [> | `Frameborder] attrib val a_marginheight : pixels -> [> | `Marginheight] attrib val a_marginwidth : pixels -> [> | `Marginwidth] attrib val a_scrolling : [< | `Yes | `No | `Auto] -> [> | `Scrolling] attrib val a_target : frametarget -> [> | `Target] attrib val a_content : text -> [> | `Content] attrib val a_http_equiv : text -> [> | `Http_equiv] attrib val a_defer : [< | `Defer] -> [> | `Defer] attrib val a_media : mediadesc -> [> | `Media] attrib val a_style : string -> [> | `Style_Attr] attrib val a_property : string -> [> | `Property] attrib (** {1 Phantom types and XML elements} *) (* For Ocsigen I need to specify the variance --Vincent *) type +'a elt type ('a, 'b) nullary = ?a: (('a attrib) list) -> unit -> 'b elt type ('a, 'b, 'c) unary = ?a: (('a attrib) list) -> 'b elt -> 'c elt type ('a, 'b, 'c, 'd) binary = ?a: (('a attrib) list) -> 'b elt -> 'c elt -> 'd elt type ('b, 'c, 'd, 'e) tri = 'b elt -> 'c elt -> 'd elt -> 'e elt type ('a, 'b, 'c) star = ?a: (('a attrib) list) -> ('b elt) list -> 'c elt (** Star '*' denotes any number of children, uncluding zero. *) type ('a, 'b, 'c) plus = ?a: (('a attrib) list) -> 'b elt -> ('b elt) list -> 'c elt (** Root element *) type html = [ | `Html ] elt type rt = [ | `Rt of [ | `Rt ] elt | `Rpt of (([ | `Rp ] elt) * ([ | `Rt ] elt) * ([ | `Rp ] elt)) ] type ruby_content = (((phrasing elt) list) * rt) type rp = (((common attrib) list) * ((phrasing elt) list)) (** {1 Combined Element Sets:} *) (********************************) (* If the document is an *) (* iframe srcdoc document or if*) (*title information is available*) (*from a higher-level protocol: *) (* Zero or more elements of *) (* metadata content. *) (*Otherwise: *) (* One or more elements of *) (* metadata content, of which *) (*exactly one is a title element*) (********************************) val html : ?a: ((html_attrib attrib) list) -> [< | `Head] elt -> [< | `Body] elt -> [> | `Html] elt val head : ?a: ((head_attrib attrib) list) -> [< | `Title] elt -> (head_content_fun elt) list -> [> | head] elt val base : ([< | base_attrib], [> | base]) nullary val title : (title_attrib, [< | title_content_fun], [> | title]) unary val body : ([< | body_attrib], [< | body_content_fun], [> | body]) star val svg : ?xmlns : string -> ?a : [< svg_attrib ] Svg.attrib list -> [< svg_content ] Svg.elt list -> [> svg ] elt (** {2 Section} *) val footer : ([< | common], [< | flow5_without_header_footer], [> | `Footer]) star val header : ([< | common], [< | flow5_without_header_footer], [> | `Header]) star val section : ([< | section_attrib], [< | section_content_fun], [> | section]) star val nav : ([< | nav_attrib], [< | nav_content_fun], [> | nav]) star val h1 : ([< | h1_attrib], [< | h1_content_fun], [> | h1]) star val h2 : ([< | h2_attrib], [< | h2_content_fun], [> | h2]) star val h3 : ([< | h3_attrib], [< | h3_content_fun], [> | h3]) star val h4 : ([< | h4_attrib], [< | h4_content_fun], [> | h4]) star val h5 : ([< | h5_attrib], [< | h5_content_fun], [> | h5]) star val h6 : ([< | h6_attrib], [< | h6_content_fun], [> | h6]) star val hgroup : ([< | hgroup_attrib], [< | hgroup_content_fun], [> | hgroup]) plus val address : ([< | address_attrib], [< | address_content_fun], [> | address]) star val article : ([< | article_attrib], [< | article_content_fun], [> | article]) star val aside : ([< | aside_attrib], [< | aside_content_fun], [> | aside]) star (** {2 Grouping content} *) val p : ([< | p_attrib], [< | p_content_fun], [> | p]) star val pre : ([< | pre_attrib], [< | pre_content_fun], [> | pre]) star val blockquote : ([< | blockquote_attrib], [< | blockquote_content_fun], [> | blockquote ]) star val div : ([< | div_attrib], [< | div_content_fun], [> | div]) star (********************************) (* In Dl *) (********************************) (* Zero or more groups each *) (* consisting of *) (* one or more dt element *) (* followed by *) (* one or more dd elements*) (********************************) val dl : ?a: (([< | common] attrib) list) -> ((([< | `Dt] elt) * (([< | `Dt] elt) list)) * (([< | `Dd] elt) * (([< | `Dd] elt) list))) list -> [> | `Dl] elt val ol : ([< | ol_attrib], [< | ol_content_fun], [> | ol]) star val ul : ([< | ul_attrib], [< | ul_content_fun], [> | ul]) star val dd : ([< | dd_attrib], [< | dd_content_fun], [> | dd]) star val dt : ([< | dt_attrib], [< | dt_content_fun], [> | dt]) star (********************************) (* In Li *) (********************************) (* Only if the element is a *) (* child of an ol element: *) (* value attribute *) (********************************) (** A list element. The 'a type is used to know whether the element has a int_value attribute or not. *) val li : ([< | li_attrib], [< | li_content_fun], [> | li]) star val figcaption : ([< | figcaption_attrib], [< | figcaption_content_fun], [> | figcaption]) star (********************************) (* In Figure *) (********************************) (*Either: One figcaption element*) (* followed by flow content.*) (*Or: Flow content followed by *) (* one figcaption element. *) (*Or: Flow content. *) (********************************) val figure : ?figcaption: ([< | `Figcaption] elt) -> ([< | common], [< | flow5], [> | `Figure]) star val hr : ([< | hr_attrib], [> | hr]) nullary (** {2 Ruby} *) (**********************************) (* In Ruby *) (**********************************) (* One or more groups of: *) (*phrasing content followed either*) (* by a single rt element, *) (* or an rp element *) (* an rt element, and *) (* another rp element. *) (**********************************) val rt : ?rp: (rp * rp) -> ?a: (([< | common] attrib) list) -> ([< | phrasing] elt) list -> rt val rp : ?a: (([< | common] attrib) list) -> ([< | phrasing] elt) list -> rp val ruby : ?a: (([< | common] attrib) list) -> ruby_content -> ruby_content list -> [> | `Ruby] elt (** {2 Semantic} *) val b : ([< | b_attrib], [< | b_content_fun], [> | b]) star val i : ([< | i_attrib], [< | i_content_fun], [> | i]) star val u : ([< | u_attrib], [< | u_content_fun], [> | u]) star val small : ([< | small_attrib], [< | small_content_fun], [> | small]) star val sub : ([< | sub_attrib], [< | sub_content_fun], [> | sub]) star val sup : ([< | sup_attrib], [< | sup_content_fun], [> | sup]) star val mark : ([< | mark_attrib], [< | mark_content_fun], [> | mark]) star val wbr : ([< | wbr_attrib], [> | wbr]) nullary val bdo : dir: [< | `Ltr | `Rtl] -> ([< | common], [< | phrasing], [> | `Bdo]) star val abbr : ([< | abbr_attrib], [< | abbr_content_fun], [> | abbr]) star val br : ([< | br_attrib], [> | br]) nullary val cite : ([< | cite_attrib], [< | cite_content_fun], [> | cite]) star val code : ([< | code_attrib], [< | code_content_fun], [> | code]) star val dfn : ([< | dfn_attrib], [< | dfn_content_fun], [> | dfn]) star val em : ([< | em_attrib], [< | em_content_fun], [> | em]) star val kbd : ([< | kbd_attrib], [< | kbd_content_fun], [> | kbd]) star val q : ([< | q_attrib], [< | q_content_fun], [> | q]) star val samp : ([< | samp_attrib], [< | samp_content_fun], [> | samp]) star val span : ([< | span_attrib], [< | span_content_fun], [> | span]) star val strong : ([< | strong_attrib], [< | strong_content_fun], [> | strong]) star val time : ([< | time_attrib], [< | time_content_fun], [> | time]) star val var : ([< | var_attrib], [< | var_content_fun], [> | var]) star (** {2 Hypertext} *) (********************************) (* In A *) (********************************) (* The target, rel, media, *) (* hreflang, and type attributes*) (* must be omitted if the href *) (* attribute is not present. *) (********************************) (*Only phasing instead of flow ?*) (********************************) (* a's children are transparents*) (********************************) val a : ([< | a_attrib], 'a, [> | `A of 'a]) star (** {2 Edit} *) (**********************************) (* del's children are transparents*) (**********************************) val del : ([< | del_attrib], 'a, [> | `Del of 'a]) star (**********************************) (* ins's children are transparents*) (**********************************) val ins : ([< | ins_attrib], 'a, [> | `Ins of 'a]) star (** {2 Embedded} *) val img : src: Xml.uri -> alt: text -> ([< | common | `Height | `Ismap | `Width], [> `Img ]) nullary val iframe : (*| `Srcdoc*) ([< | common | `Src | `Name | `Sandbox | `Seamless | `Width | `Height], [< | `PCDATA], [> | `Iframe]) star val object_ : ?params: (([< | `Param] elt) list) -> ([< | common | `Data | `Form | `Mime_type | `Height | `Width | `Name | `Usemap ], 'a, [> | `Object of 'a ]) star val param : ([< | param_attrib], [> | param]) nullary (**********************************) (* In Embed *) (**********************************) (* Any namespace-less attribute *) (* other than name, align, hspace,*) (* and vspace may be specified on*) (* the embed element, so long as *) (* its name is XML-compatible and *) (* contains no characters in the *) (* range U+0041 to U+005A *) (*(LATIN CAPITAL LETTER A to LATIN*) (*CAPITAL LETTER Z). *) (*These attributes are then passed*) (* as parameters to the plugin. *) (**********************************) val embed : ([< | common | `Src | `Height | `Mime_type | `Width], [> | `Embed]) nullary (**************************************) (* In Audio and Video *) (**************************************) (* If the element has a src attribute:*) (* transparent, but with no media *) (* element descendants. *) (* If the element does not have a src *) (* attribute: *) (* one or more source elements, then*) (* transparent, but with no media *) (* element descendants. *) (**************************************) val audio : ?srcs: (Xml.uri * (([< | `Source] elt) list)) -> ([< | common | `Preload | `Autoplay | `Loop | `Controls], 'a, [> | `Audio of 'a ]) star val video : ?srcs: (Xml.uri * (([< | `Source] elt) list)) -> ([< | common | `Poster | `Preload | `Autoplay | `Loop | `Controls | `Width | `Height ], 'a, [> | `Video of 'a]) star val canvas : ([< | canvas_attrib], 'a, [> | `Canvas of 'a]) star val source : ([< | source_attrib], [> | source]) nullary (********************************) (* In Area *) (********************************) (* The alt, target, rel, media, *) (* hreflang, and type attributes*) (* must be omitted if the href *) (* attribute is not present. *) (********************************) val area : alt: text -> ([< | common | `Alt | `Coords | `Shape | `Target | `Rel | `Media | `Hreflang | `Mime_type ], [> | `Area]) nullary (* XXX: SC : the current system doesn't allow to put <area> tag inside a map (a priori) *) val map : ([< | map_attrib], 'a, [> | `A of 'a]) plus (** {2 Tables Data} *) val caption : ([< | caption_attrib], [< | caption_content_fun], [> | caption]) star (********************************) (* In Table and Tablex *) (********************************) (* In this order: *) (* optionally a caption element,*) (* followed by either *) (*zero or more colgroup elements*) (* followed optionally by a *) (*thead element, *) (* followed optionally by a *) (*tfoot element, *) (* followed by either *) (*zero or more tbody elements *) (*or one or more tr elements, *) (* followed optionally by *) (*a tfoot element *) (********************************) (* BUT ONLY ONE FOOT ELEMENT *) (* CHILD IN TOTAL *) (********************************) val table : ?caption: ([< | `Caption] elt) -> ?columns: (([< | `Colgroup] elt) list) -> ?thead: ([< | `Thead] elt) -> ?tfoot: ([< | `Tfoot] elt) -> ([< | common | `Summary], [< | `Tr], [> | `Table]) plus val tablex : ?caption: ([< | `Caption] elt) -> ?columns: (([< | `Colgroup] elt) list) -> ?thead: ([< | `Thead] elt) -> ?tfoot: ([< | `Tfoot] elt) -> ([< | common | `Summary], [< | `Tbody], [> | `Table]) star (********************************) (* In Colgroup *) (********************************) (* If span attribute is: *) (* -present: Empty. *) (* -absent: Zero or more *) (* col elements. *) (********************************) val colgroup : ([< | colgroup_attrib], [< | colgroup_content_fun], [> | colgroup]) star val col : ([< | col_attrib], [> | col]) nullary val thead : ([< | thead_attrib], [< | thead_content_fun], [> | thead]) star val tbody : ([< | tbody_attrib], [< | tbody_content_fun], [> | tbody]) star val tfoot : ([< | tfoot_attrib], [< | tfoot_content_fun], [> | tfoot]) star val td : ([< | td_attrib], [< | td_content_fun], [> | td]) star val th : ([< | th_attrib], [< | th_content_fun], [> | th]) star (****************************************) (* In Tr *) (****************************************) (*If the parent node is a thead element:*) (* Zero or more th elements *) (* Otherwise: *) (* Zero or more td or th elements *) (****************************************) val tr : ([< | tr_attrib], [< | tr_content_fun], [> | tr]) star (** {2 Forms} *) val form : ([< | form_attrib], [< | form_content_fun], [> | form]) plus val fieldset : ?legend: ([ | `Legend ] elt) -> ([< | common | `Disabled | `Form | `Name], [< | flow5], [> | `Fieldset]) star val legend : ([< | legend_attrib], [< | legend_content_fun], [> | legend]) star (** Label authorizes only one control inside them that should be labelled with a [for] attribute (although it is not necessary). Such constraints are not currently enforced by the type-system *) val label : ([< | label_attrib], [< | label_content_fun], [> | label]) star (** If the [type] attribute is not "hidden", must be considered as interactive. Distinction not made for now. *) val input : ([< | input_attrib], [> | input]) nullary (********************************) (* In Button *) (********************************) (* The formaction, formenctype, *) (* formmethod, formnovalidate, *) (* and formtarget must not be *) (* specified if the element's *) (* type attribute is not in the*) (* Submit Button state. *) (********************************) val button : ([< | button_attrib], [< | button_content_fun], [> | button]) star val select : ([< | select_attrib], [< | select_content_fun], [> | select]) star val datalist : ?children: [< | `Options of ([< | `Option] elt) list | `Phras of ([< | phrasing] elt) list ] -> ([< | common], [> | `Datalist]) nullary val optgroup : label: text -> ([< | common | `Disabled | `Label], [< | `Option], [> | `Optgroup]) star val option : ([< | option_attrib], [< | option_content_fun], [> | selectoption]) unary val textarea : ([< | textarea_attrib], [< | textarea_content_fun], [> | textarea]) unary val keygen : ([< | keygen_attrib], [> | keygen]) nullary val progress : ([< | progress_attrib], [< | progress_content_fun], [> | progress]) star val meter : ([< | meter_attrib], [< | meter_content_fun], [> | meter]) star val output_elt : ([< | output_elt_attrib], [< | output_elt_content_fun], [> | output_elt]) star (** {2 Data} *) val pcdata : string -> [> | `PCDATA] elt val entity : string -> [> | `PCDATA] elt val space : unit -> [> | `PCDATA] elt val cdata : string -> [> | `PCDATA] elt (* GK *) val cdata_script : string -> [> | `PCDATA] elt (* GK *) val cdata_style : string -> [> | `PCDATA] elt (* GK *) (**/**) val unsafe_data : string -> 'a elt (**/**) (** {2 Interactive} *) val details : [< | `Summary] elt -> ([< | common | `Open], [< | flow5] elt, [> | `Details]) star val summary : ([< | summary_attrib], [< | summary_content_fun], [> | summary]) star val command : label: text -> ([< | common | `Icon | `Disabled | `Checked | `Radiogroup | `Command_Type ], [> | `Command]) nullary val menu : ?child: [< | `Lis of ([< | `Li of [< | common]] elt) list | `Flows of ([< | flow5] elt) list ] -> ([< | common | `Label | `Menu_Type], [> | `Menu]) nullary (** {2 Scripting} *) val script : ([< | script_attrib], [< | script_content_fun], [> | script]) unary (****************************************************) (* In Noscript *) (****************************************************) (*When scripting is DISABLED, IN a HEAD element: *) (* in any order, zero or more link elements, *) (* zero or more style elements, and zero or more *) (* meta elements. *) (*When scripting is DISABLED, NOT IN a HEAD element:*) (* transparent, but there must be no noscript *) (* element descendants. *) (*When scripting is ENABLED, IN a HEAD element: *) (* only text, except that invoking the HTML *) (* fragment parsing algorithm with the noscript *) (* element as the context element and the text *) (* contents as the input must result in a list of *) (* nodes that consists only of link, style, and *) (* meta elements that would be conforming if they *) (* were children of the noscript element, and no *) (* parse errors. *) (*When scripting is ENABLED, NOT IN a HEAD element: *) (* only text, except that the text must be such *) (* that running the following algorithm results in*) (* a conforming document with no noscript elements*) (* and no script elements, and such that no step *) (* in the algorithm causes an HTML parser to flag *) (* a parse error *) (****************************************************) (* PLUS ?? *) val noscript : ([< | noscript_attrib], [< | noscript_content_fun], [> | noscript]) plus val meta : ([< | meta_attrib], [> | meta]) nullary (** {2 Style Sheets} *) (*********************************) (* In Style *) (*********************************) (* the content model depends on *) (*the value of the type attribute*) (*********************************) (* BUT WHAT ??? *) (* SC: contenttype defaults to *) (* text/css *) (*********************************) val style : ([< | style_attrib], [< | style_content_fun], [> | style]) star (** {2 Link} *) val link : rel: linktypes -> href: Xml.uri -> ([< | common | `Hreflang | `Media | `Rel | `Href | `Sizes | `Mime_type ], [> | `Link]) nullary (** {1 Tools} *) val tot : Xml.elt -> 'a elt val totl : Xml.elt list -> ('a elt) list val toelt : 'a elt -> Xml.elt val toeltl : ('a elt) list -> Xml.elt list (** *) type doc = [ `Html ] elt val doc_toelt : doc -> Xml.elt end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tyxml-2.2.0/lib/svg_types.mli�����������������������������������������������������������������������0000644�0000000�0000000�00000103556�12060404012�014351� 0����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2010 by Simon Castellan * Copyright (C) 2010 by Cecile Herbelin * Copyright (C) 2010 by Vincent Balat * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** SVG types with variants. (See also {!Svg.M}) *) (** This module defines basic data types for data, attributes and element occuring in SVG documents. It is based on the specification available at http://www.w3.org/TR/SVG/. This module is experimental, it may lack of some attributes, and the interface is very low level and do not take deeply into account the needs of SVG elements. *) (** See {!Xhtml.M} for a description of the transcription's principles. *) (* Some attribtes and elements are tagged with XXX: they may be improved and do not match completely the SVG spec *) (** {1 Categories of elements and attributes} *) (** This part defines the categories of elements and attributes *) (** {2 Elements} *) type animation_element = [ | `AnimateColor | `AnimateMotion | `AnimateTransform | `Animate | `Set ] type descriptive_element = [ | `Desc | `Metdata | `Title ] type basic_shape_element = [ | `Circle | `Ellipse | `Line | `Polygon | `Polyline | `Rect ] type clipping_path_element = [ | `Path | `Text | basic_shape_element ] type container_element = [ | `A | `Defs | `Glyph | `G | `Marker | `Mask | `Missing_glyph | `Pattern | `Svg | `Switch | `Symbol ] type filter_primitive_element = [ | `FeBlend | `FeColorMatrix | `FeComponentTransfer | `FeComposite | `FeConvolveMatrix | `FeDiffuseLighting | `FeDisplacementMap | `FeFlood | `FeGaussianBlur | `FeImage | `FeMerge | `FeMorphology | `FeOffset | `FeSpecularLighting | `FeTile | `FeTurbulence ] type light_source_element = [ | `FeDiffuseLighting | `FeSpecularLighting | `FeDistantLight | `FePointLight | `FeSpotLight ] type shape_element = [ | `Circle | `Ellipse | `Line | `Polyline | `Polygon | `Rect] type structural_element = [ | `Defs | `G | `Svg | `Symbol | `Use ] type text_content_element = [ | `AltGlyph | `TextPath | `Text | `Tref | `Tspan ] type text_content_child_element = [ | `AltGlyph | `TextPath | `Tref | `Tspan ] type gradient_element = [ | `LinearGradient | `RadialGradient ] type graphics_element = [ | `Circle | `Ellipse | `Image | `Line | `Path | `Polygon | `Polyline | `Rect | `Text | `Use ] type graphics_ref_element = [ | `Image | `Use ] (** {2 Attributes } *) type anim_event_attr = [ | `OnBegin | `OnEnd | `OnLoad ] type conditional_processing_attr = [ | `RequiredExtensions | `RequiredFeatures | `SystemLanguage ] type core_attr = [ | `Id | `Xml_base | `Xml_lang | `Xml_space ] type transfer_attr = [ | `Type_transfert | `TableValues | `Slope | `Intercept | `Amplitude | `Exponent | `Offset__transfer ] type document_event_attr = [ | `OnAbort | `OnError | `OnResize | `OnScroll | `OnUnload | `OnZoom ] type filter_primitive_attr = [ | `Height | `Result | `Width | `X | `Y ] type animation_event_attr = [ | `OnBegin | `OnEnd | `OnRepeat | `OnLoad ] type animation_attr_target_attr = [ | `AttributeType | `AttributeName ] type animation_timing_attr = [ | `Begin | `Dur | `End | `Min | `Max | `Restart | `RepeatCount | `RepeatDur | `Fill ] type animation_value_attr = [ | `CalcMode | `Values | `KeyTimes | `KeySplines | `From | `To | `By ] type animation_addition_attr = [ | `Animation | `Accumulate ] type presentation_attr = [ | `Alignement_Baseline | `Baseline_Shift | `Clip | `Clip_Path | `Clip_Rule | `Color | `Color_Interpolation | `Color_interpolation_filters | `Color_profile | `Color_rendering | `Cursor | `Direction | `Display | `Document_baseline | `Enable_background | `Fill | `Fill_opacity | `Fill_rule | `Filter | `Flood_Color | `Flood_Opacity | `Font_Family | `Font_Size | `Font_Size_Adjust | `Font_Stretch | `Font_Style | `Font_Variant | `Font_Weight | `Glyph_Orientation_Horizontal | `Glyph_Orientation_Vertical | `Image_Rendering | `Kerning | `Letter_Spacing | `Lighting_Color | `Marker_End | `Marker_Mid | `Marker_Start | `Mask | `Opacity | `Overflow | `Pointer_Events | `Shape_Rendering | `Stop_Color | `Stop_Opacity | `Stroke | `Stroke_Dasharray | `Stroke_Dashoffset | `Stroke_Linecap | `Stroke_Linejoin | `Stroke_Miterlimit | `Stroke_Opacity | `Stroke_Width | `Text_Anchor | `Text_Decoration | `Text_Rendering | `Unicode_Bidi | `Visibility | `Word_Spacing | `Writing_Mode ] type graphical_event_attr = [ | `OnActivate | `OnClick | `OnFocusIn | `OnFocusOut | `OnLoad | `OnMouseDown | `OnMouseOut | `OnMouseOver | `OnMouseUp ] type xlink_attr = [ | `Xlink_href | `Xlink_type | `Xlink_role | `Xlink_arcrole | `Xlink_title | `Xlink_show | `Xlink_actuate ] (** {2 Generic data types} *) type iri = string (** An IRI reference is an Internationalized Resource Identifier with an optional fragment identifier, as defined in Internationalized Resource Identifiers [RFC3987]. An IRI reference serves as a reference to a resource or (with a fragment identifier) to a secondary resource. See References and the ‘defs’ element.. *) (** {2 Units} *) (** SVG defines several units to measure time, length, angles. *) module Unit : sig type 'a quantity = (float * 'a option) type angle = [ `Deg | `Grad | `Rad ] quantity type length = [ `Em | `Ex | `Px | `In | `Cm | `Mm | `Pt | `Pc | `Percent ] quantity type time = [ `S | `Ms ] quantity type frequency = [ `Hz | `KHz ] quantity end open Unit type coord = length type number = float type number_optional_number = (number * (number option)) type percentage = int type strings = string list (* Transformation *) type transform = | Matrix of (float * float * float * float * float * float) | Translate of (float * (float option)) | Scale of (float * (float option)) | Rotate of (angle * ((float * float) option)) | SkewX of angle | SkewY of angle type spacestrings = string list type commastrings = string list type transforms = transform list type fourfloats = (float * float * float * float) type lengths = length list type numbers = float list type numbers_semicolon = float list type coords = (float * float) list type rotate = float list type pcdata = [ `PCDATA ] (** {1 Element} *) (*-ELEMENTS-*) type svg = [ | `Svg ] (* star *) type svg_content = [ | animation_element | descriptive_element | shape_element | structural_element | gradient_element | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font_Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type svg_attr = [ | conditional_processing_attr | core_attr | document_event_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `X | `Y | `Width | `Height | `ViewBox | `PreserveAspectRatio | `ZoomAndPlan | `Version | `BaseProfile | `ContentScriptType | `ContentStyleType | `X | `Y ] type g = [ | `G ] (* star *) type g_content = [ | animation_element | descriptive_element | shape_element | structural_element | gradient_element | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font_Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type g_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform ] type defs = [ | `Defs ] (* star *) type defs_content = [ | animation_element | descriptive_element | shape_element | structural_element | gradient_element | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font_Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type defs_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform ] type desc = [ | `Desc ] (* unary *) type desc_content = [ | `PCDATA ] type desc_attr = [ | core_attr | `Class | `Style ] type title = [ | `Title ] (* unary *) type title_content = [ | `PCDATA ] type title_attr = desc_attr type symbol = [ | `Symbol ] (* star *) type symbol_content = [ | animation_element | descriptive_element | structural_element | gradient_element | `LinearGradient | `RadialGradient | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font_Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type symbol_attr = [ | `Class | `Style | `ExternalResourcesRequired | `PreserveAspectRatio | `ViewBox ] type use = [ | `Use ] (* star *) type use_content = [ | animation_element | descriptive_element ] type use_attr = [ | core_attr | conditional_processing_attr | graphical_event_attr | presentation_attr | xlink_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `X | `Y | `Width | `Height | `Xlink_href ] type image = [ | `Image ] (* star *) type image_content = [ | animation_element | descriptive_element ] type image_attr = [ | core_attr | conditional_processing_attr | graphical_event_attr | xlink_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `PreserveAspectRatio | `Transform | `X | `Y | `Width | `Height | `Xlink_href ] type switch = [ | `Switch ] (* star *) type switch_content = [ | animation_element | descriptive_element | shape_element | `A | `ForeignObject | `G | `Image | `Svg | `Switch | `Text | `Use ] type switch_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform ] type style = [ | `Style ] (* unary *) type style_content = [ | `PCDATA ] type style_attr = [ | core_attr | `Title | `Media | `Type ] type path = [ | `Path ] (* star *) type path_content = [ | animation_element | descriptive_element ] type path_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `D | `PathLength ] type rect = [ | `Rect ] (* star *) type rect_content = [ | animation_element | descriptive_element ] type rect_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `X | `Y | `Width | `Height | `Rx | `Ry ] type circle = [ | `Circle ] (* star *) type circle_content = [ | animation_element | descriptive_element ] type circle_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `R | `Cx | `Cy ] type ellipse = [ | `Ellipse ] (* star *) type ellipse_content = [ | animation_element | descriptive_element ] type ellipse_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `Rx | `Ry | `Cx | `Cy ] type line = [ | `Line ] (* star *) type line_content = [ | animation_element | descriptive_element ] type line_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `X1 | `Y1 | `X2 | `Y2 ] type polyline = [ | `Polyline ] (* star *) type polyline_content = [ | animation_element | descriptive_element ] type polyline_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `Points ] type polygon = [ | `Polygon ] (* star *) type polygon_content = [ | animation_element | descriptive_element ] type polygon_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `Points ] type text = [ | `Text ] (* star *) type text_content = [ | animation_element | descriptive_element | text_content_child_element | `A ] type text_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Transform | `LengthAdjust | `X_list | `Y_list | `Dx | `Dy | `Rotate | `TextLength ] type tspan = [ | `Tspan ] (* star *) type tspan_content = [ | descriptive_element | core_attr | `A | `AltGlyph | `Animate | `AnimateColor | `Set | `Tref | `Tspan ] type tspan_attr = [ | core_attr | conditional_processing_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `X__list | `Y__list | `Dx | `Dy | `Rotate | `TextLength | `LengthAdjust ] type tspan_attribute = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `X_list | `Y_list | `Dx | `Dy | `Rotate | `TextLength | `LengthAdjust ] type tref = [ | `Tref ] (* star *) type tref_content = [ | descriptive_element | `Animate | `AnimateColor | `Set ] type tref_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | xlink_attr | `Class | `Style | `ExternalResourcesRequired | `Xlink_href ] type textpath = [ | `TextPath ] (* star *) type textpath_content = [ | descriptive_element | `A | `AltGlyph | `Animate | `AnimateColor | `Set | `Tref | `Tspan ] type textpath_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | xlink_attr | `Class | `Style | `ExternalResourcesRequired | `Xlink_href | `StartOffset | `Method | `Spacing ] type altglyph = [ | `AltGlyph ] (* unary *) type altglyph_content = [ | `PCDATA ] type altglyph_attr = [ | conditional_processing_attr | core_attr | graphical_event_attr | presentation_attr | xlink_attr | `Class | `Style | `ExternalResourcesRequired | `X_list | `Y_list | `Dx | `Dy | `GlyphRef | `Format | `Rotate | `Xlink_href ] type altglyphdef = [ | `AltGlyphDef ] (* unary *) type altglyphdef_attr = [ | core_attr ] type altglyphitem = [ | `AltGlyphItem ] (* plus *) type altglyphitem_content = [ | `glyphRef ] type altglyphitem_attr = [ | core_attr ] type glyphref = [ | `GlyphRef ] (* nullary *) type glyphref_attr = [ | core_attr | presentation_attr | xlink_attr | `Class | `Style | `X | `Y | `Dx_single | `Dy_single | `GlyphRef | `Format | `Xlink_href ] type marker = [ | `Marker ] (* star *) type marker_content = [ | animation_element | descriptive_element | shape_element | structural_element | gradient_element | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font_Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type marker_attr = [ | core_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `ViewBox | `PreserveAspectRatio | `RefX | `RefY | `MarkerUnits | `MarkerWidth | `MarkerHeight | `Orient ] type colorprofile = [ | `ColorProfile ] (* star *) type colorprofile_content = [ | descriptive_element ] type colorprofile_attr = [ | core_attr | xlink_attr | `Local | `Name | `Rendering_Intent | `Xlink_href ] type lineargradient = [ | `Linear_Gradient ] (* star *) type lineargradient_content = [ | descriptive_element | `Animate | `AnimateTransform | `Set | `Stop ] type lineargradient_attr = [ | core_attr | presentation_attr | xlink_attr | `Class | `Style | `ExternalResourcesRequired | `X1 | `Y1 | `X2 | `Y2 | `GradientUnits | `GradientTransform | `SpreadMethod | `Xlink_href ] type radialgradient = [ | `Radial_Gradient ] (* star *) type radialgradient_content = [ | descriptive_element | `Animate | `AnimateTransform | `Set | `Stop ] type radialgradient_attr = [ | core_attr | presentation_attr | xlink_attr | `Class | `Style | `ExternalResourcesRequired | `Cx | `Cy | `R | `Fx | `Fy | `GradientUnits | `GradientTransform | `SpreadMethod | `Xlink_href ] type gradientstop = [ | `Gradient_Stop ] (* star *) type gradientstop_content = [ | `Animate | `Animate_Color | `Set ] type gradientstop_attr = [ | core_attr | presentation_attr | `Class | `Style | `Offset ] type pattern = [ | `Pattern ] (* star *) type pattern_content = [ | animation_element | descriptive_element | shape_element | structural_element | gradient_element | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font_Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type pattern_attr = [ | conditional_processing_attr | core_attr | presentation_attr | xlink_attr | `Class | `Style | `ExternalResourcesRequired | `ViewBox | `PreserveAspectRatio | `X | `Y | `Width | `Height | `PatternUnits | `PatternContentUnits | `PatternTransform | `Xlink_href ] type clippath = [ | `ClipPath ] (* star *) type clippath_attr = [ | conditional_processing_attr | core_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `ClipPathUnits ] type clippath_content = [ | descriptive_element | animation_element | shape_element | `Text | `Use ] type mask = [ | `Mask ] type mask_content = [ | animation_element | descriptive_element | shape_element | structural_element | gradient_element | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font_Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type mask_attr = [ | conditional_processing_attr | core_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `X | `Y | `Width | `Height | `MaskUnits | `MaskContentUnits ] type filter = [ | `Filter ] (* star *) type filter_content = [ | descriptive_element | filter_primitive_element | `Animate | `Set ] type filter_attr = [ | core_attr | presentation_attr | xlink_attr | `Class | `Style | `ExternalResourcesRequired | `X | `Y | `Width | `Height | `FilterRes | `FilterUnits | `PrimitiveUnits | `Xlink_href ] type fedistantlight = [ | `FeDistantLight ] (* star *) type fedistantlight_content = [ | `Animate | `Set ] type fedistantlight_attr = [ | core_attr | `Azimuth | `Elevation ] type fepointlight = [ | `FePointLight ] (* star *) type fepointlight_content = [ | `Animate | `Set ] type fepointlight_attr = [ | core_attr | `X | `Y | `Z ] type fespotlight = [ | `FeSpotLight ] (* star *) type fespotlight_content = [ | `Animate | `Set ] type fespotlight_attr = [ | core_attr | `X | `Y | `Z | `PointsAtX | `PointsAtY | `PointsAtZ | `SpecularExponent | `LimitingConeAngle ] type feblend = [ | `FeBlend ] (* star *) type feblend_content = [ | `Animate | `Set ] type feblend_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `In | `In2 | `Mode ] type fecolormatrix = [ | `FeColorMatrix ] (* star *) type fecolormatrix_content = [ | `Animate | `Set ] type fecolormatrix_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `Type__fecolor | `Values | `In ] type fecomponenttransfer = [ | `FeComponentTransfer ] (* star *) type fecomponenttransfer_content = [ | `FeFuncA | `FeFuncB | `FeFuncG | `FeFuncR ] type fecomponenttransfer_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `In ] type fefunca = [ | `FeFuncA ] (* star *) type fefunca_content = [ | `Animate | `Set ] type fefunca_attr = [ | core_attr | transfer_attr ] type fefuncg = [ | `FeFuncA ] (* star *) type fefuncg_content = [ | `Animate | `Set ] type fefuncg_attr = [ | core_attr | transfer_attr ] type fefuncb = [ | `FeFuncA ] (* star *) type fefuncb_content = [ | `Animate | `Set ] type fefuncb_attr = [ | core_attr | transfer_attr ] type fefuncr = [ | `FeFuncA ] (* star *) type fefuncr_content = [ | `Animate | `Set ] type fefuncr_attr = [ | core_attr | transfer_attr ] type fecomposite = [ | `FeComposite ] (* star *) type fecomposite_content = [ | `Animate | `Set ] type fecomposite_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `In | `In2 | `Operator | `K1 | `K2 | `K3 | `K4 ] type feconvolvematrix = [ | `FeConvolveMatrix ] (* star *) type feconvolvematrix_content = [ | `Animate | `Set ] type feconvolvematrix_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `In | `Order | `KernelMatrix | `Divisor | `Bias | `TargetX | `TargetY | `EdgeMode | `KernelUnitLength | `PreserveAlpha ] type fediffuselighting = [ | `FeDiffuseLighting ] (* star *) type fediffuselighting_content = [ | descriptive_element | light_source_element ] (* XXX *) type fediffuselighting_attr = [ | core_attr | filter_primitive_attr | presentation_attr | `Class | `Style | `In | `SurfaceScale | `DiffuseConstant | `KernelUnitLength ] type fedisplacementmap = [ | `FeDisplacementMap ] (* star *) type fedisplacementmap_content = [ | `Animate | `Set ] type fedisplacementmap_attr = [ | core_attr | filter_primitive_attr | presentation_attr | `Class | `Style | `In | `In2 | `Scale | `XChannelSelector | `YChannelSelector ] type feflood = [ | `FeFlood ] (* star *) type feflood_content = [ | `Animate | `AnimateColor | `Set ] type feflood_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style ] type fegaussianblur = [ | `FeGaussianBlur ] (* star *) type fegaussianblur_content = [ | `Animate | `AnimateColor | `Set ] type fegaussianblur_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `In | `StdDeviation ] type feimage = [ | `FeImage ] (* star *) type feimage_content = [ | `Animate | `AnimateColor | `Set ] type feimage_attr = [ | core_attr | presentation_attr | filter_primitive_attr | xlink_attr | `Xlink_href | `Class | `Style | `ExternalResourcesRequired | `PreserveAspectRadio ] type femerge = [ | `FeMerge ] (* star *) type femerge_content = [ | `FeMergeNode ] type femerge_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style ] type femorphology = [ | `FeMorphology ] (* star *) type femorphology_content = [ | `Animate | `Set ] type femorphology_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Operator_morphology | `Class | `Style | `In | `Radius ] type feoffset = [ | `FeOffset ] (* star *) type feoffset_content = [ | `Animate | `Set ] type feoffset_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `Dx_number | `Dy_number | `In ] type fespecularlighting = [ | `FeSpecularLighting ] (* star *) type fespecularlighting_content = [ | descriptive_element | light_source_element ] (* XXX *) type fespecularlighting_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `In | `SurfaceScale | `SpecularConstant | `SpecularExponent | `KernelUnitLength ] type fetile = [ | `FeTile ] (* star *) type fetile_content = [ | `Animate | `Set ] type fetile_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `In ] type feturbulence = [ | `FeTurbulence ] (* star *) type feturbulence_content = [ | `Animate | `Set ] type feturbulence_attr = [ | core_attr | presentation_attr | filter_primitive_attr | `Class | `Style | `BaseFrequency | `NumOctaves | `Seed | `StitchTiles | `Type_stitch ] type cursor = [ | `Cursor ] (* star *) type cursor_content = descriptive_element type cursor_attr = [ | core_attr | conditional_processing_attr | xlink_attr | `X | `Y | `ExternalResourcesRequired | `Xlink_href ] type a = [ | `A ] (* star *) type a_content = [ | animation_element | descriptive_element | shape_element | structural_element | gradient_element | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font_Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type a_attr = [ | core_attr | conditional_processing_attr | xlink_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `Xlink_href | `Xlink_show | `Xlink_actuate | `Target ] type view = [ | `View ] (* star *) type view_content = descriptive_element type view_attr = [ | core_attr | `ExternalResourcesRequired | `ViewBox | `PreserveAspectRatio | `ZoomAndPan | `ViewTarget ] type script = [ | `Script ] (* unary *) type script_content = [ | `PCDATA ] type script_attr = [ | core_attr | xlink_attr | `ExternalResourcesRequired | `Type | `Xlink_href ] type animation = [ | `Animation ] (* star *) type animation_content = descriptive_element type animation_attr = [ | conditional_processing_attr | core_attr | animation_event_attr | xlink_attr | animation_attr_target_attr | animation_timing_attr | animation_value_attr | animation_addition_attr | `ExternalResourcesRequired ] type set = [ | `Set ] (* star *) type set_content = descriptive_element type set_attr = [ | core_attr | conditional_processing_attr | xlink_attr | animation_event_attr | animation_attr_target_attr | animation_timing_attr | `To | `ExternalResourcesRequired ] type animatemotion = [ | `AnimateMotion ] (* star *) type animatemotion_content = [ | descriptive_element | `Mpath ] (* XXX *) type animatemotion_attr = [ | conditional_processing_attr | core_attr | animation_event_attr | xlink_attr | animation_timing_attr | animation_value_attr | animation_addition_attr | `ExternalResourcesRequired | `Path | `KeyPoints | `Path | `Rotate | `Origin ] (* XXX: rotate *) type mpath = [ | `Mpath ] (* star *) type mpath_content = descriptive_element type mpath_attr = [ | core_attr | xlink_attr | `ExternalResourcesRequired | `Xlink_href ] type animatecolor = [ | `AnimateColor ] (* star *) type animatecolor_content = descriptive_element type animatecolor_attr = [ | conditional_processing_attr | core_attr | animation_event_attr | xlink_attr | animation_attr_target_attr | animation_timing_attr | animation_value_attr | animation_addition_attr | `ExternalResourcesRequired ] type animatetransform = [ | `AnimateTransform ] (* star *) type animatetransform_content = descriptive_element type animatetransform_attr = [ | conditional_processing_attr | core_attr | animation_event_attr | xlink_attr | animation_attr_target_attr | animation_timing_attr | animation_value_attr | animation_addition_attr | `ExternalResourcesRequired | `Type__animatecolor ] type font = [ | `Font ] (* star *) type font_attr = [ | core_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Horiz___Origin___X | `Horiz___Origin___Y | `Horiz___Adv___X | `Vert___Origin___X | `Vert___Origin___Y | `Vert___Adv___Y ] type font_content = [ | descriptive_element | `Font_Face | `Glyph | `Hkern | `MissingGlyph | `Vkern ] type glyph = [ | `Glyph ] (* star *) type glyph_content = [ | animation_element | descriptive_element | shape_element | structural_element | gradient_element | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font_Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type glyph_attr = [ | core_attr | presentation_attr | `Class | `Style | `D | `Horiz___Adv___X | `Vert___Origin___X | `Vert___Origin___Y | `Vert___Adv___Y | `Unicode | `Glyph___Name | `Orientation | `Arabic___Form | `Lang ] type missingglyph = [ | `MissingGlyph ] (* star *) type missingglyph_content = [ | animation_element | descriptive_element | shape_element | structural_element | gradient_element | `A | `AltGlyphDef | `ClipPath | `Color_Profile | `Cursor | `Filter | `Font | `Font___Face | `ForeignObject | `Image | `Marker | `Mask | `Pattern | `Script | `Style | `Switch | `Text | `View ] type missingglyph_attr = [ | core_attr | presentation_attr | `Class | `Style | `D | `Horiz___Adv___X | `Vert___Origin___X | `Vert___Origin___Y | `Vert___Adv___Y ] type hkern = [ | `Hkern ] (* nullary *) type hkern_attr = [ | core_attr | `U1 | `G1 | `U2 | `G2 | `K ] type vkern = [ | `Vkern ] (* nullary *) type vkern_attr = [ | core_attr | `U1 | `G1 | `U2 | `G2 | `K ] type fontface = [ | `FontFace ] (* nullary *) type fontface_content = [ | descriptive_element | `Font_Face_Src ] type fontface_attr = [ | core_attr | `Font___Family | `Font___Style | `Font___Variant | `Font___Weight | `Font___Stretch | `Font___Size | `Unicode___Range | `Units___Per___Em | `Panose___1 | `Stemv | `Stemh | `Slope | `Cap___Height | `X___Height | `Accent___Height | `Ascent | `Descent | `Widths | `Bbox | `Ideographic | `Alphabetic | `Mathematical | `Hanging | `V___Ideographic | `V___Alphabetic | `V___Mathematical | `V___Hanging | `Underline___Position | `Underline___Thickness | `Strikethrough___Position | `Strikethrough___Thickness | `Overline___Position | `Overline___Thickness ] type fontfacesrc = [ | `Font_Face_Src ] (* star *) type fontfacesrc_content = [ | `Font_Face_Name | `Font_Face_Uri ] type fontfacesrc_attr = core_attr type fontfaceuri = [ | `Font_Face_Uri ] (* star *) type fontfaceuri_content = [ | `Font_Face_Format ] type fontfaceuri_attr = [ | core_attr | xlink_attr | `Xlink_href ] type fontfaceformat = [ | `Font_Face_Uri ] (* nullary *) type fontfaceformat_attr = [ | core_attr | `String ] type fontfacename = [ | `Font_Face_Name ] (* nullary *) type fontfacename_attr = [ | core_attr | `Name ] type metadata = [ | `Metadata ] type metadata_attr = [ | core_attr ] type foreignobject = [ | `ForeignObject ] type foreignobject_attr = [ | core_attr | conditional_processing_attr | graphical_event_attr | presentation_attr | `Class | `Style | `ExternalResourcesRequired | `Transform | `X | `Y | `Width | `Height ] ��������������������������������������������������������������������������������������������������������������������������������������������������tyxml-2.2.0/lib/xhtml_duce.ml�����������������������������������������������������������������������0000644�0000000�0000000�00000002760�12060404012�014304� 0����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Printers for XHTML 1.0 and 1.1 documents *) module type T = Xml_sigs_duce.Typed_xml with type doc = Xhtml_types_duce.html and type elt = {{ Xhtml_types_duce.block | Xhtml_types_duce.form | Xhtml_types_duce.misc }} module M_01_00 = struct module Info = Xhtml.M_01_00.Info type doc = {{ Xhtml_types_duce.html }} type elt = {{ Xhtml_types_duce.block | Xhtml_types_duce.form | Xhtml_types_duce.misc }} let of_doc (x: doc) : Ocamlduce.Load.anyxml = x let of_elt (x: elt) : Ocamlduce.Load.anyxml = x end module P_01_00 = Xml_print_duce.Make_typed(M_01_00) module M = M_01_00 module P = P_01_00 ����������������tyxml-2.2.0/lib/html5.mli���������������������������������������������������������������������������0000644�0000000�0000000�00000003230�12060404012�013343� 0����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Typesafe constructors and printers for HTML5 documents. @see <http://www.w3.org/TR/html5/> W3C Recommendation *) (** Concrete implementation of HTML5 typesafe constructors *) module M : Html5_sigs.T with type Xml.uri = Xml.uri and type Xml.event_handler = Xml.event_handler and type Xml.attrib = Xml.attrib and type Xml.elt = Xml.elt and module Svg := Svg.M (** Simple printer for HTML5 documents *) module P : Xml_sigs.Typed_simple_printer with type 'a elt := 'a M.elt and type doc := M.doc (** Parametrized stream printer for HTML5 documents *) module Make_printer(O : Xml_sigs.Output) : Xml_sigs.Typed_printer with type out := O.out and type 'a elt := 'a M.elt and type doc := M.doc ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tyxml-2.2.0/lib/svg_f.ml����������������������������������������������������������������������������0000644�0000000�0000000�00000065116�12060404012�013260� 0����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2010 by Simon Castellan * Copyright (C) 2010 by Cecile Herbelin * Copyright (C) 2010 by Vincent Balat * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Type instantiations for SVG *) (** This module defines basic data types for data, attributes and element occuring in SVG documents. It is based on the specification available at http://www.w3.org/TR/SVG/. This module is experimental, it may lack of some attributes, and the interface is very low level and do not take deeply into account the needs of SVG elements. *) open Svg_types open Unit let string_of_iri x = x module Unit = struct let rel x = (x, None) let deg x = (x, Some `Deg) let grad x = (x, Some `Grad) let rad x = (x, Some `Rad) let ms x = (x, Some `Ms) let s x = (x, Some `S) let em x = (x, Some `Em) let ex x = (x, Some `Ex) let px x = (x, Some `Px) let in_ x = (x, Some `In) let cm x = (x, Some `Cm) let mm x = (x, Some `Mm) let pt x = (x, Some `Pt) let pc x = (x, Some `Pc) let percent x = (x, Some `Percent) let hz x = (x, Some `Hz) let khz x = (x, Some `KHz) let to_string list (n, unit) = Printf.sprintf "%g%s" n begin match unit with | Some unit -> List.assoc unit list | None -> "" end let deg_names = [ (`Deg, "deg"); (`Grad, "grad"); (`Rad, "rad") ] let string_of_angle a = to_string deg_names a let time_names = [ (`Ms, "ms"); (`S, "s") ] let string_of_time a = to_string time_names a let length_names = [ (`Em, "em"); (`Ex, "ex"); (`Px, "px"); (`In, "in"); (`Cm, "cm"); (`Mm, "mm"); (`Pt, "pt"); (`Pc, "pc"); (`Percent, "%") ] let string_of_length (a: length) = to_string length_names a let freq_names = [ (`Hz, "Hz"); (`KHz, "kHz") ] let string_of_freq a = to_string freq_names a end open Unit let string_of_coord = string_of_length let string_of_number = string_of_float let string_of_number_optional_number = function | (x, Some y) -> Printf.sprintf "%g, %g" x y | (x, None) -> Printf.sprintf "%g" x let string_of_percentage = Printf.sprintf "%d%%" let string_of_strings = String.concat ", " let string_of_transform = function | Matrix ((a, b, c, d, e, f)) -> Printf.sprintf "matrix(%g %g %g %g %g %g)" a b c d e f | Translate x -> Printf.sprintf "translate(%s)" (string_of_number_optional_number x) | Scale x -> Printf.sprintf "scale(%s)" (string_of_number_optional_number x) | Rotate ((angle, x)) -> Printf.sprintf "rotate(%s %s)" (string_of_angle angle) (match x with | Some ((x, y)) -> Printf.sprintf "%g %g" x y | None -> "") | SkewX angle -> Printf.sprintf "skewX(%s)" (string_of_angle angle) | SkewY angle -> Printf.sprintf "skewY(%s)" (string_of_angle angle) let string_of_spacestrings = String.concat " " let string_of_commastrings = String.concat ", " let string_of_transforms x = String.concat " " (List.map string_of_transform x) let string_of_fourfloats (a, b, c, d) = Printf.sprintf "%g %g %g %g" a b c d let string_of_lengths l = String.concat " " (List.map string_of_length l) let string_of_numbers l = String.concat " " (List.map string_of_float l) let string_of_numbers_semicolon l = String.concat ";" (List.map string_of_float l) let string_of_coords l = String.concat " " (List.map (fun (a, b) -> Printf.sprintf "%g, %g" a b) l) module Make(Xml : Xml_sigs.T) = struct module Xml = Xml module Info = struct let content_type = "image/svg+xml" let alternative_content_types = [] let emptytags = [] let version = "SVG 1.1" let standard = "http://www.w3.org/TR/svg11/" let namespace = "http://www.w3.org/2000/svg" let doctype = Xml_print.compose_doctype "svg" ["-//W3C//DTD SVG 1.1//EN"; "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"] end open Unit type uri = Xml.uri let string_of_uri = Xml.string_of_uri let uri_of_string = Xml.uri_of_string type 'a attrib = Xml.attrib type +'a elt = Xml.elt type +'a elts = Xml.elt list type ('a, 'b) nullary = ?a: (('a attrib) list) -> unit -> 'b elt type ('a, 'b, 'c) unary = ?a: (('a attrib) list) -> 'b elt -> 'c elt type ('a, 'b, 'c) star = ?a: (('a attrib) list) -> ('b elt) list -> 'c elt type ('a, 'b, 'c) plus = ?a: (('a attrib) list) -> 'b elt -> ('b elt) list -> 'c elt let tot x = x let totl x = x let toelt x = x let toeltl x = x let to_xmlattribs x = x let to_attrib x = x let nullary tag ?a () = Xml.node ?a tag [] let unary tag ?a elt = Xml.node ?a tag [ elt ] let star tag ?a elts = Xml.node ?a tag elts let plus tag ?a elt elts = Xml.node ?a tag (elt :: elts) type altglyphdef_content = [ | `Ref of (glyphref elt) list | `Item of (altglyphitem elt) list ] let string_of_string s = s let to_xmlattribs x = x let float_attrib = Xml.float_attrib let int_attrib = Xml.int_attrib let string_attrib = Xml.string_attrib let uri_attrib = Xml.uri_attrib let user_attrib f name v = Xml.string_attrib name (f v) let metadata ?a children = Xml.node ?a "metadata" children let foreignobject ?a children = Xml.node ?a "foreignObject" children (* generated *) let a_version = user_attrib string_of_string "version" let a_baseprofile = user_attrib string_of_string "baseProfile" let a_x = user_attrib string_of_coord "x" let a_y = user_attrib string_of_coord "y" let a_width = user_attrib string_of_length "width" let a_height = user_attrib string_of_length "height" let a_preserveaspectratio = user_attrib string_of_string "preserveAspectRatio" let a_contentscripttype = user_attrib string_of_string "contentScriptType" let a_contentstyletype = user_attrib string_of_string "contentStyleType" let a_zoomAndPan x = user_attrib string_of_string "zoomAndSpan" (match x with `Disable -> "disable" | `Magnify -> "magnify") let a_xlink_href = user_attrib string_of_iri "xlink:href" let a_requiredfeatures = user_attrib string_of_spacestrings "requiredFeatures" let a_requiredextensions = user_attrib string_of_spacestrings "requiredExtension" let a_systemlanguage = user_attrib string_of_commastrings "systemLanguage" let a_externalressourcesrequired = user_attrib string_of_bool "externalRessourcesRequired" let a_id = user_attrib string_of_string "id" let a_xml_base = user_attrib string_of_iri "xml:base" let a_xml_lang = user_attrib string_of_iri "xml:lang" let a_xml_space x = user_attrib string_of_string "xml:space" (match x with | `Default -> "default" | `Preserve -> "preserve") let a_type = user_attrib string_of_string "type" let a_media = user_attrib string_of_commastrings "media" let a_title = user_attrib string_of_string "title" let a_class = user_attrib string_of_spacestrings "class" let a_style = user_attrib string_of_string "style" let a_transform = user_attrib string_of_transform "transform" let a_viewbox = user_attrib string_of_fourfloats "viewbox" let a_d = user_attrib string_of_string "d" let a_pathlength = user_attrib string_of_float "pathLength" let a_rx = user_attrib string_of_length "rx" let a_ry = user_attrib string_of_length "ry" let a_cx = user_attrib string_of_length "cx" let a_cy = user_attrib string_of_length "cy" let a_r = user_attrib string_of_length "r" let a_x1 = user_attrib string_of_coord "x1" let a_y1 = user_attrib string_of_coord "y1" let a_x2 = user_attrib string_of_coord "x2" let a_y2 = user_attrib string_of_coord "y2" let a_points = user_attrib string_of_coords "points" let a_x_list = user_attrib string_of_lengths "x" let a_y_list = user_attrib string_of_lengths "y" let a_dx = user_attrib string_of_lengths "dx" let a_dy = user_attrib string_of_lengths "dy" let a_dx_single = user_attrib string_of_length "dx" let a_dy_single = user_attrib string_of_length "dy" let a_dx_number = user_attrib string_of_number "dx" let a_dy_number = user_attrib string_of_number "dy" let a_lengthadjust x = user_attrib string_of_string "lengthAdjust" (match x with | `Spacing -> "spacing" | `SpacingAndGlyphs -> "spacingAndGlyphs") let a_textlength = user_attrib string_of_length "textLength" let a_rotate = user_attrib string_of_numbers "rotate" let a_startoffset = user_attrib string_of_length "startOffset" let a_method x = user_attrib string_of_string "method" (match x with | `Align -> "align" | `Stretch -> "stretch") let a_spacing x = user_attrib string_of_string "spacing" (match x with | `Auto -> "auto" | `Exact -> "exact") let a_glyphref = user_attrib string_of_string "glyphRef" let a_format = user_attrib string_of_string "format" let a_markerunits x = user_attrib string_of_string "markerUnits" (match x with | `StrokeWidth -> "strokeWidth" | `UserSpaceOnUse -> "userSpaceOnUse") let a_refx = user_attrib string_of_coord "refX" let a_refy = user_attrib string_of_coord "refY" let a_markerwidth = user_attrib string_of_length "markerWidth" let a_markerheight = user_attrib string_of_length "markerHeight" let a_orient x = user_attrib string_of_string "orient" (match x with | `Auto -> "auto" | `Angle __svg -> string_of_angle __svg) let a_local = user_attrib string_of_string "local" let a_string = user_attrib string_of_string "name" let a_renderingindent x = user_attrib string_of_string "rendering:indent" (match x with | `Auto -> "auto" | `Perceptual -> "perceptual" | `Relative_colorimetric -> "relative_colorimetric" | `Saturation -> "saturation" | `Absolute_colorimetric -> "absolute_colorimetric") let a_gradientunits x = user_attrib string_of_string "gradientUnits" (match x with | `UserSpaceOnUse -> "userSpaceOnUse" | `ObjectBoundingBox -> "objectBoundingBox") let a_gradienttransform = user_attrib string_of_transforms "gradient:transform" let a_spreadmethod x = user_attrib string_of_string "spreadMethod" (match x with | `Pad -> "pad" | `Reflect -> "reflect" | `Repeat -> "repeat") let a_fx = user_attrib string_of_coord "fx" let a_fy = user_attrib string_of_coord "fy" let a_offset x = user_attrib string_of_string "offset" (match x with | `Number __svg -> string_of_number __svg | `Percentage __svg -> string_of_percentage __svg) let a_patternunits x = user_attrib string_of_string "patternUnits" (match x with | `UserSpaceOnUse -> "userSpaceOnUse" | `ObjectBoundingBox -> "objectBoundingBox") let a_patterncontentunits x = user_attrib string_of_string "patternContentUnits" (match x with | `UserSpaceOnUse -> "userSpaceOnUse" | `ObjectBoundingBox -> "objectBoundingBox") let a_patterntransform = user_attrib string_of_transforms "patternTransform" let a_clippathunits x = user_attrib string_of_string "clipPathUnits" (match x with | `UserSpaceOnUse -> "userSpaceOnUse" | `ObjectBoundingBox -> "objectBoundingBox") let a_maskunits x = user_attrib string_of_string "maskUnits" (match x with | `UserSpaceOnUse -> "userSpaceOnUse" | `ObjectBoundingBox -> "objectBoundingBox") let a_maskcontentunits x = user_attrib string_of_string "maskContentUnits" (match x with | `UserSpaceOnUse -> "userSpaceOnUse" | `ObjectBoundingBox -> "objectBoundingBox") let a_primitiveunits x = user_attrib string_of_string "primitiveUnits" (match x with | `UserSpaceOnUse -> "userSpaceOnUse" | `ObjectBoundingBox -> "objectBoundingBox") let a_filterres = user_attrib string_of_number_optional_number "filterResUnits" let a_result = user_attrib string_of_string "result" let a_in x = user_attrib string_of_string "in" (match x with | `SourceGraphic -> "sourceGraphic" | `SourceAlpha -> "sourceAlpha" | `BackgroundImage -> "backgroundImage" | `BackgroundAlpha -> "backgroundAlpha" | `FillPaint -> "fillPaint" | `StrokePaint -> "strokePaint" | `Ref __svg -> string_of_string __svg) let a_in2 x = user_attrib string_of_string "in2" (match x with | `SourceGraphic -> "sourceGraphic" | `SourceAlpha -> "sourceAlpha" | `BackgroundImage -> "backgroundImage" | `BackgroundAlpha -> "backgroundAlpha" | `FillPaint -> "fillPaint" | `StrokePaint -> "strokePaint" | `Ref __svg -> string_of_string __svg) let a_aizmuth = user_attrib string_of_float "azimuth" let a_elevation = user_attrib string_of_float "elevation" let a_pointatx = user_attrib string_of_float "pointsAtX" let a_pointaty = user_attrib string_of_float "pointsAtY" let a_pointatz = user_attrib string_of_float "pointsAtZ" let a_specularexponent = user_attrib string_of_float "specularExponent" let a_specularconstant = user_attrib string_of_float "specularConstant" let a_limitingconeangle = user_attrib string_of_float "limitingConeAngle" let a_mode x = user_attrib string_of_string "mode" (match x with | `Normal -> "normal" | `Multiply -> "multiply" | `Screen -> "screen" | `Darken -> "darken" | `Lighten -> "lighten") let a_typefecolor x = user_attrib string_of_string "type" (match x with | `Matrix -> "matrix" | `Saturate -> "saturate" | `HueRotate -> "hueRotate" | `LuminanceToAlpha -> "luminanceToAlpha") let a_values = user_attrib string_of_numbers "values" let a_transferttype x = user_attrib string_of_string "type" (match x with | `Identity -> "identity" | `Table -> "table" | `Discrete -> "discrete" | `Linear -> "linear" | `Gamma -> "gamma") let a_tablevalues = user_attrib string_of_numbers "tableValues" let a_slope = user_attrib string_of_number "slope" let a_intercept = user_attrib string_of_number "intercept" let a_amplitude = user_attrib string_of_number "amplitude" let a_exponent = user_attrib string_of_number "exponent" let a_offsettransfer = user_attrib string_of_number "offset" let a_operator x = user_attrib string_of_string "operator" (match x with | `Over -> "over" | `In -> "in" | `Out -> "out" | `Atop -> "atop" | `Xor -> "xor" | `Arithmetic -> "arithmetic") let a_k1 = user_attrib string_of_number "k1" let a_k2 = user_attrib string_of_number "k2" let a_k3 = user_attrib string_of_number "k3" let a_k4 = user_attrib string_of_number "k4" let a_order = user_attrib string_of_number_optional_number "order" let a_kernelmatrix = user_attrib string_of_numbers "kernelMatrix" let a_divisor = user_attrib string_of_number "divisor" let a_bias = user_attrib string_of_number "bias" let a_kernelunitlength = user_attrib string_of_number_optional_number "kernelUnitLength" let a_targetX = user_attrib string_of_int "targetX" let a_targetY = user_attrib string_of_int "targetY" let a_edgemode x = user_attrib string_of_string "targetY" (match x with | `Duplicate -> "duplicate" | `Wrap -> "wrap" | `None -> "none") let a_preservealpha = user_attrib string_of_bool "targetY" let a_surfacescale = user_attrib string_of_number "surfaceScale" let a_diffuseconstant = user_attrib string_of_number "diffuseConstant" let a_scale = user_attrib string_of_number "scale" let a_xchannelselector x = user_attrib string_of_string "xChannelSelector" (match x with | `R -> "r" | `G -> "g" | `B -> "b" | `A -> "a") let a_ychannelselector x = user_attrib string_of_string "yChannelSelector" (match x with | `R -> "r" | `G -> "g" | `B -> "b" | `A -> "a") let a_stddeviation = user_attrib string_of_number_optional_number "stdDeviation" let a_operatormorphology x = user_attrib string_of_string "operatorMorphology" (match x with | `Erode -> "erode" | `Dilate -> "dilate") let a_radius = user_attrib string_of_number_optional_number "radius" let a_basefrenquency = user_attrib string_of_number_optional_number "baseFrequency" let a_numoctaves = user_attrib string_of_int "numOctaves" let a_seed = user_attrib string_of_number "seed" let a_stitchtiles x = user_attrib string_of_string "stitchTiles" (match x with | `Stitch -> "stitch" | `NoStitch -> "noStitch") let a_stitchtype x = user_attrib string_of_string "typeStitch" (match x with | `FractalNoise -> "fractalNoise" | `Turbulence -> "turbulence") let a_xlinkshow x = user_attrib string_of_string "xlink:show" (match x with | `New -> "new" | `Replace -> "replace") let a_xlinkactuate x = user_attrib string_of_string "xlink:actuate" (match x with | `OnRequest -> "onRequest") let a_target = user_attrib string_of_string "xlink:target" let a_viewtarget = user_attrib string_of_string "viewTarget" let a_attributename = user_attrib string_of_string "attributeName" let a_attributetype x = user_attrib string_of_string "attributeType" (match x with | `CSS -> "cSS" | `XML -> "xML" | `Auto -> "auto") let a_begin = user_attrib string_of_string "begin" let a_dur = user_attrib string_of_string "dur" let a_min = user_attrib string_of_string "min" let a_max = user_attrib string_of_string "max" let a_restart x = user_attrib string_of_string "restart" (match x with | `Always -> "always" | `WhenNotActive -> "whenNotActive" | `Never -> "never") let a_repeatcount = user_attrib string_of_string "repeatCount" let a_repeatdur = user_attrib string_of_string "repeatDur" let a_fill x = user_attrib string_of_string "fill" (match x with | `Freeze -> "freeze" | `Remove -> "remove") let a_calcmode x = user_attrib string_of_string "calcMode" (match x with | `Discrete -> "discrete" | `Linear -> "linear" | `Paced -> "paced" | `Spline -> "spline") let a_values_anim = user_attrib string_of_strings "values" let a_keytimes = user_attrib string_of_strings "keyTimes" let a_keysplines = user_attrib string_of_strings "keySplines" let a_from = user_attrib string_of_string "from" let a_to = user_attrib string_of_string "to" let a_by = user_attrib string_of_string "by" let a_additive x = user_attrib string_of_string "additive" (match x with | `Replace -> "replace" | `Sum -> "sum") let a_accumulate x = user_attrib string_of_string "accumulate" (match x with | `None -> "none" | `Sum -> "sum") let a_keypoints = user_attrib string_of_numbers_semicolon "keyPoints" let a_path = user_attrib string_of_string "path" let a_typeanimatecolor x = user_attrib string_of_string "type" (match x with | `Translate -> "translate" | `Scale -> "scale" | `Rotate -> "rotate" | `SkewX -> "skewX" | `SkewY -> "skewY") let a_horiz_origin_x = user_attrib string_of_number "horiz-origin-x" let a_horiz_origin_y = user_attrib string_of_number "horiz-origin-y" let a_horiz_adv_x = user_attrib string_of_number "horiz-adv-x" let a_vert_origin_x = user_attrib string_of_number "vert-origin-x" let a_vert_origin_y = user_attrib string_of_number "vert-origin-y" let a_vert_adv_y = user_attrib string_of_number "vert-adv-y" let a_unicode = user_attrib string_of_string "unicode" let a_glyphname = user_attrib string_of_string "glyphname" let a_orientation x = user_attrib string_of_string "orientation" (match x with | `H -> "h" | `V -> "v") let a_arabicform x = user_attrib string_of_string "arabic-form" (match x with | `Initial -> "initial" | `Medial -> "medial" | `Terminal -> "terminal" | `Isolated -> "isolated") let a_lang = user_attrib string_of_string "lang" let a_u1 = user_attrib string_of_string "u1" let a_u2 = user_attrib string_of_string "u2" let a_g1 = user_attrib string_of_string "g1" let a_g2 = user_attrib string_of_string "g2" let a_k = user_attrib string_of_string "k" let a_fontfamily = user_attrib string_of_string "font-family" let a_fontstyle = user_attrib string_of_string "font-style" let a_fontvariant = user_attrib string_of_string "font-variant" let a_fontweight = user_attrib string_of_string "font-weight" let a_fontstretch = user_attrib string_of_string "font-stretch" let a_fontsize = user_attrib string_of_string "font-size" let a_unicoderange = user_attrib string_of_string "unicode-range" let a_unitsperem = user_attrib string_of_string "units-per-em" let a_stemv = user_attrib string_of_number "stemv" let a_stemh = user_attrib string_of_number "stemh" let a_slope = user_attrib string_of_number "slope" let a_capheight = user_attrib string_of_number "cap-height" let a_xheight = user_attrib string_of_number "x-height" let a_accentheight = user_attrib string_of_number "accent-height" let a_ascent = user_attrib string_of_number "ascent" let a_widths = user_attrib string_of_string "widths" let a_bbox = user_attrib string_of_string "bbox" let a_ideographic = user_attrib string_of_number "ideographic" let a_alphabetic = user_attrib string_of_number "alphabetic" let a_mathematical = user_attrib string_of_number "mathematical" let a_hanging = user_attrib string_of_number "hanging" let a_videographic = user_attrib string_of_number "v-ideographic" let a_valphabetic = user_attrib string_of_number "v-alphabetic" let a_vmathematical = user_attrib string_of_number "v-mathematical" let a_vhanging = user_attrib string_of_number "v-hanging" let a_underlineposition = user_attrib string_of_number "underline-position" let a_underlinethickness = user_attrib string_of_number "underline-thickness" let a_strikethroughposition = user_attrib string_of_number "strikethrough-position" let a_strikethroughthickness = user_attrib string_of_number "strikethrough-thickness" let a_overlineposition = user_attrib string_of_number "overline-position" let a_overlinethickness = user_attrib string_of_number "overline-thickness" let a_string = user_attrib string_of_string "string" let a_name = user_attrib string_of_string "name" let a_onabort = user_attrib string_of_string "onabort" let a_onactivate = user_attrib string_of_string "onactivate" let a_onbegin = user_attrib string_of_string "onbegin" let a_onclick = user_attrib string_of_string "onclick" let a_onend = user_attrib string_of_string "onend" let a_onerror = user_attrib string_of_string "onerror" let a_onfocusin = user_attrib string_of_string "onfocusin" let a_onfocusout = user_attrib string_of_string "onfocusout" let a_onload = user_attrib string_of_string "onload" let a_onmousedown = user_attrib string_of_string "onmousdown" let a_onmouseup = user_attrib string_of_string "onmouseup" let a_onmouseover = user_attrib string_of_string "onmouseover" let a_onmouseout = user_attrib string_of_string "onmouseout" let a_onmousemove = user_attrib string_of_string "onmousemove" let a_onrepeat = user_attrib string_of_string "onrepeat" let a_onresize = user_attrib string_of_string "onresize" let a_onscroll = user_attrib string_of_string "onscroll" let a_onunload = user_attrib string_of_string "onunload" let a_onzoom = user_attrib string_of_string "onzoom" (* also generated *) let svg = star "svg" let g = star "g" let defs = star "defs" let desc = unary "desc" let title = unary "title" let symbol = star "symbol" let use = star "use" let image = star "image" let switch = star "switch" let style = unary "style" let path = star "path" let rect = star "rect" let circle = star "circle" let ellipse = star "ellipse" let line = star "line" let polyline = star "polyline" let polygon = star "polygon" let text = star "text" let tspan = star "tspan" let tref = star "tref" let textpath = star "textPath" let altglyph = unary "altGlyph" let altglyphdef = unary "altGlyphDef" let altglyphitem = plus "altGlyphItem" let glyphref = nullary "glyphRef];" let marker = star "marker" let colorprofile = star "colorProfile" let lineargradient = star "linear-gradient" let radialgradient = star "radial-gradient" let gradientstop = star "gradient-stop" let pattern = star "pattern" let clippath = star "clipPath" let filter = star "filter" let fedistantlight = star "feDistantLight" let fepointlight = star "fePointLight" let fespotlight = star "feSpotLight" let feblend = star "feBlend" let fecolormatrix = star "feColorMatrix" let fecomponenttransfer = star "feComponentTransfer" let fefunca = star "feFuncA" let fefuncg = star "feFuncA" let fefuncb = star "feFuncA" let fefuncr = star "feFuncA" let fecomposite = star "(*" let feconvolvematrix = star "feConvolveMatrix" let fediffuselighting = star "(*" let fedisplacementmap = star "feDisplacementMap];" let feflood = star "(*" let fegaussianblur = star "];" let feimage = star "(*" let femerge = star "feMerge" let femorphology = star "feMorphology" let feoffset = star "feOffset" let fespecularlighting = star "feSpecularLighting" let fetile = star "feTile" let feturbulence = star "feTurbulence" let cursor = star "(*" let a = star "a" let view = star "view" let script = unary "script" let animation = star "(*" let set = star "set" let animatemotion = star "animateMotion" let mpath = star "mpath" let animatecolor = star "animateColor" let animatetransform = star "animateTransform" let font = star "font" let glyph = star "glyph" let missingglyph = star "missingGlyph" let hkern = nullary "hkern" let vkern = nullary "vkern" let fontface = nullary "fontFace" let fontfacesrc = star "font-face-src" let fontfaceuri = star "font-face-uri" let fontfaceformat = nullary "font-face-uri" let fontfacename = nullary "font-face-name" type doc = [ `Svg ] elt let doc_toelt x = x end ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tyxml-2.2.0/lib/xml_sigs_duce.mli�������������������������������������������������������������������0000644�0000000�0000000�00000003502�12060404012�015141� 0����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2011 Pierre Chambart, Grégoire Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) module type Printer = sig val print_list: output:(string -> unit) -> ?encode:(string -> string) -> Ocamlduce.Load.anyxml list -> unit end module type Typed_xml = sig module Info : Xml_sigs.Info type elt type doc val of_doc : doc -> Ocamlduce.Load.anyxml val of_elt : elt -> Ocamlduce.Load.anyxml end module type Raw_typed_printer = sig val print_list: output:(string -> unit) -> ?encode:(string -> string) -> {{ Ocamlduce.Load.anyxml }} list -> unit val print: output:(string -> unit) -> ?encode:(string -> string) -> ?advert:string-> {{ Ocamlduce.Load.anyxml }} -> unit end module type Typed_printer = sig module Typed_xml : Typed_xml type elt = Typed_xml.elt type doc = Typed_xml.doc val print_list: output:(string -> unit) -> ?encode:(string -> string) -> elt list -> unit val print: output:(string -> unit) -> ?encode:(string -> string) -> ?advert:string-> doc -> unit end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������tyxml-2.2.0/syntax/���������������������������������������������������������������������������������0000755�0000000�0000000�00000000000�12060404012�012371� 5����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������tyxml-2.2.0/syntax/pa_tyxml.mli���������������������������������������������������������������������0000644�0000000�0000000�00000003537�12060404012�014741� 0����������������������������������������������������������������������������������������������������ustar�00����������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ (** Syntax extension for HTML5, XHTML or SVG tree creation. *) (** To choose actual XML-implementation you have to provide a module named [Html5] (or [Xhtml] or [Svg] respectively): For example, the following code: {[ let module Html5 = Html5.M in << <html> <head><title>

plop

>> ) ]} is a caml value of type {v Html5_types.html Html5.elt v}. In the following, [Html5] is assumed to be an HTML5 implementation, such as [Html5.M], but this could for example also be Eliom's [Eliom_content.Html5.F]. To compile a module containing this syntax, you need the camlp4 preprocessor: {[ ocamlfind ocamlc -package tyxml.syntax -syntax camlp4o -c your_module.ml ]} or {[ ocamlc -pp "camlp4o -I pa_tyxml.cmo" -c your_module.ml ]} You can insert OCaml expressions of type {v 'a Html5.M.elt v} inside html using {v $...$ v}, like this: {[ let oc = << Ocsigen >> in <<

$oc$ will revolutionize web programming.

>> ]} You can insert OCaml expressions of type string inside html using {v $str:... $ v}, like this: {[ let i = 4 in <<

i is equal to $str:string_of_int i$

>> ]} If you want to use a dollar in your page, just write it twice. You can write a list of html5 expressions using the syntax {v <:html5list<...>> v}, for example: {[ <:html5list<

hello

>> ]} Here are some other examples showing what you can do: {[ <<
    $first_il$ $list:items$
>> ]} Warning: lists antiquotations are allowed only at the end (before a closing tag). For example, the following is not valid: {[ <<
    $list:items$ $last_il$
>> ]} The syntax extension is not allowed in patterns for the while. Additionnaly, you may use [ xhtml ], [ xhtmllist ], [ svg ] or [ svglist ]. *) tyxml-2.2.0/syntax/xmllexer.mll0000644000000000000000000002653712060404012014754 0ustar0000000000000000(****************************************************************************) (* *) (* Objective Caml *) (* *) (* INRIA Rocquencourt *) (* *) (* Copyright 2006-2006 Institut National de Recherche en Informatique et *) (* en Automatique. All rights reserved. This file is distributed under *) (* the terms of the GNU Library General Public License, with the special *) (* exception on linking described in LICENSE at the top of the Objective *) (* Caml source tree. *) (* *) (****************************************************************************) (* Authors: * - Daniel de Rauglaudre: initial version * - Nicolas Pouillard: refactoring (Lexer.mll) * - Gabriel Kerneis : merging with xml-light => xmllexer.mll * - Boris Yakobowski : simplification of the code, better handling of XML/Xhtml with quotations mode *) (* The lexer definition *) { type lexing_error = | EUnterminatedComment | EUnterminatedString | EIdentExpected | ECloseExpected | ENodeExpected | EAttributeNameExpected | EAttributeValueExpected | EUnterminatedEntity | ECamlIdentExpected | WNestedComments let lex_error_to_string = function | EUnterminatedComment -> "Unterminated Comment" | EUnterminatedString -> "Unterminated String" | EIdentExpected -> "Ident Expected" | ECloseExpected -> "Close Expected" | ENodeExpected -> "Node Expected" | EAttributeNameExpected -> "Attribute Name Expected" | EAttributeValueExpected -> "Attribute Value Expected" | EUnterminatedEntity -> "Unterminated Entity" | ECamlIdentExpected -> "Caml Ident Expected" | WNestedComments -> "Nested comments (non valid XML)" open Camlp4 module Loc = Camlp4.PreCast.Loc open Lexing (* To store some context information: * loc : position of the beginning of a string, quotation and comment * entity : shall we translate entities or not *) type context = { loc : Loc.t ; lexbuf : lexbuf ; buffer : Buffer.t ; entity : bool ; } let default_context lb = { loc = Loc.ghost ; lexbuf = lb ; buffer = Buffer.create 256 ; entity = true ; } (* To buffer string literals *) let store c = Buffer.add_string c.buffer (Lexing.lexeme c.lexbuf) let istore_char c i = Buffer.add_char c.buffer (Lexing.lexeme_char c.lexbuf i) let buff_contents c = let contents = Buffer.contents c.buffer in Buffer.reset c.buffer; contents let loc c = Loc.merge c.loc (Loc.of_lexbuf c.lexbuf) let with_curr_loc f c = f { (c) with loc = Loc.of_lexbuf c.lexbuf } c.lexbuf let parse f c = f c c.lexbuf let lexeme c = Lexing.lexeme c.lexbuf let store_string c s = Buffer.add_string c.buffer s (* Deal with entities *) let idents = Hashtbl.create 0 let _ = begin Hashtbl.add idents "gt;" ">"; Hashtbl.add idents "lt;" "<"; Hashtbl.add idents "amp;" "&"; Hashtbl.add idents "apos;" "'"; Hashtbl.add idents "quot;" "\""; end (* Update the current location with file name and line number. *) let update_loc c line absolute chars = let lexbuf = c.lexbuf in let pos = lexbuf.lex_curr_p in lexbuf.lex_curr_p <- { pos with pos_lnum = if absolute then line else pos.pos_lnum + line; pos_bol = pos.pos_cnum - chars; } (* The lexer is parameterized to handle both Xml and Xhtml with inlined Caml code modes. *) module type LexerArgSig = sig (* We do not raise the same exception in both lexers *) val error : Camlp4.PreCast.Loc.t -> lexing_error -> exn type attr_name = private [> `AttrName of string ] type attr_value = private [> `AttrVal of string ] type attribute = private [> `Attribute of (attr_name * attr_value) ] type token = private [> | `Tag of (string * (attribute list) * bool) | `PCData of string | `Endtag of string | `Comment of string | `Whitespace of string | `Eof ] val parse_dollar_token : context -> lexbuf -> token val parse_dollar_attrname : context -> Loc.t -> lexbuf -> attr_name val parse_dollar_attrvalue : context -> Loc.t -> lexbuf -> attr_value val parse_dollar_attribute : context -> Loc.t -> lexbuf -> attribute end module Make (X : LexerArgSig) = struct let err error loc = raise (X.error loc error) } (******************************************************************************) (* NB : ignore(buff_contents c) flushes the buffer c *) let newline = ['\n'] let break = ['\r'] let space = [' ' '\t'] let identchar = ['A'-'Z' 'a'-'z' '_' '0'-'9' ':' '-'] let entitychar = ['A'-'Z' 'a'-'z'] let pcchar = [^ '\r' '\n' '<' '>' '&' '$'] let camlidentchar = [^ '$' ] rule token c = parse | newline { update_loc c 1 false 0; `Whitespace (lexeme c) } | (space|break) + { `Whitespace (lexeme c) } (* WARNING: on considère les commentaires comme des noeuds ; c'est mal, mais c'est la seule solution si on ne veut pas les ignorer. Autre solution : les ignorer et rajouter un commentaire de remplissage au niveau du parser si on se retrouve avec une liste de noeuds vide (donc si le seul noeud à analyser était un commentaire *) | "" ; comment c l lexbuf } | "-->" { match l with | [] (* Should not occur... *) | [_] -> buff_contents c | _ -> "" } | eof { err EUnterminatedComment (match l with | [] -> Loc.of_lexbuf lexbuf | l :: _ -> l) } | _ { store c ; comment c l lexbuf } and header c = parse (* Le header est ignoré *) | newline { update_loc c 1 false 0; header c lexbuf } | "?>" { () } | eof { err ECloseExpected (loc c) } | _ { header c lexbuf } and pcdata c = parse | pcchar+ { store c ; pcdata c lexbuf } | "&#" { store c ; pcdata c lexbuf; } | '&' { store_string c (entity c lexbuf); pcdata c lexbuf } | "$$" { store_string c "$" ; pcdata c lexbuf } | "" { buff_contents c } and entity c = parse | entitychar+ ';' { let ident = lexeme c in if not c.entity then "&" ^ ident else try Hashtbl.find idents (String.lowercase ident) with Not_found -> "&" ^ ident } | _ | eof { err EUnterminatedEntity (Loc.of_lexbuf lexbuf) } and ident_name c = parse | identchar+ { lexeme c } | _ | eof { err EIdentExpected (loc c)} and close_tag c = parse | '>' { () } | _ | eof { err ECloseExpected (loc c)} and attributes c = parse | '>' { [], false } | "/>" { [], true } | "$list:" { let attribute = X.parse_dollar_attribute c (Loc.of_lexbuf lexbuf) lexbuf in ignore_spaces c lexbuf; let others, closed = attributes c lexbuf in attribute :: others, closed } | "" { let attribute = let a = attr_name c lexbuf in let data = attr_data c lexbuf in `Attribute (a, data) in ignore_spaces c lexbuf; let others, closed = attributes c lexbuf in attribute :: others, closed } and attr_name c = parse | identchar+ { `AttrName (lexeme c) } | '$' { X.parse_dollar_attrname c (loc c) lexbuf } | _ | eof { err EAttributeNameExpected (loc c)} and attr_data c = parse | space* '=' space* ('$' | "$str:") { ignore(buff_contents c) ; X.parse_dollar_attrvalue c (loc c) lexbuf } | space* '=' space* '"' { ignore(buff_contents c) ; `AttrVal(dq_string c lexbuf) } | space* '=' space* '\'' { ignore(buff_contents c) ; `AttrVal(q_string c lexbuf) } | _ | eof { err EAttributeValueExpected (loc c)} and dq_string c = parse | '"' { buff_contents c } | '\\' [ '"' '\\' ] { istore_char c 1; dq_string c lexbuf } | eof { err EUnterminatedString (Loc.of_lexbuf lexbuf) } | _ { istore_char c 0; dq_string c lexbuf } and q_string c = parse | '\'' { buff_contents c } | '\\' [ '\'' '\\' ] { istore_char c 1; q_string c lexbuf } | eof { err EUnterminatedString (Loc.of_lexbuf lexbuf) } | _ { istore_char c 0; q_string c lexbuf } (******************************************************************************) { let lexing_store s buff max = let rec self n s = if n >= max then n else match Stream.peek s with | Some x -> Stream.junk s; buff.[n] <- x; succ n | _ -> n in self 0 s let from_context c = let next _ = let tok = with_curr_loc token c in let loc = Loc.of_lexbuf c.lexbuf in Some ((tok, loc)) in Stream.from next let from_lexbuf lb e = let c = { (default_context lb) with loc = Loc.of_lexbuf lb; entity = e } in from_context c let setup_loc lb loc = let start_pos = Loc.start_pos loc in lb.lex_abs_pos <- start_pos.pos_cnum; lb.lex_curr_p <- start_pos let from_string loc entity str = let lb = Lexing.from_string str in setup_loc lb loc; from_lexbuf lb entity let from_stream loc entity strm = let lb = Lexing.from_function (lexing_store strm) in setup_loc lb loc; from_lexbuf lb entity end } tyxml-2.2.0/syntax/Makefile0000644000000000000000000000313612060404012014034 0ustar0000000000000000include ../Makefile.config -include ../Makefile.local FILES := xmllexer.ml camllexer.ml simplexmlparser.mli pa_tyxml.mli RFILES := basic_types.ml \ simplexmlparser.ml \ xhtmlparser.ml xhtmlsyntax.ml PREDEP := xmllexer.ml camllexer.ml LIBS := -package camlp4 PP := -pp "camlp4of -loc loc" PPR := -pp "camlp4rf -loc loc" OCAMLC := $(OCAMLFIND) ocamlc $(DBG) $(LIBS) OCAMLOPT := $(OCAMLFIND) ocamlopt $(DBG) $(LIBS) OCAMLDEP := $(OCAMLFIND) ocamldep $(LIBS) byte: pa_${LIBNAME}.cmi pa_${LIBNAME}.cmo xmllexer.cmo simplexmlparser.cmo opt:: xmllexer.cmx simplexmlparser.cmx ifeq "${NATDYNLINK}" "yes" opt:: xmllexer.cmxs simplexmlparser.cmxs endif OBJS := xmllexer.cmo basic_types.cmo camllexer.cmo xhtmlparser.cmo xhtmlsyntax.cmo pa_${LIBNAME}.cmo: ${OBJS} $(OCAMLC) -pack -o $@ $^ # Common rules ML := $(filter %.ml,${FILES}) MLI := $(filter %.mli,${FILES}) MLR := $(filter %.ml,${RFILES}) MLIR := $(filter %.mli,${RFILES}) ${MLI:.mli=.cmi}: %.cmi: %.mli $(OCAMLC) $(PP) -c $< ${ML:.ml=.cmo}: %.cmo: %.ml $(OCAMLC) $(PP) -c $< ${ML:.ml=.cmx}: %.cmx: %.ml $(OCAMLOPT) $(PP) -c $< ${MLIR:.mli=.cmi}: %.cmi: %.mli $(OCAMLC) $(PPR) -c $< ${MLR:.ml=.cmo}: %.cmo: %.ml $(OCAMLC) $(PPR) -c $< ${MLR:.ml=.cmx}: %.cmx: %.ml $(OCAMLOPT) $(PPR) -c $< %.ml: %.mll $(OCAMLLEX) $< %.cmxs: %.cmx $(OCAMLOPT) -shared -linkall -o $@ $< # Clean up clean: -rm -f ${PREDEP} -rm -f *.cm[ioax] *.cmxa *.cmxs *.o *.a *.annot distclean: clean -rm -f *~ \#* .\#* # Dependencies depend: ${PREDEP} $(OCAMLDEP) $(PP) ${FILES} > .depend $(OCAMLDEP) $(PPR) ${RFILES} >> .depend FORCE: -include .depend tyxml-2.2.0/syntax/basic_types.ml0000644000000000000000000000236712060404012015240 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2007 Gabriel Kerneis * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) type attr = [ = `Attr of string | `CamlAttr of string ]; type valeur = [ = `Val of string | `CamlVal of string ]; type attribute = [ = `Attribute of (attr * valeur) | `CamlList of string ]; type token = [ Tag of (string * (list attribute) * bool) | PCData of string | Endtag of string | Comment of string | CamlString of string | CamlList of string | CamlExpr of string | Whitespace of string | Eof ]; tyxml-2.2.0/syntax/xhtmlparser.ml0000644000000000000000000002372712060404012015307 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2007 Gabriel Kerneis * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) open Camlp4.PreCast; (* For Camlp4 error handling when parsing xhtml inlined in OCaml code *) module Error = struct type t = Xmllexer.lexing_error; value to_string = Xmllexer.lex_error_to_string; value tloc_to_string x loc = Printf.sprintf "%s (%s)" (to_string x) (Loc.to_string loc); exception E of t; value print ppf e = Format.fprintf ppf "%s" (to_string e); end; module EH = Camlp4.ErrorHandler.Register Error; module LexerArg = struct value error loc e = Loc.Exc_located(loc, Error.E e); type attr_name = [ = `AttrName of string | `CamlAttrName of string ]; type attr_value = [ = `AttrVal of string | `CamlAttrVal of string ]; type attribute = [ = `Attribute of (attr_name * attr_value) | `CamlAttributes of string ]; type token = [ = `Tag of (string * (list attribute) * bool) | `PCData of string | `Endtag of string | `Comment of string | `CamlString of string | `CamlList of string | `CamlExpr of string | `Whitespace of string | `Eof ]; value parse_dollar_attribute = Camllexer.attribute_dollar; value parse_dollar_attrvalue = Camllexer.attr_data_dollar; value parse_dollar_attrname = Camllexer.attr_name_dollar; value parse_dollar_token = Camllexer.token_dollar; end; module type TypedXML = sig value tot: Loc.t -> Ast.expr; value toeltl: Loc.t -> Ast.expr; value to_attrib: Loc.t -> Ast.expr; value to_xmlattribs: Loc.t -> Ast.expr; value make_type: Loc.t -> string -> Ast.ctyp; value make_content_type: Loc.t -> string -> Ast.ctyp; value make_attrib_type: Loc.t -> string -> Ast.ctyp; value make_attribs_type: Loc.t -> string -> Ast.ctyp; value xml_encodedpcdata: Loc.t -> Ast.expr; value xml_pcdata: Loc.t -> Ast.expr; value xml_comment: Loc.t -> Ast.expr; value xml_node: Loc.t -> Ast.expr; value xml_string_attrib: Loc.t -> Ast.expr; end; module Make (Syntax: Camlp4.Sig.Camlp4Syntax with module Loc = Loc and module Ast = Ast) (S : TypedXML) = struct module Xmllexer = Xmllexer.Make(LexerArg); type state = { stream : Stream.t (LexerArg.token * Loc.t) ; stack : Stack.t LexerArg.token; loc : Loc.t ; } ; exception CamlListExc of string ; (* Error report *) module Error = struct type t = [ EndOfTagExpected of string | EOFExpected | NoMoreTagExpected | NoMoreData ] ; exception E of t ; open Format ; value print ppf = fun [ NoMoreData -> fprintf ppf "No more data : empty quotation ?" | EndOfTagExpected tag -> fprintf ppf "Missing end of tag %S" tag | EOFExpected -> fprintf ppf "End of file expected" | NoMoreTagExpected -> fprintf ppf "End of quotation expected" ]; value to_string x = let b = Buffer.create 50 in let () = bprintf b "%a" print x in Buffer.contents b ; end; value err error loc = do { Format.eprintf "Error: %a: %a@." Loc.print loc Error.print error ; raise(Loc.Exc_located(loc, Error.E error)) }; open Error ; (* Stack - the type of s is state *) value pop s = try (Stack.pop s.stack, s) with [Stack.Empty -> let (t,l) = Stream.next s.stream in (t, {stream = s.stream ; stack = s.stack ; loc = l })]; value push t s = Stack.push t s.stack ; value rec expr_of_list loc = fun [ [] -> <:expr< [] >> | [(`Elt a)::l] -> <:expr< [ $a$ :: $expr_of_list loc l$ ] >> | [(`List a)::l] -> <:expr< $a$ @ $expr_of_list loc l$ >> ]; value parse = Xmllexer.from_string ; (* To parse antiquotations *) value get_expr v loc = Syntax.Gram.parse_string Syntax.expr_eoi loc v; (* Nicolas Pouillard 20080218: In the antiquotation $str:s$ of <:expr<...>> the 's' string is supposed to be properly escaped, that's not any OCaml string, that's any litteral OCaml string (some chars between double quote). You should use $str:String.escaped s$ or the shortcut for it $`str:s$. *) (* Convert a stream of tokens into an xhtml tree *) value rec read_node s = let loc = s.loc in match pop s with [ (`PCData s, _) -> <:expr< $S.tot loc$ ($S.xml_encodedpcdata loc$ $str:String.escaped s$) >> | (`CamlString s, _) -> <:expr< $S.tot loc$ ($S.xml_encodedpcdata loc$ $get_expr s loc$) >> | (`CamlList s, _) -> raise (CamlListExc s) | (`CamlExpr s, _) -> get_expr s loc | (`Whitespace s, _) -> <:expr< $S.tot loc$ ($S.xml_pcdata loc$ $str:String.escaped s$) >> | (`Comment s, _) -> <:expr< $S.tot loc$ ($S.xml_comment loc$ $str:String.escaped s$) >> | (`Tag (tag, attlist, closed), s) -> match closed with [ True -> <:expr< ($S.tot loc$ ($S.xml_node loc$ ~a:($S.to_xmlattribs loc$ ($read_attlist s attlist$ :> list $S.make_attribs_type loc tag$)) $str:tag$ []) : $S.make_type loc tag$) >> | False -> let content = <:expr< ($read_elems ~tag s$ :> list $S.make_content_type loc tag$) >> in <:expr< ($S.tot loc$ ($S.xml_node loc$ ~a:($S.to_xmlattribs loc$ ($read_attlist s attlist$ :> list $S.make_attribs_type loc tag$)) $str:tag$ ($S.toeltl loc$ $content$)) : $S.make_type loc tag$) >> ] | ((`Endtag _ | `Eof as t),_) -> do {push t s; raise (E NoMoreData)} ] and read_elems ?tag s = let elems = ref [] in let loc = s.loc in let _ = try while True do { try match (read_node s, elems.val) with [ (* TODO: concaténer les retours à la ligne et $ des PCData en ajoutant : | (PCData c , [(PCData c2) :: q]) -> elems.val := [PCData (Printf.sprintf "%s\n%s" c2 c) :: q] il faut traduire les PCData du pattern matching et de l'expression en leur équivalent Ast.*) (x,l) -> elems.val := [(`Elt x) :: l] ] with [ CamlListExc e -> let l = get_expr e s.loc in elems.val := [ (`List l) :: elems.val ] ] } with [E NoMoreData -> ()] in match pop s with [ (`Endtag s,_) when Some s = tag -> <:expr< $expr_of_list loc (List.rev elems.val) $ >> | (`Eof,_) when tag = None -> <:expr< $expr_of_list loc (List.rev elems.val) $ >> | (t,s) -> match tag with [ None -> err EOFExpected s.loc | Some t -> err (EndOfTagExpected t) s.loc ] ] and read_attlist s = let loc = s.loc in fun [ [] -> <:expr< [] >> | [`Attribute (`AttrName a, `AttrVal v)::l] -> <:expr< [ ($S.to_attrib loc$ ($S.xml_string_attrib loc$ $str:a$ $str:v$) : $S.make_attrib_type loc a$) :: $read_attlist s l$ ] >> | [`Attribute (`CamlAttrName a, `AttrVal v)::l] -> <:expr< [ ($S.to_attrib loc$ ($S.xml_string_attrib loc$ $get_expr a loc$ $str:v$) : $S.make_attrib_type loc a$) :: $read_attlist s l$ ] >> | [`Attribute (`AttrName a, `CamlAttrVal v)::l] -> <:expr< [ ($S.to_attrib loc$ ($S.xml_string_attrib loc$ $str:a$ $get_expr v loc$) : $S.make_attrib_type loc a$) :: $read_attlist s l$ ] >> | [`Attribute (`CamlAttrName a, `CamlAttrVal v)::l] -> <:expr< [ ($S.to_attrib loc$ ($S.xml_string_attrib loc$ $get_expr a loc$ $get_expr v loc$) : $S.make_attrib_type loc a$) :: $read_attlist s l$ ] >> | [`CamlAttributes cl ::l] -> <:expr< [ ($get_expr cl loc$) :: $read_attlist s l$ ] >> ]; (* FIXED ? please report any problem with this function *) (* remove the white spaces at the begining of a stream *) value rec clean_ws s = match Stream.next s.stream with [ (`Whitespace _,l) -> clean_ws {(s) with loc = l } | (t,l) -> let _ = push t s in {(s) with loc = l } ] ; value to_expr stream loc = let s = {stream = stream; stack = Stack.create() ; loc = loc } in try let v = read_node (clean_ws s) in try match pop s with [ (`Eof, _) -> v | (_, s) -> err NoMoreTagExpected s.loc ] with [ _ -> v ] with [E NoMoreData -> err NoMoreData loc]; value to_expr_taglist stream loc = let s = {stream = stream; stack = Stack.create() ; loc = loc } in try <:expr< $read_elems (clean_ws s)$ >> with [E NoMoreData -> err NoMoreData loc]; (* remove the white spaces at the end of a string *) value remove_ws s = let rec end_index i = match s.[i] with ['\n'|'\t'|' '|'\r' -> end_index (i-1) |_ -> i] in let sub i j = String.sub s i ( j - i + 1) in try sub 0 (end_index (String.length s - 1)) with [Invalid_argument _ -> ""]; value xml_exp loc (x : option string) s = to_expr (parse loc False (remove_ws s)) loc; value xml_expl loc (x : option string) s = to_expr_taglist (parse loc False (remove_ws s)) loc; end ; tyxml-2.2.0/syntax/simplexmlparser.mli0000644000000000000000000000211612060404012016323 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2005 Vincent Balat * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (** Basic camlp4 parser for xml *) type xml = | Element of (string * ((string * string) list) * (xml list)) | PCData of string exception Xml_parser_error of string val xmlparser_string : string -> xml list val xmlparser_file : string -> xml list tyxml-2.2.0/syntax/simplexmlparser.ml0000644000000000000000000001161512060404012016156 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2007 Gabriel Kerneis * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (* Parseur camlp4 pour XML sans antiquotations *) open Camlp4.PreCast; type xml = [ Element of (string * (list (string * string)) * (list xml)) | PCData of string ]; exception Xml_parser_error of string ; (* We raise this error when parsing Ocsigen configuration files. *) exception ParseException of (Xmllexer.lexing_error * Camlp4.PreCast.Loc.t) ; value parse_error_to_string x loc = Printf.sprintf "%s (%s)" (Xmllexer.lex_error_to_string x) (Loc.to_string loc); module LexerArg = struct value error loc e = ParseException (e, loc); type attr_name = [ = `AttrName of string ]; type attr_value = [ = `AttrVal of string ]; type attribute = [ = `Attribute of (attr_name * attr_value) ]; type token = [ = `Tag of (string * (list attribute) * bool) | `PCData of string | `Endtag of string | `Comment of string | `Whitespace of string | `Eof ]; value parse_dollar_attrname c loc lexbuf = raise (ParseException (Xmllexer.EAttributeNameExpected, loc)); value parse_dollar_attribute c loc lexbuf = raise (ParseException (Xmllexer.EAttributeValueExpected, loc)); value parse_dollar_attrvalue = parse_dollar_attrname; value parse_dollar_token c lexbuf = `PCData "$"; end; module Xmllexer = Xmllexer.Make (LexerArg); type state = { stream : Stream.t (LexerArg.token * Loc.t); stack : Stack.t LexerArg.token; loc : Loc.t }; type error_msg = [ EndOfTagExpected of string | EOFExpected ]; exception Internal_error of error_msg; (* Stack - the type of s is state *) value pop s = try ((Stack.pop s.stack), s) with [ Stack.Empty -> let (t, l) = Stream.next s.stream in (t, { stream = s.stream; stack = s.stack; loc = l; }) ]; value push t s = Stack.push t s.stack; (* Convert a stream of tokens into an xml tree list *) value rec read_nodes s acc = match pop s with [ (`Comment _, s) -> read_nodes s acc | (`Whitespace _, s) -> read_nodes s acc | (`PCData pcdata, s) -> read_nodes s [(PCData pcdata)::acc] | (`Tag ("xi:include", [`Attribute (`AttrName "href", `AttrVal v)], True), s)-> let l = rawxmlparser_file v in let acc = List.rev_append l acc in read_nodes s acc | (`Tag ("xi:include", _, _), s) -> raise (Xml_parser_error "Invalid syntax for inclusion directive") | (`Tag (tag, attlist, closed), s) -> match closed with [ True -> read_nodes s [Element (tag, (read_attlist attlist), [])::acc] | False ->read_nodes s [Element (tag, (read_attlist attlist), (read_elems ~tag s))::acc] ] | (`Eof, _)|(`Endtag _,_) as t -> do { push (fst t) s; List.rev acc} ] and read_elems ?tag s = let elems = read_nodes s [] in match pop s with [ (`Endtag s, _) when (Some s) = tag -> elems | (`Eof, _) when tag = None -> elems | (t, loc) -> match tag with [ None -> raise (Internal_error EOFExpected) | Some s -> raise (Internal_error (EndOfTagExpected s)) ] ] and read_attlist = List.map (fun [`Attribute (`AttrName a, `AttrVal v) -> (a,v)]) and to_expr_taglist stream loc = let s = { stream = stream; stack = Stack.create (); loc = loc; } in read_nodes s [] and rawxmlparser_file s = let chan = open_in s in try let loc = Loc.mk s in let tree = to_expr_taglist (Xmllexer.from_stream loc True (Stream.of_channel chan)) loc in do { close_in chan; tree } with [ e -> do { close_in chan; match e with [ Sys_error s -> raise (Xml_parser_error s) | _ -> raise e ] } ] and rawxmlparser_string s = let loc = Loc.ghost in to_expr_taglist (Xmllexer.from_string loc True s) loc; value xmlparser rawxmlparser s = try (rawxmlparser s) with [ ParseException (e, loc) -> raise (Xml_parser_error (parse_error_to_string e loc)) | Internal_error EOFExpected -> raise (Xml_parser_error "EOF expected") | Internal_error (EndOfTagExpected s) -> raise (Xml_parser_error ("End of tag expected: "^s))] ; value xmlparser_file = xmlparser rawxmlparser_file; value xmlparser_string = xmlparser rawxmlparser_string; tyxml-2.2.0/syntax/xhtmlsyntax.ml0000644000000000000000000003546512060404012015343 0ustar0000000000000000(* Ocsigen * Copyright (C) 2005 Vincent Balat * Copyright (C) 2007 Gabriel Kerneis * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *) (* Syntax extension for xml *) open Xhtmlparser; open Camlp4.PreCast; module Parser = Xhtmlparser.Make(Syntax)(struct value xml_encodedpcdata loc = <:expr< Xhtml.Xml.encodedpcdata >>; value xml_pcdata loc = <:expr< Xhtml.Xml.pcdata >>; value xml_comment loc = <:expr< Xhtml.Xml.comment >>; value xml_node loc = <:expr< Xhtml.Xml.node >>; value xml_string_attrib loc = <:expr< Xhtml.Xml.string_attrib >>; value tot loc = <:expr< Xhtml.tot >>; value toeltl loc = <:expr< Xhtml.toeltl >>; value to_xmlattribs loc = <:expr< Xhtml.to_xmlattribs >>; value to_attrib loc = <:expr< Xhtml.to_attrib >>; value make_type loc tag = <:ctyp< Xhtml.elt [> `$uid:String.capitalize tag$ ] >>; value make_content_type loc tag = <:ctyp< Xhtml.elt [< Xhtml_types.$lid:String.lowercase tag^"_content"$] >>; value make_attrib_type loc tag = let tag = match String.lowercase tag with [ "button_type" -> "Button_Type" | "fs_cols" -> "FS_Cols" | "fs_rows" -> "FS_Rows" | "input_type" -> "Input_Type" | "onblur" -> "OnBlur" | "onchange" -> "OnChange" | "onclick" -> "OnClick" | "ondblclick" -> "OnDblClick" | "onfocus" -> "OnFocus" | "onkeydown" -> "OnKeyDown" | "onkeypress" -> "OnKeyPress" | "onkeyup" -> "OnKeyUp" | "onload" -> "OnLoad" | "onmousedown" -> "OnMouseDown" | "onmousemove" -> "OnMouseMove" | "onmouseout" -> "OnMouseOut" | "onmouseover" -> "OnMouseOver" | "onmouseup" -> "OnMouseUp" | "onreset" -> "OnReset" | "onselect" -> "OnSelect" | "onsubmit" -> "OnSubmit" | "onunload" -> "OnUnload" | "style_attr" -> "Style_Attr" | "value_type" -> "Value_Type" | "xml_lang" -> "XML_lang" | "xml_space" -> "XML_space" | "xmlns" -> "XMLns" | tag -> String.capitalize tag ] in <:ctyp< Xhtml.attrib [> `$uid:tag$ ] >>; value make_attribs_type loc tag = <:ctyp< Xhtml.attrib [< Xhtml_types.$lid:String.lowercase tag^"_attrib"$] >>; end); module Parser5 = Xhtmlparser.Make(Syntax)(struct value xml_encodedpcdata loc = <:expr< Html5.Xml.encodedpcdata >>; value xml_pcdata loc = <:expr< Html5.Xml.pcdata >>; value xml_comment loc = <:expr< Html5.Xml.comment >>; value xml_node loc = <:expr< Html5.Xml.node >>; value xml_string_attrib loc = <:expr< Html5.Xml.string_attrib >>; value tot loc = <:expr< Html5.tot >>; value toeltl loc = <:expr< Html5.toeltl >>; value to_xmlattribs loc = <:expr< Html5.to_xmlattribs >>; value to_attrib loc = <:expr< Html5.to_attrib >>; value make_type loc tag = let tag = match String.lowercase tag with [ "object" -> "object__" | "option" -> "selectoption" | "audio" -> "audio_" | "video" -> "video_" | "canvas" -> "canvas_" | "map" -> "map_" | "ins" -> "ins_" | "ins_" -> "del_" | x -> x ] in match tag with [ "a" -> <:ctyp< Html5.elt [> Html5_types.a 'a ] >> | tag -> <:ctyp< Html5.elt [> Html5_types.$lid:tag$ ] >> ]; value make_content_type loc tag = <:ctyp< Html5.elt [< Html5_types.$lid:String.lowercase tag^"_content"$] >>; value make_attrib_type loc tag = let tag = match String.lowercase tag with [ "button_type" -> "Button_Type" | "command_type" -> "Command_Type" | "float_value" -> "Float_Value" | "for_list" -> "For_List" | "input_max" -> "Input_Max" | "input_min" -> "Input_Min" | "input_type" -> "Input_Type" | "int_value" -> "Int_Value" | "menu_type" -> "Menu_Type" | "readonly" -> "ReadOnly" | "style_attr" -> "Style_Attr" | "text_value" -> "Text_Value" | "xml_lang" -> "XML_lang" | "onabort" -> "OnAbort" | "onafterprint" -> "OnAfterPrint" | "onbeforeprint" -> "OnBeforePrint" | "onblur" -> "OnBlur" | "oncanplay" -> "OnCanPlay" | "oncanplaythrough" -> "OnCanPlayThrough" | "onchange" -> "OnChange" | "onclick" -> "OnClick" | "oncontextmenu" -> "OnContextMenu" | "ondblclick" -> "OnDblClick" | "ondrag" -> "OnDrag" | "ondragend" -> "OnDragEnd" | "ondragenter" -> "OnDragEnter" | "ondragleave" -> "OnDragLeave" | "ondragover" -> "OnDragOver" | "ondragstart" -> "OnDragStart" | "ondrop" -> "OnDrop" | "ondurationchange" -> "OnDurationChange" | "onemptied" -> "OnEmptied" | "onended" -> "OnEnded" | "onerror" -> "OnError" | "onfocus" -> "OnFocus" | "onformchange" -> "OnFormChange" | "onforminput" -> "OnFormInput" | "onhashchange" -> "OnHashChange" | "oninput" -> "OnInput" | "oninvalid" -> "OnInvalid" | "onkeydown" -> "OnKeyDown" | "onkeypress" -> "OnKeyPress" | "onkeyup" -> "OnKeyUp" | "onload" -> "OnLoad" | "onloadstart" -> "OnLoadStart" | "onloadeddata" -> "OnLoadedData" | "onloadedmetadata" -> "OnLoadedMetaData" | "onmessage" -> "OnMessage" | "onmousedown" -> "OnMouseDown" | "onmousemove" -> "OnMouseMove" | "onmouseout" -> "OnMouseOut" | "onmouseover" -> "OnMouseOver" | "onmouseup" -> "OnMouseUp" | "onmousewheel" -> "OnMouseWheel" | "onoffline" -> "OnOffLine" | "ononline" -> "OnOnLine" | "onpagehide" -> "OnPageHide" | "onpageshow" -> "OnPageShow" | "onpause" -> "OnPause" | "onplay" -> "OnPlay" | "onplaying" -> "OnPlaying" | "onpopstate" -> "OnPopState" | "onprogress" -> "OnProgress" | "onratechange" -> "OnRateChange" | "onreadystatechange" -> "OnReadyStateChange" | "onredo" -> "OnRedo" | "onresize" -> "OnResize" | "onscroll" -> "OnScroll" | "onseeked" -> "OnSeeked" | "onseeking" -> "OnSeeking" | "onselect" -> "OnSelect" | "onshow" -> "OnShow" | "onstalled" -> "OnStalled" | "onstorage" -> "OnStorage" | "onsubmit" -> "OnSubmit" | "onsuspend" -> "OnSuspend" | "ontimeupdate" -> "OnTimeUpdate" | "onundo" -> "OnUndo" | "onunload" -> "OnUnload" | "onvolumechange" -> "OnVolumeChange" | "onwaiting" -> "OnWaiting" | "onebeforeunload" -> "OneBeforeUnload" | tag -> String.capitalize tag ] in <:ctyp< Html5.attrib [> `$uid:tag$ ] >>; value make_attribs_type loc tag = <:ctyp< Html5.attrib [< Html5_types.$lid:String.lowercase tag^"_attrib"$] >>; end); module ParserSvg = Xhtmlparser.Make(Syntax)(struct value xml_encodedpcdata loc = <:expr< Svg.Xml.encodedpcdata >>; value xml_pcdata loc = <:expr< Svg.Xml.pcdata >>; value xml_comment loc = <:expr< Svg.Xml.comment >>; value xml_node loc = <:expr< Svg.Xml.node >>; value xml_string_attrib loc = <:expr< Svg.Xml.string_attrib >>; value tot loc = <:expr< Svg.tot >>; value toeltl loc = <:expr< Svg.toeltl >>; value to_xmlattribs loc = <:expr< Svg.to_xmlattribs >>; value to_attrib loc = <:expr< Svg.to_attrib >>; value make_type loc tag = <:ctyp< Svg.elt [> `$uid:String.capitalize tag$ ] >>; value make_content_type loc tag = <:ctyp< Svg.elt [< Svg_types.$lid:String.lowercase tag^"_content"$] >>; value make_attrib_type loc tag = let tag = match String.lowercase tag with [ "accent___height" -> "Accent___Height" | "alignement_baseline" -> "Alignement_Baseline" | "altglyph" -> "AltGlyph" | "animatecolor" -> "AnimateColor" | "arabic___form" -> "Arabic___Form" | "attributename" -> "AttributeName" | "attributetype" -> "AttributeType" | "basefrequency" -> "BaseFrequency" | "baseline_shift" -> "Baseline_Shift" | "baseprofile" -> "BaseProfile" | "calcmode" -> "CalcMode" | "cap___height" -> "Cap___Height" | "clip_path" -> "Clip_Path" | "clippathunits" -> "ClipPathUnits" | "clip_rule" -> "Clip_Rule" | "color_interpolation" -> "Color_Interpolation" | "contentscripttype" -> "ContentScriptType" | "contentstyletype" -> "ContentStyleType" | "diffuseconstant" -> "DiffuseConstant" | "edgemode" -> "EdgeMode" | "externalresourcesrequired" -> "ExternalResourcesRequired" | "filterres" -> "FilterRes" | "filterunits" -> "FilterUnits" | "flood_color" -> "Flood_Color" | "flood_opacity" -> "Flood_Opacity" | "font_face" -> "Font_Face" | "font_family" -> "Font_Family" | "font___family" -> "Font___Family" | "font_size" -> "Font_Size" | "font___size" -> "Font___Size" | "font_size_adjust" -> "Font_Size_Adjust" | "font_stretch" -> "Font_Stretch" | "font___stretch" -> "Font___Stretch" | "font_style" -> "Font_Style" | "font___style" -> "Font___Style" | "font_variant" -> "Font_Variant" | "font___variant" -> "Font___Variant" | "font_weight" -> "Font_Weight" | "font___weight" -> "Font___Weight" | "glyph___name" -> "Glyph___Name" | "glyph_orientation_horizontal" -> "Glyph_Orientation_Horizontal" | "glyph_orientation_vertical" -> "Glyph_Orientation_Vertical" | "glyphref" -> "GlyphRef" | "gradienttransform" -> "GradientTransform" | "gradientunits" -> "GradientUnits" | "horiz___adv___x" -> "Horiz___Adv___X" | "horiz___origin___x" -> "Horiz___Origin___X" | "horiz___origin___y" -> "Horiz___Origin___Y" | "image_rendering" -> "Image_Rendering" | "kernelmatrix" -> "KernelMatrix" | "kernelunitlength" -> "KernelUnitLength" | "keypoints" -> "KeyPoints" | "keysplines" -> "KeySplines" | "keytimes" -> "KeyTimes" | "lengthadjust" -> "LengthAdjust" | "letter_spacing" -> "Letter_Spacing" | "lighting_color" -> "Lighting_Color" | "limitingconeangle" -> "LimitingConeAngle" | "marker_end" -> "Marker_End" | "markerheight" -> "MarkerHeight" | "marker_mid" -> "Marker_Mid" | "marker_start" -> "Marker_Start" | "markerunits" -> "MarkerUnits" | "markerwidth" -> "MarkerWidth" | "maskcontentunits" -> "MaskContentUnits" | "maskunits" -> "MaskUnits" | "missingglyph" -> "MissingGlyph" | "numoctaves" -> "NumOctaves" | "offset__transfer" -> "Offset__transfer" | "onabort" -> "OnAbort" | "onactivate" -> "OnActivate" | "onbegin" -> "OnBegin" | "onclick" -> "OnClick" | "onend" -> "OnEnd" | "onerror" -> "OnError" | "onfocusin" -> "OnFocusIn" | "onfocusout" -> "OnFocusOut" | "onload" -> "OnLoad" | "onmousedown" -> "OnMouseDown" | "onmouseout" -> "OnMouseOut" | "onmouseover" -> "OnMouseOver" | "onmouseup" -> "OnMouseUp" | "onrepeat" -> "OnRepeat" | "onresize" -> "OnResize" | "onscroll" -> "OnScroll" | "onunload" -> "OnUnload" | "onzoom" -> "OnZoom" | "overline___position" -> "Overline___Position" | "overline___thickness" -> "Overline___Thickness" | "pathlength" -> "PathLength" | "patterncontentunits" -> "PatternContentUnits" | "patterntransform" -> "PatternTransform" | "patternunits" -> "PatternUnits" | "pointer_events" -> "Pointer_Events" | "pointsatx" -> "PointsAtX" | "pointsaty" -> "PointsAtY" | "pointsatz" -> "PointsAtZ" | "preservealpha" -> "PreserveAlpha" | "preserveaspectradio" -> "PreserveAspectRadio" | "preserveaspectratio" -> "PreserveAspectRatio" | "primitiveunits" -> "PrimitiveUnits" | "refx" -> "RefX" | "refy" -> "RefY" | "rendering_intent" -> "Rendering_Intent" | "repeatcount" -> "RepeatCount" | "repeatdur" -> "RepeatDur" | "requiredextensions" -> "RequiredExtensions" | "requiredfeatures" -> "RequiredFeatures" | "shape_rendering" -> "Shape_Rendering" | "specularconstant" -> "SpecularConstant" | "specularexponent" -> "SpecularExponent" | "spreadmethod" -> "SpreadMethod" | "stddeviation" -> "StdDeviation" | "stitchtiles" -> "StitchTiles" | "stop_color" -> "Stop_Color" | "stop_opacity" -> "Stop_Opacity" | "strikethrough___position" -> "Strikethrough___Position" | "strikethrough___thickness" -> "Strikethrough___Thickness" | "stroke_dasharray" -> "Stroke_Dasharray" | "stroke_dashoffset" -> "Stroke_Dashoffset" | "stroke_linecap" -> "Stroke_Linecap" | "stroke_linejoin" -> "Stroke_Linejoin" | "stroke_miterlimit" -> "Stroke_Miterlimit" | "stroke_opacity" -> "Stroke_Opacity" | "stroke_width" -> "Stroke_Width" | "surfacescale" -> "SurfaceScale" | "systemlanguage" -> "SystemLanguage" | "tablevalues" -> "TableValues" | "targetx" -> "TargetX" | "targety" -> "TargetY" | "text_anchor" -> "Text_Anchor" | "text_decoration" -> "Text_Decoration" | "textlength" -> "TextLength" | "text_rendering" -> "Text_Rendering" | "underline___position" -> "Underline___Position" | "underline___thickness" -> "Underline___Thickness" | "unicode_bidi" -> "Unicode_Bidi" | "unicode___range" -> "Unicode___Range" | "units___per___em" -> "Units___Per___Em" | "v___alphabetic" -> "V___Alphabetic" | "vert___adv___y" -> "Vert___Adv___Y" | "vert___origin___x" -> "Vert___Origin___X" | "vert___origin___y" -> "Vert___Origin___Y" | "v___hanging" -> "V___Hanging" | "v___ideographic" -> "V___Ideographic" | "viewbox" -> "ViewBox" | "viewtarget" -> "ViewTarget" | "v___mathematical" -> "V___Mathematical" | "word_spacing" -> "Word_Spacing" | "writing_mode" -> "Writing_Mode" | "xchannelselector" -> "XChannelSelector" | "x___height" -> "X___Height" | "ychannelselector" -> "YChannelSelector" | "zoomandpan" -> "ZoomAndPan" | "zoomandplan" -> "ZoomAndPlan" | tag -> String.capitalize tag ] in <:ctyp< Svg.attrib [> `$uid:tag$ ] >>; value make_attribs_type loc tag = <:ctyp< Svg.attrib [< Svg_types.$lid:String.lowercase tag^"_attrib"$] >>; end); do { Syntax.Quotation.add "xhtml" Syntax.Quotation.DynAst.expr_tag Parser.xml_exp ; Syntax.Quotation.add "xhtmllist" Syntax.Quotation.DynAst.expr_tag Parser.xml_expl; Syntax.Quotation.add "html5" Syntax.Quotation.DynAst.expr_tag Parser5.xml_exp ; Syntax.Quotation.add "html5list" Syntax.Quotation.DynAst.expr_tag Parser5.xml_expl; Syntax.Quotation.default.val := "html5"; Syntax.Quotation.add "svg" Syntax.Quotation.DynAst.expr_tag ParserSvg.xml_exp ; Syntax.Quotation.add "svglist" Syntax.Quotation.DynAst.expr_tag ParserSvg.xml_expl }; tyxml-2.2.0/syntax/camllexer.mll0000644000000000000000000000356112060404012015060 0ustar0000000000000000(* TyXML * http://www.ocsigen.org/tyxml * Copyright (C) 2007 Gabriel Kerneis * Copyright (C) 2009 Boris Yakobowski * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, with linking exception; * either version 2.1 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02111-1307, USA. *) (* This is the complementary parser to Xmllexer, used in mode Xhtml with inline Ocaml code. The rules below are used to parse subexpressions starting with '$' *) { open Xmllexer } let camlidentchar = [^ '$' ] let newline = ['\n'] rule camlident c = parse | newline { update_loc c 1 false 0 ; store c ; camlident c lexbuf } | camlidentchar+ { store c ; camlident c lexbuf } | '$' { buff_contents c } and token_dollar c = parse |"str:" { `CamlString (camlident c lexbuf) } |"list:" { `CamlList (camlident c lexbuf) } | "$" { `PCData "$" } | "" { `CamlExpr (camlident c lexbuf) } and attribute_dollar c loc = parse | "" { ignore (buff_contents c); `CamlAttributes (camlident c lexbuf) } and attr_name_dollar c loc = parse | "" { ignore (buff_contents c) ; `CamlAttrName (camlident c lexbuf) } and attr_data_dollar c loc = parse | "" { `CamlAttrVal (camlident c lexbuf) } tyxml-2.2.0/syntax/.depend0000644000000000000000000000063712060404012013637 0ustar0000000000000000xmllexer.cmo: xmllexer.cmx: camllexer.cmo: xmllexer.cmo camllexer.cmx: xmllexer.cmx simplexmlparser.cmi: pa_tyxml.cmi: basic_types.cmo: basic_types.cmx: simplexmlparser.cmo: xmllexer.cmo simplexmlparser.cmi simplexmlparser.cmx: xmllexer.cmx simplexmlparser.cmi xhtmlparser.cmo: xmllexer.cmo camllexer.cmo xhtmlparser.cmx: xmllexer.cmx camllexer.cmx xhtmlsyntax.cmo: xhtmlparser.cmo xhtmlsyntax.cmx: xhtmlparser.cmx tyxml-2.2.0/doc/0000755000000000000000000000000012060404012011610 5ustar0000000000000000tyxml-2.2.0/doc/Makefile0000644000000000000000000000141512060404012013251 0ustar0000000000000000include ../Makefile.config include ../Makefile.filelist LIB := -I ../lib -I ../syntax ifeq "${OCAMLDUCE}" "yes" OCAMLDOC := ${OCAMLDUCEFIND} ocamldoc -package ocamlduce ODOC_WIKI := odoc_duce_wiki.cma else OCAMLDOC := ${OCAMLFIND} ocamldoc ODOC_WIKI := odoc_wiki.cma endif doc: api-html/index.html api-html/index.html: indexdoc $(addprefix ../,${DOC}) mkdir -p api-html $(OCAMLDOC) ${LIB} -d api-html -intro indexdoc -html $(addprefix ../,${DOC}) docwiki: api-wiki/index.wiki api-wiki/index.wiki: indexdoc $(addprefix ../,${DOC}) mkdir -p api-wiki $(OCAMLDOC) ${LIB} -d api-wiki -intro indexdoc -colorize-code \ -i $(shell ocamlfind query wikidoc) -g ${ODOC_WIKI} \ $(addprefix ../,${DOC}) clean: -rm -f api-html/* api-wiki/* distclean: clean -rm -f *~ \#* .\#* tyxml-2.2.0/doc/indexdoc0000644000000000000000000000103412060404012013326 0ustar0000000000000000{1 TyXML – API reference } {2 Building valid XML tree } {!modules: Xhtml Svg Html5 } {2 Common DTD's transcriptions} {!modules: Xhtml_types Svg_types Html5_types } {2 Low-level XML manipulation} {!modules: Xml } {2 Functorial interface } {!modules: Xhtml_f Svg_f Html5_f Xml_iter Xml_print } {2 OCamlduce} {3 Common DTD's transcriptions} {!modules: Xhtml_types_duce } {3 Helpers} {!modules: Xml_print_duce Xhtml_duce } {2 Syntax extension and simple parser} {!modules: Pa_tyxml Simplexmlparser } {2 Indexes} {!indexlist} tyxml-2.2.0/doc/api-html/0000755000000000000000000000000012060404012013323 5ustar0000000000000000tyxml-2.2.0/doc/manual-wiki/0000755000000000000000000000000012060404012014026 5ustar0000000000000000tyxml-2.2.0/doc/manual-wiki/intro.wiki0000644000000000000000000000210512060404012016044 0ustar0000000000000000TyXML allows you to build XML trees whose validity is ensured by the typechecker. It's based on a traduction of XML types into polymorphic variants, originally written by Thorsten Ohl. Currently, the transcription has been done for XHTML 1.0 and 1.1, HTML5 and SVG (partial). TyXML also provides a generic printer and some low-level (and untyped) iterators over XML trees. The printer has options for printing XHTML in more browser-friendly way when served as {{{"text/html"}}} (instead of {{{"text/xml"}}}). HTML5 is always printed with those options. All modules provided by TyXML are also provided in functorial interface, where every module is parameterised by the underlying XML representation. A camlp4 extension, named <>, allows to write HTML pages or HTML fragments with the usual syntax. For creating HTML5-, XHTML-, or SVG-nodes, the syntax extension relies on the presence of a module called ##Html5##, ##Xhtml##, or ##Svg## which keeps the actual implementation, e.g. {{{ let module Html5 = Eliom_content.Html5.F in <:html5<
xyz
>> }}} tyxml-2.2.0/doc/manual-wiki/menu.wiki0000644000000000000000000000005312060404012015655 0ustar0000000000000000=TyXML – Manual ==[[intro|Introduction]] tyxml-2.2.0/files/0000755000000000000000000000000012060404012012145 5ustar0000000000000000tyxml-2.2.0/files/META.in0000644000000000000000000000233612060404012013227 0ustar0000000000000000_LIBDIR_ description = "XHTML and HTML5 pages typed with polymorphic variants" version = "dev" requires = "netstring" archive(byte) = "_LIBNAME_.cma" archive(native) = "_LIBNAME_.cmxa" package "functor" ( description = "XHTML and HTML5 pages typed with polymorphic variants (Functor version)" version = "(distributed with _PACKAGENAME_)" archive(byte) = "_LIBNAME__f.cma" archive(native) = "_LIBNAME__f.cmxa" ) package "syntax" ( _SYNTAXDIR_ description = "XHTML and HTML5 syntax extension" version = "(distributed with _PACKAGENAME_)" requires(toploop) = "_PACKAGENAME_" archive(syntax,preprocessor) = "pa__LIBNAME_.cmo" archive(syntax,toploop) = "pa__LIBNAME_.cmo" ) package "parser" ( _SYNTAXDIR_ description = "Simple XML parser" requires = "camlp4.lib" version = "(distributed with _PACKAGENAME_)" archive(byte) = "xmllexer.cmo simplexmlparser.cmo" archive(native) = "xmllexer.cmx simplexmlparser.cmx" ) package "duce" ( exists_if = "_LIBNAME__duce.cma" description = "XHTML types for ocamlduce" requires = "ocamlduce,_PACKAGENAME_" version = "(distributed with _PACKAGENAME_)" archive(byte) = "_LIBNAME__duce.cma" archive(native) = "_LIBNAME__duce.cmxa" )