diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2011-09-27 17:28:43 +0200 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2011-10-07 13:08:49 +0200 |
commit | a7be1fa1142bcf875b290adf2972353342ba0d6b (patch) | |
tree | 4b7f64c0cbae6f92377721ac68d8cc48ab4a9e58 /lasso/xml | |
parent | 943049196366cee18f20668dcc73519b95abb879 (diff) | |
download | lasso-a7be1fa1142bcf875b290adf2972353342ba0d6b.tar.gz lasso-a7be1fa1142bcf875b290adf2972353342ba0d6b.tar.xz lasso-a7be1fa1142bcf875b290adf2972353342ba0d6b.zip |
[xml] create a static version of lasso_node_new_from_xmlNode_with_type without error logging
When used inside lasso_node_impl_init_from_xml the error logging is
prematurely sent as there is a backup procedure for parsing unknown
nodes inside a SNIPPET_LIST_NODES by creating a LassoMiscTextNode
containing a copy of the parsed xmlNode child.
Diffstat (limited to 'lasso/xml')
-rw-r--r-- | lasso/xml/xml.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index 80387568..b8bd098b 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -2191,26 +2191,21 @@ _type_name_from_href_and_nodename(char *href, char *nodename) { } /** - * lasso_node_new_from_xmlNode: + * _lasso_node_new_from_xmlNode: * @node: an xmlNode * * Builds a new #LassoNode from an xmlNode. * * Return value: a new node **/ -LassoNode* -lasso_node_new_from_xmlNode(xmlNode *xmlnode) +static LassoNode* +_lasso_node_new_from_xmlNode(xmlNode *xmlnode) { char *typename = NULL; xmlChar *xsitype = NULL; LassoNode *node = NULL; gboolean fromXsi = FALSE; - if (xmlnode == NULL || xmlnode->ns == NULL) { - message(G_LOG_LEVEL_CRITICAL, "Unable to build a LassoNode from a xmlNode"); - return NULL; - } - xsitype = xmlGetNsProp(xmlnode, (xmlChar*)"type", (xmlChar*)LASSO_XSI_HREF); if (xsitype) { xmlChar *xmlPrefix, *separator; @@ -2282,6 +2277,23 @@ cleanup: return node; } +/** + * lasso_node_new_from_xmlNode: + * @node: an xmlNode + * + * Builds a new #LassoNode from an xmlNode. + * + * Return value: a new node + **/ +LassoNode* +lasso_node_new_from_xmlNode(xmlNode *xmlnode) +{ + if (xmlnode == NULL || xmlnode->ns == NULL) { + message(G_LOG_LEVEL_CRITICAL, "Unable to build a LassoNode from a xmlNode"); + return NULL; + } + return _lasso_node_new_from_xmlNode(xmlnode); +} static LassoNode* lasso_node_new_from_xmlNode_with_type(xmlNode *xmlnode, char *typename) @@ -2291,7 +2303,7 @@ lasso_node_new_from_xmlNode_with_type(xmlNode *xmlnode, char *typename) int rc = 0; if (typename == NULL) - return lasso_node_new_from_xmlNode(xmlnode); /* will auto-detect */ + return _lasso_node_new_from_xmlNode(xmlnode); /* will auto-detect */ gtype = g_type_from_name(typename); if (gtype == 0) |