473,569 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlResolver in .NET v1.1

In pre v1.1, this is how I would do an Xsl transformation:

System.IO.FileS tream fs = new System.IO.FileS tream(sFilePath ,
System.IO.FileM ode.Create);
System.Xml.XmlT extWriter xtw = new System.Xml.XmlT extWriter(fs,
System.Text.Enc oding.Unicode);
try
{
XmlDataDocument xmlDoc = new XmlDataDocument (SomeDataSet);
System.Xml.Xsl. XslTransform xslTran = new System.Xml.Xsl. XslTransform();
xslTran.Load(Xs lPathUrl);
xslTran.Transfo rm(xmlDoc, null, xtw);
xtw.Close();
}
catch (Exception ex)
{
xtw.Close();
throw(ex);
}

Now in v1.1 I have to use an XmlResolver. The code below works perfectly,
except, I'm not sure if I'm repeating myself since I have to pass the
XmlResolver in two places. Any thoughts? Is this the right way?

System.IO.FileS tream oFileStream = new System.IO.FileS tream(sFilePath ,
System.IO.FileM ode.Create);
System.Xml.XmlT extWriter oXmlTextWriter = new
System.Xml.XmlT extWriter(oFile Stream, System.Text.Enc oding.Unicode);

try
{
XmlDataDocument oXmlDataDocumen t = new XmlDataDocument (SomeDataSet);
XslTransform oXslTransform = new XslTransform();

XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver( );
oXmlUrlResolver .Credentials = CredentialCache .DefaultCredent ials;
Evidence oEvidence = XmlSecureResolv er.CreateEviden ceForUrl(XslPat hUrl);

oXslTransform.L oad(XslPathUrl) ;
oXslTransform.T ransform(oXmlDa taDocument, null, oXmlTextWriter,
oXmlUrlResolver );

oXmlTextWriter. Close();
}
catch (System.Excepti on ex)
{
oXmlTextWriter. Close();
ExceptionManage r.Publish(ex);
throw(ex);
}
Nov 18 '05 #1
0 979

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

Similar topics

2
8790
by: Showjumper | last post by:
I've got the following code. But the XSLTransform line is underlined by the blue squiggle and vs tells me c:\inetpub\wwwroot\Sites\RiderDesign\articles\test.aspx.vb(37): 'Public Sub Transform(input As System.Xml.XPath.IXPathNavigable, args As System.Xml.Xsl.XsltArgumentList, output As System.IO.Stream)' is obsolete: 'You should pass...
4
5312
by: Erwin Gabler | last post by:
Trying to validate a document with a reference to a DTD ("PUBLIC" identifier): <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE systems-description PUBLIC "-//foo/nono" ""> .... The DTD uses some kind of parameter entity with a reference to an entity file:
2
1624
by: Paul | last post by:
Hi I'm currently having a problem with XMLResolvers. To put it simply using the same stylesheet and the same xml I am getting different results. When using the code and style sheet below. I get the following. The first file I create, using the obsolete method, creates the text1.txt file correctly. It creates a file with just a single...
1
2594
by: rocio | last post by:
I'm trying ti use the example in http://support.microsoft.com/default.aspx?scid=kb;en-us;330587#appliesto but doe s not work. I keep getting the error Public WriteOnly Property XmlResolver() as...is obsolete: Pass XmlResolver as Transfer() method. does anyone know of a good example to do this? Tx!
4
3971
by: damien morton | last post by:
Hi, I need some help... Im trying to use XmlValidatingParser with a custom XmlResolver. Im finding, however, that the custom resolver never gets called, and that the XmlValidatingParser acts as a non-validating parser I created a custom resolver called XmlBreakingResolver, whos GetEntity and ResolveUri methods have breakpoints set in them...
2
1587
by: Bennett Smith | last post by:
Could anyone within Microsoft comment on the status of the XmlResolver class in upcoming versions of the .NET framework? I am particularly interested in hearing about any improvements in how PUBLIC and SYSTEM entity references are handled. My hope is that improvements have been made that would finally allow one to build an XmlResolver that...
3
2375
by: Rouven Hertenstein | last post by:
Hi, I'm trying to test the vb.net-exercise "How to use a DataSet with the Office XP Chart Component and ASP.NET" on http://support.microsoft.com/kb/303016/en-us Visual Studio rails against the expression: "xslTran.Transform(xmlDoc_ds, Nothing, context.Response.Output)" and comments: "Public Sub Transform(input As...
1
1676
by: Keith Chadwick | last post by:
Have been doing a fair amount of reading but at this point no joy. The scenario is - XSL template is stored within db. - Template has a xsl:include statement as <xsl:include href="inc.template.methods.xsl"/> I now I have to pass a resolver when I use the load method so that it understands the xsl include as in:
1
2152
by: cashdeskmac | last post by:
I have this code from an example on the MSDN site: Dim rdr As New XmlTextReader("http://localhost/bookstore/book.xml") rdr.XmlResolver.Credentials = CredentialCache.DefaultCredentials Dim doc As New XmlDocument doc.Load(rdr) However, I get an error under rdr.XmlResolver, saying that it is Write Only. I have imported the appropriate...
0
7694
marktang
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...
0
7609
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...
0
7921
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. ...
1
7666
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...
1
5504
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...
0
5217
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...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
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...

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.