1ElementTree.elementTree(3kaya)Kaya module referencEelementTree.elementTree(3kaya)
2
3
4

NAME

6       ElementTree::elementTree - Converts a String to an ElementTree.
7

SYNOPSIS

9       ElementTree  elementTree(  String  original, String rootelement="tree",
10       Dict<String, [String]>  whitelist=Dict::new(2,  strHash),  Dict<String,
11       [String]>   implicitend=Dict::new(2,  strHash),  [String] emptyels=cre‐
12       ateArray(1), Dict<String, ElementTree([Pair<String, String>  ])>   tem‐
13       plates=Dict::new(2,    strHash),    Bool    casesensitive=false,   Bool
14       sloppy=false, Bool lazytemplates=true )
15

ARGUMENTS

17       original The String to convert
18
19       rootelement The name of the root element to use as a parent.  Optional,
20       defaulting to "tree".
21
22       whitelist  A  whitelist  dictionary of allowed elements. The key is the
23       element name, the value is a list of allowed attribute names  for  that
24       element.  If  the  key is "*" then all elements are allowed (though you
25       may wish to explicitly specify others to override the attributes speci‐
26       fied  for  "*"). If the value list contains "*" then all attributes are
27       allowed. Optional, defaulting to the empty dictionary, which makes this
28       function strip all tags from the string as it imports it.
29
30       implicitend  A  dictionary of tags that close elements other than their
31       own. In XML, this should be an empty dictionary - it is used  to  parse
32       HTML  and  other  SGML dialects that allow implicit closing. The key is
33       the element to close, and the value is a list of tags that  will  close
34       that  element,  represented as "tagname" for an opening tag, and "/tag‐
35       name" for a closing tag. For example, the implicit ending list for  the
36       "li" element in HTML is ["li","/ul","/ol"]
37        This  is  optional and defaults to the empty dictionary, which is cor‐
38       rect for XML strings.
39
40       emptyels A list of elements that are allowed to be empty (i.e.  a  sin‐
41       gleton  tag  such  as  <br>  is  allowed).  This is very important when
42       importing HTML or other SGML dialects where a singleton tag  might  not
43       differ  in  appearance  from a normal opening tag. This is optional and
44       defaults to the empty list.  When  processing  XML,  this  list  should
45       always be empty, as it is never ambiguous.
46
47       templates  A dictionary of elements that are really calls to templating
48       functions. The key is the element name, and the  value  is  a  function
49       that takes a list of pairs of attributes and returns an ElementTree
50        This  can  be  used  for templating, or for converting one form of XML
51       into another. This is optional and defaults to the empty dictionary.
52
53       casesensitive Should conversion be case-sensitive? If  this  is  false,
54       all  whitelist  ,  implicitend , emptyels and templates keys and values
55       will be treated as case-insensitive, and all elements will be converted
56       to  lowercase. In XML, this should be set to true, which will give some
57       increase in processing  speed.  This  parameter  is  optional  and  the
58       default value is false.
59
60       sloppy  Use  'sloppy'  processing,  which attempts to make a reasonable
61       guess at the meaning of broken input. It may guess entirely wrongly, of
62       course,  and  in  some  circumstances  it may still throw an Exception.
63       Optional, defaulting to false (where it should be left  if  possible!).
64       This argument is ignored if the templates dictionary has any contents.
65
66       lazytemplates Evaluate templates lazily. Enabling this will reduce mem‐
67       ory usage, especially in complex nested templates, but may cause  prob‐
68       lems  if  the  templates have side effects or use global variables. Set
69       this option to false to evaluate templates immediately.  This  argument
70       is optional and defaults to true
71
72

DESCRIPTION

74       Converts  a String to an ElementTree. Several additional parameters may
75       be passed to control various aspects of the conversion.
76

AUTHORS

78       Kaya  standard  library  by  Edwin  Brady,  Chris  Morris  and   others
79       (kaya@kayalang.org). For further information see http://kayalang.org/
80

LICENSE

82       The  Kaya  standard  library  is free software; you can redistribute it
83       and/or modify it under the terms  of  the  GNU  Lesser  General  Public
84       License  (version  2.1  or  any later version) as published by the Free
85       Software Foundation.
86
88       ElementTree.string (3kaya)
89
90
91
92Kaya                             December 2010  ElementTree.elementTree(3kaya)
Impressum