473,804 Members | 3,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlUrlResolver & document()

Hi,

I try to use document() function in XSLT, but looks like .Net XSLT parser don't try to resolve external URL. Does any body know what can be wrong here :
=============== ==C#=========== ===============
public class XmlUrlResolverE xt:XmlUrlResolv er
{
private static readonly ILog log = LogFactory.GetL ogger(System.Re flection.Method Base.GetCurrent Method().Declar ingType);

public XmlUrlResolverE xt() : base() { }
public override object GetEntity(Uri uri, string role, Type type)
{
log.Debug(strin g.Format("XmlUr lResolverExt.Ge tEntity('{0}',' {1}','{2}')",ur i.ToString(), role, type.ToString() ));
return base.GetEntity( uri, role, type);
}
public override Uri ResolveUri(Uri uri, string relativeUri)
{
log.Debug(strin g.Format("XmlUr lResolverExt.Re solveUri('{0}', '{1}')", uri.ToString(), relativeUri));
return base.ResolveUri (uri, relativeUri);
}
}
............... ............... ............... ............... .........
............... ............... ............... ............... .........

XslTransform oProcessor = new XslTransform();
XsltArgumentLis t oXslArgs = new XsltArgumentLis t();
XmlUrlResolverE xt oResolver = new XmlUrlResolverE xt();
XmlTextWriter oWriter = new XmlTextWriter(" Output.xml", System.Text.Enc oding.UTF8);

oResolver.Crede ntials = new NetworkCredenti al("User", "pwd", "domain");

oProcessor.Load (new XmlTextReader(p XSLTFile), new XmlUrlResolverE xt());

oXslArgs.AddPar am("paramFilena me", "", sFileName); // sFileName - network path in following format \\server\share\ file.xml

oProcessor.Tran sform(oXmlDoc, oXslArgs, oWriter, oResolver);

=============== ===XSLT======== ==============

<?xml version="1.0" encoding="UTF-8" ?>
............... ............... ............... ............... ............
............... ............... ............... ............... ............
<xsl:param name="paramFile name"/>
<xsl:variable name="docActual sFile" select="documen t($paramFilenam e)"/>
............... ............... ............... ............... ............
............... ............... ............... ............... ............

