msxml3: Make element_get_dt() static and move it around to avoid a forward declaration.

This commit is contained in:
Francois Gouget 2011-03-16 08:30:26 +01:00 committed by Alexandre Julliard
parent 60b63fea4e
commit 11d1ff154f
2 changed files with 46 additions and 47 deletions

View File

@ -671,6 +671,52 @@ static inline HRESULT VARIANT_from_DT(XDR_DT dt, xmlChar* str, VARIANT* v)
return hr; return hr;
} }
static XDR_DT element_get_dt(xmlNodePtr node)
{
XDR_DT dt = DT_INVALID;
TRACE("(%p)\n", node);
if(node->type != XML_ELEMENT_NODE)
{
FIXME("invalid element node\n");
return dt;
}
if (node->ns && xmlStrEqual(node->ns->href, DT_nsURI))
{
dt = str_to_dt(node->name, -1);
}
else
{
xmlChar* pVal = xmlGetNsProp(node, BAD_CAST "dt", DT_nsURI);
if (pVal)
{
dt = str_to_dt(pVal, -1);
xmlFree(pVal);
}
else if (node->doc)
{
IXMLDOMDocument3* doc = (IXMLDOMDocument3*)create_domdoc((xmlNodePtr)node->doc);
if (doc)
{
VARIANT v;
VariantInit(&v);
if (IXMLDOMDocument3_get_schemas(doc, &v) == S_OK &&
V_VT(&v) == VT_DISPATCH)
{
dt = SchemaCache_get_node_dt((IXMLDOMSchemaCollection2*)V_DISPATCH(&v), node);
}
VariantClear(&v);
IXMLDOMDocument3_Release(doc);
}
}
}
TRACE("=> dt:%s\n", dt_to_str(dt));
return dt;
}
static HRESULT WINAPI domelem_get_nodeTypedValue( static HRESULT WINAPI domelem_get_nodeTypedValue(
IXMLDOMElement *iface, IXMLDOMElement *iface,
VARIANT* var1) VARIANT* var1)
@ -730,52 +776,6 @@ static HRESULT WINAPI domelem_put_nodeTypedValue(
return hr; return hr;
} }
XDR_DT element_get_dt(xmlNodePtr node)
{
XDR_DT dt = DT_INVALID;
TRACE("(%p)\n", node);
if(node->type != XML_ELEMENT_NODE)
{
FIXME("invalid element node\n");
return dt;
}
if (node->ns && xmlStrEqual(node->ns->href, DT_nsURI))
{
dt = str_to_dt(node->name, -1);
}
else
{
xmlChar* pVal = xmlGetNsProp(node, BAD_CAST "dt", DT_nsURI);
if (pVal)
{
dt = str_to_dt(pVal, -1);
xmlFree(pVal);
}
else if (node->doc)
{
IXMLDOMDocument3* doc = (IXMLDOMDocument3*)create_domdoc((xmlNodePtr)node->doc);
if (doc)
{
VARIANT v;
VariantInit(&v);
if (IXMLDOMDocument3_get_schemas(doc, &v) == S_OK &&
V_VT(&v) == VT_DISPATCH)
{
dt = SchemaCache_get_node_dt((IXMLDOMSchemaCollection2*)V_DISPATCH(&v), node);
}
VariantClear(&v);
IXMLDOMDocument3_Release(doc);
}
}
}
TRACE("=> dt:%s\n", dt_to_str(dt));
return dt;
}
static HRESULT WINAPI domelem_get_dataType( static HRESULT WINAPI domelem_get_dataType(
IXMLDOMElement *iface, IXMLDOMElement *iface,
VARIANT* typename) VARIANT* typename)

View File

@ -317,7 +317,6 @@ extern XDR_DT str_to_dt(xmlChar const* str, int len /* calculated if -1 */);
extern XDR_DT bstr_to_dt(OLECHAR const* bstr, int len /* calculated if -1 */); extern XDR_DT bstr_to_dt(OLECHAR const* bstr, int len /* calculated if -1 */);
extern xmlChar const* dt_to_str(XDR_DT dt); extern xmlChar const* dt_to_str(XDR_DT dt);
extern OLECHAR const* dt_to_bstr(XDR_DT dt); extern OLECHAR const* dt_to_bstr(XDR_DT dt);
extern XDR_DT element_get_dt(xmlNodePtr node);
extern HRESULT dt_validate(XDR_DT dt, xmlChar const* content); extern HRESULT dt_validate(XDR_DT dt, xmlChar const* content);
extern BSTR EnsureCorrectEOL(BSTR); extern BSTR EnsureCorrectEOL(BSTR);