Hi,
I want to use the Webbrowser Control (the Internet Explorer Control) to
display an XML-structure within a C# WinForm.
The way the IE displays a XML-file in its native form is exactly what I need
(as tree structure with plus/minus).
This works great as long as I load the XML to display from a file with the
Navigate2-method of the control.
But my XML comes not from a file but is created dynamically during runtime.
When I feed the document-object of the IE-control with my generated XML,
unfortunately the IE control displays my XML as plain text and not in
XML-mode.
Does anyone know how to tell the IE with C# that the given string has to be
displayed as a XML document?
Any help appreciated,
Winston 7 13993
Winston,
There is an easy way, and a a few hard ways to do this. The easy way would be to save your XML to a temporary file and then navigate to that file.
The first hard way would be to define the IPersistMemory interface in your code. This is a COM interface that is part of the persistence framework that COM exposed. It allows you to load content from an area in memory. If you get this interface, then you can cast the HTML document to this interface and then call the Load method. Content type is determined by "sniffing" the content, as opposed to headers from a server.
The definitive way would be to create an implementation of the IMoniker interface and then control the information that is accessed by the HTML document when loading. With the implementation of IMoniker, you can control what the HTML document gets, so you can set the content type of the document to "text/xml" explicitly, which will trigger the display that you wish. For this, you would have to define the IMoniker and IPersistMoniker interfaces.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(d0t)paldin o=At-exisconsulting' dot|com
On Mon, 6 Oct 2003 11:36:59 +0200, Winston <wi***********@ gmx.net> wrote: Hi, I want to use the Webbrowser Control (the Internet Explorer Control) to display an XML-structure within a C# WinForm. The way the IE displays a XML-file in its native form is exactly what I need (as tree structure with plus/minus).
This works great as long as I load the XML to display from a file with the Navigate2-method of the control.
But my XML comes not from a file but is created dynamically during runtime. When I feed the document-object of the IE-control with my generated XML, unfortunately the IE control displays my XML as plain text and not in XML-mode.
Does anyone know how to tell the IE with C# that the given string has to be displayed as a XML document?
Any help appreciated, Winston
Alternatively transform the source xml using IE's default stylesheet and
then use your current method to display the result. Default stylesheet at:
res://msxml3.dll/DEFAULTSS.xsl
--
Joe
"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote
in message news:op******** ******@msnews.m icrosoft.com... Winston,
There is an easy way, and a a few hard ways to do this. The easy way
would be to save your XML to a temporary file and then navigate to that
file. The first hard way would be to define the IPersistMemory interface in your
code. This is a COM interface that is part of the persistence framework
that COM exposed. It allows you to load content from an area in memory. If
you get this interface, then you can cast the HTML document to this
interface and then call the Load method. Content type is determined by
"sniffing" the content, as opposed to headers from a server. The definitive way would be to create an implementation of the IMoniker
interface and then control the information that is accessed by the HTML
document when loading. With the implementation of IMoniker, you can control
what the HTML document gets, so you can set the content type of the document
to "text/xml" explicitly, which will trigger the display that you wish. For
this, you would have to define the IMoniker and IPersistMoniker interfaces. Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - nick(d0t)paldin o=At-exisconsulting' dot|com
On Mon, 6 Oct 2003 11:36:59 +0200, Winston <wi***********@ gmx.net> wrote:
Hi, I want to use the Webbrowser Control (the Internet Explorer Control) to display an XML-structure within a C# WinForm. The way the IE displays a XML-file in its native form is exactly what I
need (as tree structure with plus/minus).
This works great as long as I load the XML to display from a file with
the Navigate2-method of the control.
But my XML comes not from a file but is created dynamically during
runtime. When I feed the document-object of the IE-control with my generated XML, unfortunately the IE control displays my XML as plain text and not in XML-mode.
Does anyone know how to tell the IE with C# that the given string has to
be displayed as a XML document?
Any help appreciated, Winston
Hi Nicholas,
that sounds very good. I like to try the way with the IPersistMemory
interface but I don't know which reference I have to add in my project to
get access to that interface.
Can you help?
Winston
"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote
in message news:op******** ******@msnews.m icrosoft.com... Winston,
There is an easy way, and a a few hard ways to do this. The easy way
would be to save your XML to a temporary file and then navigate to that
file. The first hard way would be to define the IPersistMemory interface in your
code. This is a COM interface that is part of the persistence framework
that COM exposed. It allows you to load content from an area in memory. If
you get this interface, then you can cast the HTML document to this
interface and then call the Load method. Content type is determined by
"sniffing" the content, as opposed to headers from a server. The definitive way would be to create an implementation of the IMoniker
interface and then control the information that is accessed by the HTML
document when loading. With the implementation of IMoniker, you can control
what the HTML document gets, so you can set the content type of the document
to "text/xml" explicitly, which will trigger the display that you wish. For
this, you would have to define the IMoniker and IPersistMoniker interfaces. Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - nick(d0t)paldin o=At-exisconsulting' dot|com
On Mon, 6 Oct 2003 11:36:59 +0200, Winston <wi***********@ gmx.net> wrote:
Hi, I want to use the Webbrowser Control (the Internet Explorer Control) to display an XML-structure within a C# WinForm. The way the IE displays a XML-file in its native form is exactly what I
need (as tree structure with plus/minus).
This works great as long as I load the XML to display from a file with
the Navigate2-method of the control.
But my XML comes not from a file but is created dynamically during
runtime. When I feed the document-object of the IE-control with my generated XML, unfortunately the IE control displays my XML as plain text and not in XML-mode.
Does anyone know how to tell the IE with C# that the given string has to
be displayed as a XML document?
Any help appreciated, Winston
On Mon, 6 Oct 2003 11:36:59 +0200, "Winston" <wi***********@ gmx.net>
wrote: Hi, I want to use the Webbrowser Control (the Internet Explorer Control) to display an XML-structure within a C# WinForm. The way the IE displays a XML-file in its native form is exactly what I need (as tree structure with plus/minus).
This works great as long as I load the XML to display from a file with the Navigate2-method of the control.
But my XML comes not from a file but is created dynamically during runtime. When I feed the document-object of the IE-control with my generated XML, unfortunatel y the IE control displays my XML as plain text and not in XML-mode.
Does anyone know how to tell the IE with C# that the given string has to be displayed as a XML document?
A quick and dirty way to do this is to temporarily persist your XML to
file, then load it from the file into your reader.
I do not know if there's a more elegant solution.
I solved it with your help and a little workaround.
Loading res://msxml3.dll/DEFAULTSS.xsl into my XMLDocument-Object didn't
work. I guess that those res:// files can only be read by the IE itself.
I found a slightly modified version of this Default-XSL at http://www.biglist.com/lists/xsl-lis.../msg00769.html.
After fixing some typing errors I saved it into a file.
Now I load that XSL from disk, and transform my XML-string with this XSL
into HTML.
When I feed this into the IE-control it looks like the way the IE does it.
Thanks for your help,
Winston
"Joe Fawcett" <jo********@hot mail.com> wrote in message
news:Oh******** *****@TK2MSFTNG P09.phx.gbl... Alternatively transform the source xml using IE's default stylesheet and then use your current method to display the result. Default stylesheet at: res://msxml3.dll/DEFAULTSS.xsl --
Joe
"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com>
wrote in message news:op******** ******@msnews.m icrosoft.com... Winston,
There is an easy way, and a a few hard ways to do this. The easy way would be to save your XML to a temporary file and then navigate to that file. The first hard way would be to define the IPersistMemory interface in
your code. This is a COM interface that is part of the persistence framework that COM exposed. It allows you to load content from an area in memory.
If you get this interface, then you can cast the HTML document to this interface and then call the Load method. Content type is determined by "sniffing" the content, as opposed to headers from a server. The definitive way would be to create an implementation of the IMoniker interface and then control the information that is accessed by the HTML document when loading. With the implementation of IMoniker, you can
control what the HTML document gets, so you can set the content type of the
document to "text/xml" explicitly, which will trigger the display that you wish.
For this, you would have to define the IMoniker and IPersistMoniker
interfaces. Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - nick(d0t)paldin o=At-exisconsulting' dot|com
On Mon, 6 Oct 2003 11:36:59 +0200, Winston <wi***********@ gmx.net>
wrote: Hi, I want to use the Webbrowser Control (the Internet Explorer Control)
to display an XML-structure within a C# WinForm. The way the IE displays a XML-file in its native form is exactly what
I need (as tree structure with plus/minus).
This works great as long as I load the XML to display from a file with the Navigate2-method of the control.
But my XML comes not from a file but is created dynamically during runtime. When I feed the document-object of the IE-control with my generated
XML, unfortunately the IE control displays my XML as plain text and not in XML-mode.
Does anyone know how to tell the IE with C# that the given string has
to be displayed as a XML document?
Any help appreciated, Winston
"Winston" <wi***********@ gmx.net> wrote in message news:ur******** ******@tk2msftn gp13.phx.gbl... I solved it with your help and a little workaround. Loading res://msxml3.dll/DEFAULTSS.xsl into my XMLDocument-Object didn't work. I guess that those res:// files can only be read by the IE itself. I found a slightly modified version of this Default-XSL at http://www.biglist.com/lists/xsl-lis.../msg00769.html. After fixing some typing errors I saved it into a file. Now I load that XSL from disk, and transform my XML-string with this XSL into HTML. When I feed this into the IE-control it looks like the way the IE does it.
Thanks for your help, Winston
This transformation produces a display of non-well-formed xml in the
following two general cases:
1. The original xml document contains namespace declarations. In
this case
there are no namespace declarations displayed.
2. The original document contains (correctly) escaped ampersand. In
this case
unescaped ampersand is displayed.
The stylesheets used by the XPath Visualizer (for IE and for Mozilla)
do not have these flaws.
=====
Cheers,
Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL http://msdn.microsoft.com/library/de...th_hn_2uck.asp
--
Joe
"Winston" <wi***********@ gmx.net> wrote in message
news:ur******** ******@tk2msftn gp13.phx.gbl... I solved it with your help and a little workaround. Loading res://msxml3.dll/DEFAULTSS.xsl into my XMLDocument-Object didn't work. I guess that those res:// files can only be read by the IE itself. I found a slightly modified version of this Default-XSL at http://www.biglist.com/lists/xsl-lis.../msg00769.html. After fixing some typing errors I saved it into a file. Now I load that XSL from disk, and transform my XML-string with this XSL into HTML. When I feed this into the IE-control it looks like the way the IE does it.
Thanks for your help, Winston
"Joe Fawcett" <jo********@hot mail.com> wrote in message news:Oh******** *****@TK2MSFTNG P09.phx.gbl... Alternatively transform the source xml using IE's default stylesheet and then use your current method to display the result. Default stylesheet
at: res://msxml3.dll/DEFAULTSS.xsl --
Joe
"Nicholas Paldino [.NET/C# MVP]" <ni************ **@exisconsulti ng.com> wrote in message news:op******** ******@msnews.m icrosoft.com... Winston,
There is an easy way, and a a few hard ways to do this. The easy way would be to save your XML to a temporary file and then navigate to that file. The first hard way would be to define the IPersistMemory interface in your code. This is a COM interface that is part of the persistence framework that COM exposed. It allows you to load content from an area in memory. If you get this interface, then you can cast the HTML document to this interface and then call the Load method. Content type is determined by "sniffing" the content, as opposed to headers from a server. The definitive way would be to create an implementation of the
IMoniker interface and then control the information that is accessed by the HTML document when loading. With the implementation of IMoniker, you can
control what the HTML document gets, so you can set the content type of the document to "text/xml" explicitly, which will trigger the display that you wish. For this, you would have to define the IMoniker and IPersistMoniker interfaces. Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - nick(d0t)paldin o=At-exisconsulting' dot|com
On Mon, 6 Oct 2003 11:36:59 +0200, Winston <wi***********@ gmx.net> wrote: > Hi, > I want to use the Webbrowser Control (the Internet Explorer Control) to > display an XML-structure within a C# WinForm. > The way the IE displays a XML-file in its native form is exactly
what I need > (as tree structure with plus/minus). > > This works great as long as I load the XML to display from a file
with the > Navigate2-method of the control. > > But my XML comes not from a file but is created dynamically during runtime. > When I feed the document-object of the IE-control with my generated XML, > unfortunately the IE control displays my XML as plain text and not
in > XML-mode. > > Does anyone know how to tell the IE with C# that the given string
has to be > displayed as a XML document? > > Any help appreciated, > Winston > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ram |
last post by:
I have a user control uc (with a dropdownlist uc_dd) that I dynamically add
to a pane on a button_click. this pane is hosted on the winform. now when I
add two instances of the user control (uc_dd1, uc_dd2), and change the
selected item in the dropdown uc_dd1, the selected item in uc_dd2 also
changes. any ideas?
thank you!
|
by: Winston |
last post by:
Hi,
I want to use the Webbrowser Control (the Internet Explorer Control) to
display an XML-structure within a C# WinForm.
The way the IE displays a XML-file in its native form is exactly what I need
(as tree structure with plus/minus).
This works great as long as I load the XML to display from a file with the
Navigate2-method of the control.
But my XML comes not from a file but is created dynamically during runtime.
|
by: John |
last post by:
Hi,
Is there any control (free) that has same functionality as IE to display the
XML document without having to create a physical file?
if using Webbrowser control (ActiveX control) I have to create a xml file
and then use .Navigate(url) ...
Thanks!
|
by: Chris |
last post by:
I have a winform base class in which I dynamically set a web reference Url:
myService.Url = <WebServer> + "MyService.asmx";
where <WebServer> is pulled from my App.config file.
There is no problem working with this base class and the solution compiles
and runs fine. However, I am unable to display any descendant forms in
design mode in VS.NET 2003. I get a message indicating that:
|
by: nobody |
last post by:
I am running Microsoft's example of a windows form in aspx.
http://msdn.microsoft.com/msdnmag/issues/02/01/UserCtrl/default.aspx
The only way I can get the example to run is by opening up the
permissions in the .Net Configuration 1.1. Right now I have defined a
custom Code Group under LocalIntranet_Zone with FullTrust based on a
Site or URL. The appp works with this permission set. If I try a
strong name with a custom permission set...
| |
by: VB Programmer |
last post by:
I have created a custom control in vb.net.
How do I show 10 of them (vertical stack) on a new form when it loads?
Thanks!
|
by: sobmir |
last post by:
A I'm new to c# and I came from c++ also.
I want to create dynamicaly winform to get some data. I create a array
of object as a description of variable which I want to get. I pass this
array to a function which build a form, show the edit fields and return
changed values. Changed values are stored in my array of objects but
these original values are not changed.
Short code snipet ( this is working)
// ---- c# ----
struct desc {
|
by: crazyjh |
last post by:
hello
i want to add some controls in according of the time.
but when the time change, i call the method again to add controls again,No
effect!
i think maybe i should unload the controls adding before,how can i unload
it??
pls help me,thanks
|
by: Andrus |
last post by:
I have database containing translations.
I'm creating VS 2005 WinForms application which should use this database to
translate menu items to user language.
I replaced lines in myform.designer.cs like
Text = "File";
to call my translating routine
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |