I would like to do the following and cannot find an elegant way:
System.Xml.XmlDocument
XSLT
CSS
WebBrowser
I am currently reading it from a file on disk, filling it in, and then saving it back to disk after it is filled. I refer to XSLTin the template and CSSin XSLT, and then use the method WebBrowser.Navigate([filename])to display the XML file.
WebBrowser.Navigate([filename])
Obviously, when I come to deploy this app, it will be terribly disturbed, because the file does not exist on the drive, and I can not rely on files XSLTand CSSin XML, because they are resources. I plan to include the template as a resource, but I cannot find a neat way from there.
XML
Any help is much appreciated
Quick question. Why do I need an Xml template? If you already know the diagram before hand, just generate the full Xml in your code. No template file upload required.
Keith, , LINQ , . , .Net 2.0 , (, , !), LINQ .
CSS XSLT, System.Xml.Xsl.XslCompiledTransform XML . WebBrowser.DocumentText XML Componentet WebBrowser, , , .
, -, . , LINQ, , , ? XML, , . , , !
Linq to XML - Xml. , System.Xml.XmlDocument.
, XSLT CSS, XHTML CSS? , XSLT CSS .
- , , - CHM . , , , .
WebBrowser, WPF, CSS, 4. Resource Hacker "" res:// (http://msdn.microsoft.com/en-us/library/aa767740(VS.85).aspx) Microsoft 1990- .
HTML-. -:
void WireUpBrowserEvents() { HtmlElement table = this._browser.Document.GetElementById( "UnitFormsTable" ); if ( table != null ) { HtmlElementCollection thead = table.GetElementsByTagName( "thead" ); if ( ( thead != null ) && ( thead.Count == 1 ) ) { HtmlElementCollection links = thead[0].GetElementsByTagName( "a" ); if ( ( links != null ) && ( links.Count > 0 ) ) { foreach ( HtmlElement a in links ) { a.Click += new HtmlElementEventHandler( XslSort_Click ); } } } } } void XslSort_Click( object sender, HtmlElementEventArgs e ) { e.ReturnValue = false; if ( this._xslSortWorker.IsBusy ) return; if ( sender is HtmlElement ) { HtmlElement a = sender as HtmlElement; this._browser.Hide(); this._browserMessage.Visible = true; this._browserMessage.Refresh(); this._xslSortWorker.RunWorkerAsync( a.Id ); } }
, , HtmlElement HtmlElementCollection System.Windows.Forms. , :)