I'm currently writing a webservice. I've successfully written a
service that gives me some XML data, but now I want to link a
XLS-stylesheet to that data. The way I'm trying to do that is to
create a webmethod that returns a XmlDataDocument, and use
CreateProcessingInstruction() to add a "stylesheet-header"... Problem
is that the headers I add using CreateProcessingInstruction() seems to
be removed (?) when the data is transferred over the web. When I use
XmlDocument.Save() the output is fine... What causes this? Is there
any workaround?
The optimal solution would allow me to return a ADO.NET DataSet, and
still link an XLS-datasheet to the document. Reason is that I'm
intending to use the service with crystal reports through the ADO.NET
driver (doesn't recognize methods not returning DataSet). Is there a
way?
My method is as follows:
[WebMethod]
public XmlDataDocument test()
{
Basin tree = db.GetBasinTree();
DataSet ds = new DataSet();
ds.EnforceConstraints = false;
DataTable tb = ds.Tables.Add("basin");
tb.Columns.Add("basinid", typeof(Decimal));
tb.Columns.Add("basinname", typeof(String));
tb.Columns.Add("parent", typeof(Decimal));
tb.Columns.Add("haschildren", typeof(bool));
AddBasinChildren(tb, tree);
XmlDataDocument xmlDoc = new XmlDataDocument(ds);
String stylesheet = "type=\"text/xsl\" href=\"test.xsl\"";
XmlProcessingInstruction xlsNode =
xmlDoc.CreateProcessingInstruction("xml-stylesheet", stylesheet);
xmlDoc.InsertBefore(xlsNode, xmlDoc.DocumentElement);
xmlDoc.Save("c:\\temp\\thisworks.xml");
return xmlDoc;
}
Help appreciated!
Lars Moastuen
GeoKnowledge 3 2509
I am trying to do an identical thing
Did you ever find the solution ?
David Davies,
Goldman Sachs
"Lars Moastuen" wrote: I'm currently writing a webservice. I've successfully written a service that gives me some XML data, but now I want to link a XLS-stylesheet to that data. The way I'm trying to do that is to create a webmethod that returns a XmlDataDocument, and use CreateProcessingInstruction() to add a "stylesheet-header"... Problem is that the headers I add using CreateProcessingInstruction() seems to be removed (?) when the data is transferred over the web. When I use XmlDocument.Save() the output is fine... What causes this? Is there any workaround?
The optimal solution would allow me to return a ADO.NET DataSet, and still link an XLS-datasheet to the document. Reason is that I'm intending to use the service with crystal reports through the ADO.NET driver (doesn't recognize methods not returning DataSet). Is there a way?
My method is as follows: [WebMethod] public XmlDataDocument test() { Basin tree = db.GetBasinTree();
DataSet ds = new DataSet(); ds.EnforceConstraints = false; DataTable tb = ds.Tables.Add("basin"); tb.Columns.Add("basinid", typeof(Decimal)); tb.Columns.Add("basinname", typeof(String)); tb.Columns.Add("parent", typeof(Decimal)); tb.Columns.Add("haschildren", typeof(bool)); AddBasinChildren(tb, tree);
XmlDataDocument xmlDoc = new XmlDataDocument(ds); String stylesheet = "type=\"text/xsl\" href=\"test.xsl\""; XmlProcessingInstruction xlsNode = xmlDoc.CreateProcessingInstruction("xml-stylesheet", stylesheet); xmlDoc.InsertBefore(xlsNode, xmlDoc.DocumentElement); xmlDoc.Save("c:\\temp\\thisworks.xml");
return xmlDoc; }
Help appreciated! Lars Moastuen GeoKnowledge
Trying a cross post to
microsoft.public.dotnet.framework.webservices
"David Davies" wrote: I am trying to do an identical thing
Did you ever find the solution ?
David Davies, Goldman Sachs
"Lars Moastuen" wrote:
I'm currently writing a webservice. I've successfully written a service that gives me some XML data, but now I want to link a XLS-stylesheet to that data. The way I'm trying to do that is to create a webmethod that returns a XmlDataDocument, and use CreateProcessingInstruction() to add a "stylesheet-header"... Problem is that the headers I add using CreateProcessingInstruction() seems to be removed (?) when the data is transferred over the web. When I use XmlDocument.Save() the output is fine... What causes this? Is there any workaround?
The optimal solution would allow me to return a ADO.NET DataSet, and still link an XLS-datasheet to the document. Reason is that I'm intending to use the service with crystal reports through the ADO.NET driver (doesn't recognize methods not returning DataSet). Is there a way?
My method is as follows: [WebMethod] public XmlDataDocument test() { Basin tree = db.GetBasinTree();
DataSet ds = new DataSet(); ds.EnforceConstraints = false; DataTable tb = ds.Tables.Add("basin"); tb.Columns.Add("basinid", typeof(Decimal)); tb.Columns.Add("basinname", typeof(String)); tb.Columns.Add("parent", typeof(Decimal)); tb.Columns.Add("haschildren", typeof(bool)); AddBasinChildren(tb, tree);
XmlDataDocument xmlDoc = new XmlDataDocument(ds); String stylesheet = "type=\"text/xsl\" href=\"test.xsl\""; XmlProcessingInstruction xlsNode = xmlDoc.CreateProcessingInstruction("xml-stylesheet", stylesheet); xmlDoc.InsertBefore(xlsNode, xmlDoc.DocumentElement); xmlDoc.Save("c:\\temp\\thisworks.xml");
return xmlDoc; }
Help appreciated! Lars Moastuen GeoKnowledge
Try Cross posting to dotnet.framework.webservices
"David Davies" wrote: I am trying to do an identical thing
Did you ever find the solution ?
David Davies, Goldman Sachs
"Lars Moastuen" wrote:
I'm currently writing a webservice. I've successfully written a service that gives me some XML data, but now I want to link a XLS-stylesheet to that data. The way I'm trying to do that is to create a webmethod that returns a XmlDataDocument, and use CreateProcessingInstruction() to add a "stylesheet-header"... Problem is that the headers I add using CreateProcessingInstruction() seems to be removed (?) when the data is transferred over the web. When I use XmlDocument.Save() the output is fine... What causes this? Is there any workaround?
The optimal solution would allow me to return a ADO.NET DataSet, and still link an XLS-datasheet to the document. Reason is that I'm intending to use the service with crystal reports through the ADO.NET driver (doesn't recognize methods not returning DataSet). Is there a way?
My method is as follows: [WebMethod] public XmlDataDocument test() { Basin tree = db.GetBasinTree();
DataSet ds = new DataSet(); ds.EnforceConstraints = false; DataTable tb = ds.Tables.Add("basin"); tb.Columns.Add("basinid", typeof(Decimal)); tb.Columns.Add("basinname", typeof(String)); tb.Columns.Add("parent", typeof(Decimal)); tb.Columns.Add("haschildren", typeof(bool)); AddBasinChildren(tb, tree);
XmlDataDocument xmlDoc = new XmlDataDocument(ds); String stylesheet = "type=\"text/xsl\" href=\"test.xsl\""; XmlProcessingInstruction xlsNode = xmlDoc.CreateProcessingInstruction("xml-stylesheet", stylesheet); xmlDoc.InsertBefore(xlsNode, xmlDoc.DocumentElement); xmlDoc.Save("c:\\temp\\thisworks.xml");
return xmlDoc; }
Help appreciated! Lars Moastuen GeoKnowledge This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Shawn |
last post by:
Hi.
I'm using XMLDOM to write xml to the browser, but it won't display the
encoding I've specified.
This is the code I'm using:
Set objPI = xmlDoc.createProcessingInstruction("xml",...
|
by: Lars Moastuen |
last post by:
I'm currently writing a webservice. I've successfully written a
service that gives me some XML data, but now I want to link a
XLS-stylesheet to that data. The way I'm trying to do that is to...
|
by: sd |
last post by:
Hello All,
I aplogize if this has already been answered however I
couldn't find anything related to this...
I have bunch of webservices written in vb.net returning
native data types, due to...
|
by: schneider |
last post by:
The DocumentElement is always null? and is readonly?
How to I add node items to the root?
I'm try to create a document from nothing.
All the samples start by loading a string or file.
...
|
by: Raj |
last post by:
I am using a SOAP WebMethod -ASP.net (wse2.0)
public SoapEnvelope Request()
{
return SoapEnvelope
}
The results come back in an indented format as below even if I dont have any
newline or...
|
by: Peter McEvoy |
last post by:
Folks,
I've been building a Webservice API for a contract that will be exposed to
the internet at large. There are two endpoints, and each endpoint contains a
number of webmethods. Every...
|
by: MattBell |
last post by:
I've tried to search for an answer to this without much success, and I think
it's probably a common thing to do:
I have a web service I want to accept an XmlDocument as an argument which
conforms...
|
by: Thirsty Traveler |
last post by:
I have a WebMethod as follows:
public XmlDocument OrderContract(XmlDocument doc)
{
return OrderBLL.OrderContract(doc);
}
However, the client is generating a compile error when the...
|
by: olrt |
last post by:
Hello,
I have designed a WebService with the following method :
public DbAppAnswer GetDs(DbAppRequest request)
DbAppRequest and DbAppAnswer are defined as :
|
by: Martin Pöpping |
last post by:
Hello,
is there a way to add a stylhesheet like:
<?xml-stylesheet type="text/css" href="styles.css" ?>
to an XmlDocument?
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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...
|
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,...
| | |