Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /smlnj-lib/trunk/XML/generic-xml-tree.sml
ViewVC logotype

View of /smlnj-lib/trunk/XML/generic-xml-tree.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 3875 - (download) (annotate)
Thu Mar 27 15:57:14 2014 UTC (5 years, 4 months ago) by jhr
File size: 1047 byte(s)
  Normalize element names to uppercase.
(* generic-xml-tree.sml
 * COPYRIGHT (c) 2013 The Fellowship of SML/NJ (http://www.smlnj.org)
 * All rights reserved.
 * This is a generic instantiation of the XMLTreeFn with a representation of
 * elements and attributes as Atom.atom values.  It does not preserve whitespace.

structure GenericXMLTree =
      structure Schema =

	  type element = Atom.atom
	  type attribute = (Atom.atom * string)

	(* create an element; returns NONE if the element name is unrecognized *)
	  fun element s = SOME(Atom.atom(CharVector.map Char.toUpper s))

	(* should leading and trailing whitespace be preserved in the content of this element? *)
	  fun preserveWS _ = false

	(* should comments be preserved *)
	  fun preserveComment _ = false

	(* equality test *)
	  val same = Atom.same

	  val toString = Atom.toString

	(* create an attribute from a name/value pair *)
	  fun attribute (id, value) = (Atom.atom id, value)

      structure Tree = XMLTreeFn (Schema)
    open Tree
    end (* local *)

ViewVC Help
Powered by ViewVC 1.0.0