-
html_to_ascii (sequence)
converts an HTML string to an ASCII string
Params:
-
sequence s
string to convert
Return:
sequence
Example:
s = html_to_ascii("<tag string="élégant" />")
s is "<tag string="élégant" />"
See also:
html_to_utf8(), ascii_to_html(), utf8_to_html()
-
ascii_to_html (sequence)
converts an ASCII string to an HTML string
Params:
-
sequence s
string to convert
Example:
s = ascii_to_html("<tag string="élégant" />")
s is <tag string="élégant" />
See also:
html_to_ascii(), html_to_utf8(), utf8_to_html()
-
html_to_utf8 (sequence)
converts an HTML string to an UTF-8 string
Params:
-
sequence s
string to convert
Example:
s = html_to_utf8("<tag string="élégant" />")
s is "<tag string="ÃlÃgant" />" (ascii)
s is "<tag string="élégant" />" (utf-8)
See also:
html_to_ascii(), ascii_to_html(), utf8_to_html()
-
utf8_to_html (sequence)
converts an UTF-8 string to an HTML string
Params:
-
sequence s
string to convert
Example:
s2 = "<tag string="ÃlÃgant" />" (ascii)
s2 = "<tag string="élégant" />" (utf-8)
s = utf8_to_html(s2)
s is <tag string="élégant" />
See also:
html_to_ascii(), html_to_utf8(), ascii_to_html()
-
encode_url (sequence, sequence)
encodes and URL
Params:
Example:
request = "https://www.google.fr/search?q=élégant"
s = encode_url(request, {})
s is https%3A%2F%2Fwww%2Egoogle%2Efr%2Fsearch%3Fq%3D%E9l%E9gant
s = encode_url(request, {{"utf8",1}})
s is https%3A%2F%2Fwww%2Egoogle%2Efr%2Fsearch%3Fq%3D%C3%A9l%C3%A9gant
See also:
decode_url()
-
decode_url (sequence, sequence)
decodes an URL
Params:
Example:
s = https%3A%2F%2Fwww%2Egoogle%2Efr%2Fsearch%3Fq%3D%E9l%E9gant
s2 = decode_url(s, {})
s2 is https://www.google.fr/search?q=élégant
s = https%3A%2F%2Fwww%2Egoogle%2Efr%2Fsearch%3Fq%3D%C3%A9l%C3%A9gant
s2 = decode_url(s, {{"utf8",1}})
s2 is:
https://www.google.fr/search?q=ÃlÃgant (ascii)
https://www.google.fr/search?q=élégant (utf-8)
See also:
encode_url
-
xml_path (integer, sequence)
returns numerical path to a tag
Params:
Return:
numerical path to a tag (ex: {1,3,2})
Example:
s = tag_path(, elements)
-
tag_path (sequence, sequence)
converts a numerical path to a named tag path
Params:
Return:
string formatted as a POSIX file path (ex: "/html/body/div")
Example:
s = tag_path({1,3,2}, elements)
-
parse_sequence (sequence)
Params:
-
sequence buffer
HTML sequence to parse
Return:
hierarchical sequence of all HTML/XML elements
with value, type, attributes, path, starting and ending position
Example:
s = "Example Domain"
elements = parse_sequence(s)
-
parse_file (sequence)
Params:
-
sequence filename
HTML file to parse
Return:
sequence
[1] HTML/XML code of the file
[2] hierarchical sequence of all HTML/XML elements
with value, type, attributes, path, starting and ending position
Example:
elements = parse_file("page.html")
-
xml_to_sequence (sequence)
converts an XML string into an Euphoria sequence
Params:
-
sequence s
XML string to convert
Return:
sequence
Example:
s = xml_to_sequence(
"<?xml version=\"1.0\" standalone=\"yes\" ?>" &
"<list>" &
" <node id=\"proxmox\" claimed=\"true\" class=\"system\" handle=\"DMI:0002\">" &
" <description>Low Profile Desktop Computer</description>" &
" <product>()</product>" &
" <vendor>Hewlett-Packard</vendor>" &
" </node>" &
"</list>"
)
See also:
get_tag(), get_attributes(), get_attribute_value()
-
get_tag_name (sequence)
gets the first tag of an XML string
Params:
-
sequence s
XML string to convert
Return:
sequence
Example:
s = get_tag_name("<setting id=\"driver\" value=\"MOSCHIP usb-ethernet driver\" />")
s will get value "setting"
See also:
xml_to_sequence(), get_attributes(), get_attribute_value()
-
get_attributes (sequence)
gets the list of attributes of a single tag XML string
Params:
-
sequence s
XML string to convert
Description:
the list is returned as a sequence of pairs {name, value}
Return:
sequence
Example:
s = get_attributes("<setting id=\"driver\" value=\"MOSCHIP usb-ethernet driver\" />")
s will get value {{"id", "driver"}, {"value", "MOSCHIP usb-ethernet driver"}}
See also:
xml_to_sequence(), get_tag_name(), get_attribute_value()
-
get_attribute_value (sequence, sequence)
returns the value associated with an attribute name
Params:
-
sequence name
attribute name
-
sequence s
XML string
Return:
sequence
Example:
s = get_attribute_value("id", "<setting id=\"driver\" value=\"MOSCHIP usb-ethernet driver\" />")
s will get value "driver"
See also:
xml_to_sequence(), get_tag_name(), get_attributes()()
-
search_target (sequence, sequence)
returns the path to the item containing name in structure elements
Params:
Description:
searches the best target in this order
* exact match if unique (when find_all_nested returns one unique path)
* if no exact match is found then partial match if unique (match)
* if many exact matches found then filter on tag type TEXT, return filtered matches if not null
* if many partial matches found then filter on tag type TEXT, return filtered matches if not null
* if many exact matches found then filter on tag type ATTR_VALUE, return filtered matches if not null
* if many partial matches found then filter on tag type ATTR_VALUE, return filtered matches if not null
* if exact matches found then return matches
* return partial matches
Return:
sequence: list of pathes that match name
Example:
s = search_target("0001AAAA", elements, html)
See also:
xml_to_sequence(), get_closest_link()
-
get_parent_containing (sequence, sequence, sequence, sequence)
returns the position of parent tag in structure elements
Params:
Return:
sequence
Example:
parent = get_parent_containing({504,3,5,2}, "0001AAAA", elements, html)
See also:
xml_to_sequence(), get_closest_link()
-
get_closest_link (sequence, sequence)
returns link closest to the tag position in structure elements
Params:
-
sequence path
numerical path to a tag
-
sequence buffer
HTML/XML string
Return:
sequence
Example:
parent = get_closest_link({504,3,5,2}, elements, html)
See also:
xml_to_sequence(), get_parent_containing()