473,804 Members | 2,271 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebMethod, XmlDocument and CreateProcessin gInstruction

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
CreateProcessin gInstruction() to add a "stylesheet-header"... Problem
is that the headers I add using CreateProcessin gInstruction() seems to
be removed (?) when the data is transferred over the web. When I use
XmlDocument.Sav e() 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.EnforceConst raints = 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( "haschildre n", typeof(bool));
AddBasinChildre n(tb, tree);

XmlDataDocument xmlDoc = new XmlDataDocument (ds);
String stylesheet = "type=\"tex t/xsl\" href=\"test.xsl \"";
XmlProcessingIn struction xlsNode =
xmlDoc.CreatePr ocessingInstruc tion("xml-stylesheet", stylesheet);
xmlDoc.InsertBe fore(xlsNode, xmlDoc.Document Element);
xmlDoc.Save("c: \\temp\\thiswor ks.xml");

return xmlDoc;
}

Help appreciated!
Lars Moastuen
GeoKnowledge
Nov 22 '05 #1
3 2546
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
CreateProcessin gInstruction() to add a "stylesheet-header"... Problem
is that the headers I add using CreateProcessin gInstruction() seems to
be removed (?) when the data is transferred over the web. When I use
XmlDocument.Sav e() 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.EnforceConst raints = 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( "haschildre n", typeof(bool));
AddBasinChildre n(tb, tree);

XmlDataDocument xmlDoc = new XmlDataDocument (ds);
String stylesheet = "type=\"tex t/xsl\" href=\"test.xsl \"";
XmlProcessingIn struction xlsNode =
xmlDoc.CreatePr ocessingInstruc tion("xml-stylesheet", stylesheet);
xmlDoc.InsertBe fore(xlsNode, xmlDoc.Document Element);
xmlDoc.Save("c: \\temp\\thiswor ks.xml");

return xmlDoc;
}

Help appreciated!
Lars Moastuen
GeoKnowledge

Nov 22 '05 #2
Trying a cross post to
microsoft.publi c.dotnet.framew ork.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
CreateProcessin gInstruction() to add a "stylesheet-header"... Problem
is that the headers I add using CreateProcessin gInstruction() seems to
be removed (?) when the data is transferred over the web. When I use
XmlDocument.Sav e() 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.EnforceConst raints = 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( "haschildre n", typeof(bool));
AddBasinChildre n(tb, tree);

XmlDataDocument xmlDoc = new XmlDataDocument (ds);
String stylesheet = "type=\"tex t/xsl\" href=\"test.xsl \"";
XmlProcessingIn struction xlsNode =
xmlDoc.CreatePr ocessingInstruc tion("xml-stylesheet", stylesheet);
xmlDoc.InsertBe fore(xlsNode, xmlDoc.Document Element);
xmlDoc.Save("c: \\temp\\thiswor ks.xml");

return xmlDoc;
}

Help appreciated!
Lars Moastuen
GeoKnowledge

Nov 22 '05 #3
Try Cross posting to dotnet.framewor k.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
CreateProcessin gInstruction() to add a "stylesheet-header"... Problem
is that the headers I add using CreateProcessin gInstruction() seems to
be removed (?) when the data is transferred over the web. When I use
XmlDocument.Sav e() 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.EnforceConst raints = 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( "haschildre n", typeof(bool));
AddBasinChildre n(tb, tree);

XmlDataDocument xmlDoc = new XmlDataDocument (ds);
String stylesheet = "type=\"tex t/xsl\" href=\"test.xsl \"";
XmlProcessingIn struction xlsNode =
xmlDoc.CreatePr ocessingInstruc tion("xml-stylesheet", stylesheet);
xmlDoc.InsertBe fore(xlsNode, xmlDoc.Document Element);
xmlDoc.Save("c: \\temp\\thiswor ks.xml");

return xmlDoc;
}

Help appreciated!
Lars Moastuen
GeoKnowledge

Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1940
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", "version='1.0' encoding='iso-8859-1'") xmlDoc.insertBefore objPI, xmlDoc.childNodes(0) If I save it to an xml file then it displays the encoding, but when I use
3
420
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 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...
3
2663
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 constraints of the client I need to return data that has been output escaped i.e. when a string response is returned back by the service it automatically converts & to amp; and the other reserved chracters, in this case I don't want the conversion to
3
14518
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. Thanks, Schneider
2
2441
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 whitespaces as part of the SoapEnvelope even though I didnt have
2
2845
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 webmethod returns a returncode which indicates the level of success in performing the operation (as well as the actual results of the call in an "out" parameter) They have a requirement that when they want to perform maintenance on the backend system,...
4
4652
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 to a specific XSD that is defined. Right now when I declare XmlDocument as my argument, it puts the old xml:any type in. How do I change that to reflect the XSD that I'm looking for? Thanks for any Help!
8
2831
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 following lines are used:
1
1824
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 :
1
5444
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?
0
9594
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,...
0
10599
Oralloy
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...
1
10347
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,...
0
10090
tracyyun
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...
0
9173
agi2029
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...
1
7635
isladogs
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...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.