Morgengrauner Dokumentation
Dateipfad: /home/mud/mudlib/doc//efun/xml_generateOPTIONAL
EXPERIMENTAL
SYNOPSIS
#include
string xml_generate(mixed *xml)
DESCRIPTION
Converts the given array into an XML conform string, if
possible. The argument array must have the following structure.
It must contain tag arrays of three elements, with the following
indices:
string XML_TAG_NAME
The name of the XML tag.
mapping XML_TAG_ATTRIBUTES
All attributes given to the XML tag as mapping where the key
is the attribute name and the value is its string value.
If the xml tag does not contain any attributes, this element
is set 0:
mixed * XML_TAG_CONTENTS
The contents of this xml tag as array. This array may
contain either strings, or arrays of sub-tags again with
three elements (see example)
If the xml tag does not contain anything, the element is
set 0.
In case the parameter does not follow these rules, errors are raised.
The method returns a valid XML string otherwise.
The function is available only if the driver is compiled with Iksemel
support. In that case, __XML_DOM__ is defined.
EXAMPLES
xml_generate(({ "abc", 0, 0 })) -> ""
xml_generate(({ "abc", ([ "xyz" : "cde" ]), 0 })) -> ""
mixed *xml = ({ "book"
, ([ "language" : "common" ])
, ({ ({ "title"
, 0
, ({ "This is a title" })
})
, ({ "chapter"
, 0
, ({ "This is a chapter" })
})
, ({ "chapter"
, 0
, ({ "We want "
, ({ "b"
, 0
, ({ "bold" })
})
, "here"
})
})
})
})
xml_generate(xml)
-> "This is the title"
"This is a chapterWe want "
"bold here."
HISTORY
Added in LDMud 3.3.718.
SEE ALSO
xml_parse(E)
zurück zur Übersicht