static HRESULT WINAPI domtext_get_nodeValue( IXMLDOMText *iface, VARIANT* var1 ) { domtext *This = impl_from_IXMLDOMText( iface ); return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); }
static HRESULT WINAPI dom_pi_get_nodeValue( IXMLDOMProcessingInstruction *iface, VARIANT* var1 ) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); return IXMLDOMNode_get_nodeValue( This->node, var1 ); }
static HRESULT WINAPI entityref_get_nodeValue( IXMLDOMEntityReference *iface, VARIANT* var1 ) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); }
static HRESULT WINAPI domcomment_get_nodeValue( IXMLDOMComment *iface, VARIANT* var1 ) { domcomment *This = impl_from_IXMLDOMComment( iface ); return IXMLDOMNode_get_nodeValue( This->node, var1 ); }
static HRESULT WINAPI domattr_get_nodeValue( IXMLDOMAttribute *iface, VARIANT* var1 ) { domattr *This = impl_from_IXMLDOMAttribute( iface ); return IXMLDOMNode_get_nodeValue( This->node, var1 ); }
static HRESULT WINAPI domtext_get_data( IXMLDOMText *iface, BSTR *p) { domtext *This = impl_from_IXMLDOMText( iface ); HRESULT hr; VARIANT vRet; if(!p) return E_INVALIDARG; hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); } return hr; }
static HRESULT WINAPI dom_pi_get_data( IXMLDOMProcessingInstruction *iface, BSTR *p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); HRESULT hr = E_FAIL; VARIANT vRet; if(!p) return E_INVALIDARG; hr = IXMLDOMNode_get_nodeValue( This->node, &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); } return hr; }
static HRESULT WINAPI domcomment_get_data( IXMLDOMComment *iface, BSTR *p) { domcomment *This = impl_from_IXMLDOMComment( iface ); HRESULT hr = E_FAIL; VARIANT vRet; if(!p) return E_INVALIDARG; hr = IXMLDOMNode_get_nodeValue( This->node, &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); } return hr; }
static inline HRESULT handle_xml_load(BindStatusCallback *This) { static const WCHAR selectW[] = {'p','r','o','c','e','s','s','i','n','g','-', 'i','n','s','t','r','u','c','t','i','o','n','(','\'','x','m','l', '-','s','t','y','l','e','s','h','e','e','t','\'',')',0}; static const WCHAR hrefW[] = {'h','r','e','f','=',0}; IXMLDOMDocument3 *xml = NULL, *xsl = NULL; IXMLDOMNode *stylesheet; IBindCtx *pbc; IMoniker *mon; LPOLESTR xsl_url; LARGE_INTEGER off; VARIANT_BOOL succ; VARIANT var; WCHAR *href = NULL, *p; BSTR bstr; HRESULT hres; off.QuadPart = 0; hres = IStream_Seek(This->stream, off, STREAM_SEEK_SET, NULL); if(FAILED(hres)) return display_error_page(This); hres = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&xml); if(FAILED(hres)) return display_error_page(This); V_VT(&var) = VT_UNKNOWN; V_UNKNOWN(&var) = (IUnknown*)This->stream; hres = IXMLDOMDocument3_load(xml, var, &succ); if(FAILED(hres) || !succ) { IXMLDOMDocument3_Release(xml); return display_error_page(This); } V_VT(&var) = VT_EMPTY; bstr = SysAllocString(selectW); hres = IXMLDOMDocument3_selectSingleNode(xml, bstr, &stylesheet); SysFreeString(bstr); if(hres != S_OK) { IXMLDOMDocument3_Release(xml); return display_error_page(This); } hres = IXMLDOMNode_get_nodeValue(stylesheet, &var); IXMLDOMNode_Release(stylesheet); if(SUCCEEDED(hres) && V_VT(&var)!=VT_BSTR) { FIXME("Variant type %d not supported\n", V_VT(&var)); VariantClear(&var); hres = E_FAIL; } if(FAILED(hres)) { IXMLDOMDocument3_Release(xml); return display_error_page(This); } /* TODO: fix parsing processing instruction value */ if((p = strstrW(V_BSTR(&var), hrefW))) { p += sizeof(hrefW)/sizeof(WCHAR)-1; if(*p!='\'' && *p!='\"') p = NULL; else { href = p+1; p = strchrW(href, *p); } } if(p) { *p = 0; } else { VariantClear(&var); IXMLDOMDocument3_Release(xml); return display_error_page(This); } hres = CreateURLMonikerEx(This->mon, href, &mon, 0); VariantClear(&var); if(FAILED(hres)) { IXMLDOMDocument3_Release(xml); return display_error_page(This); } hres = CreateBindCtx(0, &pbc); if(SUCCEEDED(hres)) { hres = IMoniker_GetDisplayName(mon, pbc, NULL, &xsl_url); IMoniker_Release(mon); IBindCtx_Release(pbc); } if(FAILED(hres)) { IXMLDOMDocument3_Release(xml); return display_error_page(This); } V_VT(&var) = VT_BSTR; V_BSTR(&var) = SysAllocString(xsl_url); CoTaskMemFree(xsl_url); if(!V_BSTR(&var)) { IXMLDOMDocument3_Release(xml); return display_error_page(This); } hres = DOMDocument_create(MSXML_DEFAULT, NULL, (void**)&xsl); if(FAILED(hres)) { VariantClear(&var); IXMLDOMDocument3_Release(xml); return display_error_page(This); } /* TODO: do the binding asynchronously */ hres = IXMLDOMDocument3_load(xsl, var, &succ); VariantClear(&var); if(FAILED(hres) || !succ) { IXMLDOMDocument3_Release(xsl); IXMLDOMDocument3_Release(xml); return display_error_page(This); } hres = IXMLDOMDocument3_transformNode(xml, (IXMLDOMNode*)xsl, &bstr); IXMLDOMDocument3_Release(xsl); IXMLDOMDocument3_Release(xml); if(FAILED(hres)) return display_error_page(This); hres = IStream_Seek(This->stream, off, STREAM_SEEK_SET, NULL); if(FAILED(hres)) { SysFreeString(bstr); return display_error_page(This); } hres = IStream_Write(This->stream, (BYTE*)bstr, SysStringLen(bstr)*sizeof(WCHAR), NULL); SysFreeString(bstr); if(FAILED(hres)) return display_error_page(This); return report_data(This); }