![]() |
![]() |
![]() |
Xesam GLib Reference Manual | ![]() |
---|---|---|---|---|
XesamGXmlQueryBuilderXesamGXmlQueryBuilder — A XesamGQueryBuilder implementation capable of producing and XML representation of the built query |
XesamGXmlQueryBuilderPrivate; XesamGXmlQueryBuilder; XesamGXmlQueryBuilder* xesam_g_xml_query_builder_new (void); gchar* xesam_g_xml_query_builder_get_xml (XesamGXmlQueryBuilder *self); XesamGQuery* xesam_g_xml_query_builder_get_query (XesamGXmlQueryBuilder *self);
XesamGXmlQueryBuilder
implements a XesamGQueryBuilder capable of producing
an XML representation of the built query. To obtain a copy of the built
string call xesam_g_xml_query_builder_get_xml()
.
See also the example on building and executing a query.
XesamGXmlQueryBuilder is available since 1.0
typedef struct _XesamGXmlQueryBuilderPrivate XesamGXmlQueryBuilderPrivate;
XesamGXmlQueryBuilder* xesam_g_xml_query_builder_new (void);
Create a new xml query builder
Returns : |
a newly created xml query builder |
gchar* xesam_g_xml_query_builder_get_xml (XesamGXmlQueryBuilder *self);
Compile the xml representation of the build query.
You may call this method on unfinished queries. In that case the returned xml might not constitute a full query.
|
The query builder to extract xml from |
Returns : |
a string representation of the query consisting of well formed xml.
The returned string should be freed with g_free()
|
XesamGQuery* xesam_g_xml_query_builder_get_query (XesamGXmlQueryBuilder *self);
You may call this method on unfinished queries. In that case the returned query might not contain valid XML.
Since the returned reference to the XesamGQuery is floating you can pass
it on to a XesamGSearch with xesam_g_session_new_search()
without
g_object_unref()
ing it. Like so:
XesamGQuery *query; XesamGXmlQueryBuilder *builder; XesamGSession *session; // Instantiate builder and session. Build a query with the builder xesam_g_session_new_search (session, xesam_g_xml_query_builder_get_query(builder));
|
The query builder to extract a query from |
Returns : |
A newly constructed XesamGQuery representing the build query. Note that this is a floating reference since XesamGQuery is a subclass of GInitiallyUnowned. |
"fragment-only"
property"fragment-only" gboolean : Read / Write
If FALSE
(the default) the query builder will add
<?xml version="1.0" encoding="utf-8"?><request>
and a closing </request> tag to the XML returned by the builder.
Default is FALSE
. This is required for queries to be compatible with the
Xesam XML Query Language.
If you want to generate snippets of queries to use elsewhere you probably
want to turn this switch to TRUE
and set the
"validating" property to FALSE
Default value: FALSE
"validating"
property"validating" gboolean : Read / Write
If TRUE
the query builder will use a weak form of query validation.
Do not trust the builder to generate valid queries just because this
switch is on. The builder only does checks that do not effect performance
in a measurable way.
Generally it is safe to leave the validation switch on. The prime reason for disabling it would be if a program wanted to generate snippets of queries to use elsewhere. See also the "fragment-only" property if you are interested in this.
Default value: TRUE