------------------------------------------
Thanks,
Maxim
Nov 12 '05 #1
6 1890
Maxim Kazitov wrote:
public override Uri ResolveUri(Uri uri, string relativeUri)
{

log.Debug(strin g.Format("XmlUr lResolverExt.Re solveUri('{0}', '{1}')",
uri.ToString(), relativeUri));


That's the problem. uri is null, so ResolveUri method throws an
exception and so resolving process gets skipped.

--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com
Nov 12 '05 #2
Yes, you are right, I fix it And ResolveUri working fine, but I don't see any call's for GetEntity, and XSLT doesn't work any way.
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!P LEASEtkachenko. com> wrote in message news:u%******** ********@TK2MSF TNGP10.phx.gbl. ..
Maxim Kazitov wrote:
public override Uri ResolveUri(Uri uri, string relativeUri)
{

log.Debug(strin g.Format("XmlUr lResolverExt.Re solveUri('{0}', '{1}')",
uri.ToString(), relativeUri));


That's the problem. uri is null, so ResolveUri method throws an
exception and so resolving process gets skipped.

--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com

Nov 12 '05 #3
I try to include file://<SERVER>/<DIR>/SOME.XML and looks like it's
doesn't work for file:// protocol (all MSDN examples related to HTTP
protocol).
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!P LEASEtkachenko. com> wrote in message
news:u%******** ********@TK2MSF TNGP10.phx.gbl. ..
Maxim Kazitov wrote:
public override Uri ResolveUri(Uri uri, string relativeUri)
{

log.Debug(strin g.Format("XmlUr lResolverExt.Re solveUri('{0}', '{1}')",
uri.ToString(), relativeUri));


That's the problem. uri is null, so ResolveUri method throws an exception
and so resolving process gets skipped.

--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com

Nov 12 '05 #4
Looks like I found the problems (thanks to all).

Interesting links :
http://msdn.microsoft.com/library/de...l/xinclude.asp

http://msdn.microsoft.com/xml/defaul.../cusxmlres.asp
http://support.microsoft.com/kb/325692/EN-US/

"Maxim Kazitov" <mv*****@tut.by > wrote in message news:ub******** ******@TK2MSFTN GP14.phx.gbl...
I try to include file://<SERVER>/<DIR>/SOME.XML and looks like it's
doesn't work for file:// protocol (all MSDN examples related to HTTP
protocol).


"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!P LEASEtkachenko. com> wrote in message
news:u%******** ********@TK2MSF TNGP10.phx.gbl. ..
Maxim Kazitov wrote:
public override Uri ResolveUri(Uri uri, string relativeUri)
{

log.Debug(strin g.Format("XmlUr lResolverExt.Re solveUri('{0}', '{1}')",
uri.ToString(), relativeUri));


That's the problem. uri is null, so ResolveUri method throws an exception
and so resolving process gets skipped.

--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com


Nov 12 '05 #5
Maxim Kazitov wrote:
I try to include file://<SERVER>/<DIR>/SOME.XML and looks like it's
doesn't work for file:// protocol (all MSDN examples related to HTTP
protocol).


XmlUrlResolver class you are using is able to resolve file://, http://
and https:// protocols, see
http://msdn.microsoft.com/library/de...classtopic.asp.
The rest (such as network share) you have to implement yourself.
GetEntity doesn't get called when RersolveUri returns null.

--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com
Nov 12 '05 #6
Maxim Kazitov wrote:
Looks like I found the problems (thanks to all).

Interesting links :
http://msdn.microsoft.com/library/de...l/xinclude.asp


I'm glad you found my article interesting :) Beware that links in that
article are mostly dead. XInclude.NET is now a part of the Mvp.Xml
library, see http://mvp-xml.sf.net

--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com
Nov 12 '05 #7

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

Similar topics

6
3946
by: mali_djuro | last post by:
Hi all, i used JDOM to create XML file. first, i get data from database and create Document object. in some data i have quotas, so it makes replacment in content of elements. for example: if i have "Hi" in database, i will have &quot;Hi&quot; in content of element. And it is ok, because in xml does not exist ", at least i think that. After it i want to make convert from document to string. I used XMLOutputter serializer = new...
4
3230
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know that I could externalize my JavaScript, but that will not be practical throughout this application. Is there any way to get around this issue? Xalan processor. Stripped down stylesheet below along with XHTML output. <?xml version='1.0'?>...
6
2926
by: Gideon de Swardt | last post by:
I am trying to do a server side transformation using an xsl:include in my xslt stylesheet. The include stylesheet is stored /Library/abo.Library.xslt and is included in multiple xslts, one example would be /Valuation/ValuationSelect.xslt which is also used on the client side via JavaScript and MSXML2.FreeThreadedDOMDocument.4.0. Client side the include and transformation without any problems but it is when I am trying to do the...
11
6446
by: Jeremy | last post by:
How can one stop a browser from converting &amp; to & ? We have a textarea in our system wehre a user can type in some html code and have it saved to the database. When the data is retireved and
1
3135
by: pachyphloia | last post by:
I have a problem understanding what is happening when inheriting from XmlUrlResolver. Using standard settings (including the default XmlResolver) I can use a dtd given in the doctype for validation without problems. xml doctype: <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd"> code:
6
2251
by: cj | last post by:
I'm receiving an xml formatted string that I pull data from by reading it into an xml document like this: Dim doc As New Xml.XmlDocument doc.LoadXml(respstr) Dim co_name As Xml.XmlNodeList = doc.GetElementsByTagName("co_name") textbox1.text = co_name(0).innertext Now I'm getting company names that have ampersands in them. I was not aware that was not allowed in xml and had no method of dealing with it.
14
5941
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only because of this, so I hope some of you gurus can enlighten me with this :) In what circumstances can the "&amp;" in the source code be involuntary changed to "&" by a browser when or other software, when editing and uploading the file to the web...
12
10124
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b) ..... // xsl contents abc.aspx?p1=v1&amp;p2=<xsl:value-of select="$v2" />
0
9706
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9582
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
10580
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
7621
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
6854
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();...
0
5525
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
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.