Parsable.from_xml


Description:

[ CCode ( has_construct_function = false ) ]
[ Version ( since = "0.4.0" ) ]
public Parsable.from_xml (Type parsable_type, string xml, int length) throws Error

Creates a new Parsable subclass (of the given parsable_type) from the given xml.

An object of the given parsable_type is created, and its <function>pre_parse_xml</function>, <function> parse_xml</function> and <function>post_parse_xml</function> class functions called on the XML tree obtained from xml. <function>pre_parse_xml</function> and <function>post_parse_xml</function> are called once each on the root node of the tree, while <function>parse_xml</function> is called for each of the child nodes of the root node.

If length is -1, xml will be assumed to be null-terminated.

If an error occurs during parsing, a suitable error from ParserError will be returned.

Parameters:

parsable_type

the type of the class represented by the XML

xml

the XML for just the parsable object, with full namespace declarations

length

the length of xml, or -1

Returns:

a new Parsable, or null; unref with unref