I have a data structure that I am writing to an XML file using XmlSerializer.
XmlSerializer xSer = new XmlSerializer(t ypeof(MyData));
StreamWriter sw = new StreamWriter("S omeData.xml");
xSer.Serialize( sw, theData);
sw.Close();
I need to add a style reference within the file that looks like this:
<?xml-stylesheet type="text/xsl" href="MyStyle.x sl"?>
Can someone show me how this is done? Can it be done with the XmlSerializer
class? I can't seem to find the method.
--
-----------
Thanks,
Steve 4 6859
Hi Steve,
instead of using a StreamWriter, you could use a XmlTextWriter (not 100%
sure if this usage of WriteProcessing Instruction() is valid)
XmlSerializer xSer = new XmlSerializer(t ypeof(MyData));
using(StreamWri ter streamWriter = new StreamWriter("S omeData.xml")){
using(XmlTextWr iter xmlWriter = new XmlTextWriter(s treamWriter)){
xmlWriter.Write ProcessingInstr uction(
"xml-stylesheet",
"type=\"tex t/xsl\" href=\"MyStyle. xsl\"");
xSer.Serialize( xmlWriter, theData);
}
}
Or look at this to see how you can include PI's in your MyData object: http://www.topxml.com/xmlserializer/..._xml_nodes.asp
Regards,
Wiebe Tijsma
SteveT wrote:
I have a data structure that I am writing to an XML file using XmlSerializer.
XmlSerializer xSer = new XmlSerializer(t ypeof(MyData));
StreamWriter sw = new StreamWriter("S omeData.xml");
xSer.Serialize( sw, theData);
sw.Close();
I need to add a style reference within the file that looks like this:
<?xml-stylesheet type="text/xsl" href="MyStyle.x sl"?>
Can someone show me how this is done? Can it be done with the XmlSerializer
class? I can't seem to find the method.
This solution looks wonderful and simple to implement. I'll try it out
immediately. Thanks so much!!
--
-----------
Thanks,
Steve
"Wiebe Tijsma" wrote:
Hi Steve,
instead of using a StreamWriter, you could use a XmlTextWriter (not 100%
sure if this usage of WriteProcessing Instruction() is valid)
XmlSerializer xSer = new XmlSerializer(t ypeof(MyData));
using(StreamWri ter streamWriter = new StreamWriter("S omeData.xml")){
using(XmlTextWr iter xmlWriter = new XmlTextWriter(s treamWriter)){
xmlWriter.Write ProcessingInstr uction(
"xml-stylesheet",
"type=\"tex t/xsl\" href=\"MyStyle. xsl\"");
xSer.Serialize( xmlWriter, theData);
}
}
Or look at this to see how you can include PI's in your MyData object:
http://www.topxml.com/xmlserializer/..._xml_nodes.asp
Regards,
Wiebe Tijsma
SteveT wrote:
I have a data structure that I am writing to an XML file using XmlSerializer.
XmlSerializer xSer = new XmlSerializer(t ypeof(MyData));
StreamWriter sw = new StreamWriter("S omeData.xml");
xSer.Serialize( sw, theData);
sw.Close();
I need to add a style reference within the file that looks like this:
<?xml-stylesheet type="text/xsl" href="MyStyle.x sl"?>
Can someone show me how this is done? Can it be done with the XmlSerializer
class? I can't seem to find the method.
Your solution worked wonderfully. Thanks again.
--
-----------
Thanks,
Steve
"Wiebe Tijsma" wrote:
Hi Steve,
instead of using a StreamWriter, you could use a XmlTextWriter (not 100%
sure if this usage of WriteProcessing Instruction() is valid)
XmlSerializer xSer = new XmlSerializer(t ypeof(MyData));
using(StreamWri ter streamWriter = new StreamWriter("S omeData.xml")){
using(XmlTextWr iter xmlWriter = new XmlTextWriter(s treamWriter)){
xmlWriter.Write ProcessingInstr uction(
"xml-stylesheet",
"type=\"tex t/xsl\" href=\"MyStyle. xsl\"");
xSer.Serialize( xmlWriter, theData);
}
}
Or look at this to see how you can include PI's in your MyData object:
http://www.topxml.com/xmlserializer/..._xml_nodes.asp
Regards,
Wiebe Tijsma
SteveT wrote:
I have a data structure that I am writing to an XML file using XmlSerializer.
XmlSerializer xSer = new XmlSerializer(t ypeof(MyData));
StreamWriter sw = new StreamWriter("S omeData.xml");
xSer.Serialize( sw, theData);
sw.Close();
I need to add a style reference within the file that looks like this:
<?xml-stylesheet type="text/xsl" href="MyStyle.x sl"?>
Can someone show me how this is done? Can it be done with the XmlSerializer
class? I can't seem to find the method.
SteveT wrote:
Your solution worked wonderfully. Thanks again.
Welcome :) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark Cunningham |
last post by:
I am curious if there is something that would be considered a proper
method for locating small (three to four items) amounts of page specific
styling. Or does it really matter in the great scheme of things?
I have a linked style sheet that covers everything I want to do
globally. What should be done if I want to change and/or add a couple of
divs and paragraphs on a specific page and the style applied is specific
to that one page?
...
|
by: Laiverd.COM |
last post by:
Posted this in the MM Dreamweaver group also, but then found this newsgroup,
in which I hope someone knows the answer
What I'd like to do is define a specific style for a link that is in a
specific row. This works, but has a drawback:
tr.homeLatestNews a.newsLink {
font-weight: bold;
display: block;
}
|
by: Sandman |
last post by:
I have a script that generates a hierarchical menu, but I am having problems
assigning styles to each manu items different possible states. The possible
states a menu item can be in is (and all of these can be combined unless they
are mutually exclusive):
1. It can belong to a specific level in the hierarchy; 1, 2, 3 and so on.
2. It is the active menu
3. It is an inactive menu
4. It has children
5. It does not have children
|
by: cedoucette |
last post by:
I just wrote code to support sortable columns in a datagrid.
It seems to work fine; but, it doesn't look right.
The problem is that I have a generic style for links
and a different style for the header row - and they conflict.
The sortable column apparently uses the generic style for <a>
elements and the rest of the header uses "headerRow".
Can anyone tell me how to get consistent styles for each column in
my datagrid header?
|
by: p3t3r |
last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS
styles for the root level nodes. The topmost root node should not have a top
border, all the other root nodes should have a top border.
Is it possible to have more than 1 style at the same level (parent node)
when using a SiteMap?
I want it to appear something like this and I can only find a way to either
have the border on all root nodes or none at all. In...
| |
by: rshillington |
last post by:
I have one content page that need a stylesheet that is in addition to
the styles coded in the CSS for the theme. Since the content page
doesn't have a HEAD element, how do I add a LINK to the specific CSS.
Also I would like this specific CSS to be part of the theme, such that
if the user changes themes they get a new specific CSS for this page.
Thanks in advance,
Ralph Shillington
|
by: David W |
last post by:
I'm almost tearing my hair out. A colleague claimed that a null reference can exist, like
this:
void f( int& p )
{
printf( "%d\n", p );
}
int main (int argc, char *argv)
{
|
by: sam_cit |
last post by:
Hi Everyone,
I just came to know about a declartion, namely reference to a pointer
like the following,
int *&p; //p is a reference to a pointer to an integer
Is this valid only in C++ and not in C?
and i also came to know that there is a difference between call by
|
by: ashkaan57 |
last post by:
Hi,
I am working on an asp.net application that has a grid. When rendered,
grids are translated into tables. I am having some problems applying
styles to the this table. When I do a "View Source", this is what I
see:
<table cellspacing="0" cellpadding="3" border="0"
id="ctl00_MainContent_SystemsGV" style="font-family:Arial;font-size:
9pt;width:100%;border-collapse:collapse;">
<tr class="gvHeader">
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |