473,657 Members | 2,556 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Invalid Xml" with XmlTransform

GS
Hi!

I am getting an "Invalid Xml" exception when I try to load an xsl file
using XslTransform.Lo ad(string url). The Xsl file is valid and works
fine if I just rename the file.

There are some postings with this problem, but none of them have a
solution as yet. If anyone has any ideas on how to resolve this, please
do post.

Thank you.

Feb 17 '06 #1
7 2249
GS wrote:
Hi!

I am getting an "Invalid Xml" exception when I try to load an xsl file
using XslTransform.Lo ad(string url). The Xsl file is valid and works
fine if I just rename the file.

There are some postings with this problem, but none of them have a
solution as yet. If anyone has any ideas on how to resolve this, please
do post.

Thank you.


http://msdn.microsoft.com/library/de...loadtopic2.asp
Is this what you're doing?

using System;
using System.IO;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPat h;

public class Sample
{
private const String filename = "books.xml" ;
private const String stylesheet = "output.xsl ";

public static void Main()
{
//Load the stylesheet.
XslTransform xslt = new XslTransform();
xslt.Load(style sheet);

//Load the file to transform.
XPathDocument doc = new XPathDocument(f ilename);

//Create an XmlTextWriter which outputs to the console.
XmlTextWriter writer = new XmlTextWriter(C onsole.Out);

//Transform the file and send the output to the console.
xslt.Transform( doc, null, writer, null);
writer.Close();

}
}
Feb 18 '06 #2
GS
Yes, but it fails at ---

xslt.Load(style sheet);

Also the xml and the xsl files are not as simple as in the example.

Feb 18 '06 #3

Are you using a try/catch block and can you see the exception?

GS wrote:
Yes, but it fails at ---

xslt.Load(style sheet);

Also the xml and the xsl files are not as simple as in the example.

Feb 18 '06 #4

I've seen this happen where you may need to use special entity
characters to replace ampersands and other characters.

SO

<myxml>This & that</myxml>

becomes

<myxml>This &amp; that</myxml>

GS wrote:
Yes, but it fails at ---

xslt.Load(style sheet);

Also the xml and the xsl files are not as simple as in the example.

Feb 18 '06 #5
GS
I don't know what the problem was, but I re-installed IIS. It certainly
fixed the problem.

Feb 20 '06 #6
EvilAbD
2 New Member
I had a likely problem
this part of code:

I am working with .NET and IIS6


Expand|Select|Wrap|Line Numbers
  1. XslTransform xslt = null;
  2. try
  3. {
  4. xslt = new XslTransform();
  5. xslt.Load(currentFile);    
  6. }
  7. catch(Exception Ex)
  8. {
  9. throw new Exception("XSLLoadError", currentFile, Ex.Message);
  10. }
  11. return xslt;
was working for everybody at work exept for me
when the debbuger reach the line

Expand|Select|Wrap|Line Numbers
  1. xslt.Load(currentFile);
it was throwing an exception "Invalid xml"

I was testing the xslt, and it was fine.
I test the xslt with an altern program to transform and xml by using a xslt
and it works fine
so that, the problem was not in the xslt file

I have restarted the server several times, deleted temporal files but the same for one specific XSLT the Exception is thrown again. :confused:

I will try your solution about re-install the IIS. :cool:

for now, after being debbuging, I had the idea to rename the XSLT
and in someway, the

Expand|Select|Wrap|Line Numbers
  1. xslt.Load(currentFile);
works with my XSLT file :D

my old name was: FIN.IN.AR.Carri er.xslt
my new name: FIN.IN.AR.Carri ers.xslt

As you can see I cannot find a factible reason why was happing this issue
any idea about the real reason because

after it works I return back to the filename that was wich one I had had the problem

and the problem appeared again :confused:

regards
Mar 2 '06 #7
EvilAbD
2 New Member
Me again,

About this problem.

I delete the .NET temp files
from:
C:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322\ Temporary ASP.NET Files

besides I remove temp files by using the menu
Tools > Internet Options > delete Files > Delete All Online Content > OK

I thought that that it could fix my problem with the Invalid Xml, maybe it is a problem,
but that does not work, :mad:

I think there are a problem with the memory
with the cache memory or somethig about it :confused:

finally

I create a new website with another diferent name

I install my application in that new Site

and the problem has gone :p


I think that In some way, IIS or the Net Framework itselft was storing a reference to a wrong file

so that, when you re-install the ISS the reference was clearer
and when I create a new Site, the reference was a new one

when I was using the same site, I think it was using the same reference where the error was

If someone had a better answer for this issue
I will be waiting for it

Thanks
Mar 2 '06 #8

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

Similar topics

3
8599
by: Tjerk Wolterink | last post by:
Hello, I've xml code that looks like this: <?xml version="1.0" encoding="ISO-8859-1"?> <xc:xcontent xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent" xmlns="http://www.w3.org/1999/xhtml">
6
13588
by: TS | last post by:
Hi, i have a problem validating xml against schema. I used http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx validator and it says it is fine. Can you tell me why this doesn't work? Thanks! Schema: <?xml version="1.0"?> <xs:schema id="ReportInfo" targetNamespace="http://tempuri.org/Reports.xsd"
7
17874
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm able to encrypt and then decrypt data okay as in the following code: // encrypt the data // Encryptor enc = new Encryptor(EncryptionAlgorithm.TripleDes); byte key = Encoding.ASCII.GetBytes("0123456789012345");
3
2576
by: Arnold | last post by:
I am having problem loading the image from the database. It gives this error: "Invalid parameter used." This is my source code: Private abyt() As Byte Private fo As New OpenFileDialog Private sf As New SaveFileDialog Dim strCn As String = "Data Source=DATABASE\BARCA;" & _ "Initial Catalog=MIS;Integrated Security=SSPI" Dim cn As SqlConnection = New SqlConnection(strCn) Dim fs As IO.FileStream
0
1180
by: sjallard | last post by:
Dear all, This is my first work with the XML extenders: I'll have to decompose an XML file into a DB2 table, and "flatten" it in the same time, like in the example at the end of this message. I need to do that on an iSeries with XML Extenders V4R5, but plan to test it first on a Windows installation (DB2 Express, from the DB2 on Rails installation http://alphaworks.ibm.com/tech/db2onrails/download).
1
8015
by: Java Guy | last post by:
I'm trying to view a web page. IE tells me there are (Java?) errors on the page. Here they are: Line: 15 Char: 7 Error: Wrong number of arguments or invalid propert assignment Code: 0 URL: http://(address.of.my.webcam):port/LiveView.html and
1
4798
by: =?Utf-8?B?am1ncm8=?= | last post by:
I created a web service in visual studio 2003, tested it with a sample.xml file from a vendor we are using, and it worked exactly like it should. I deployed it to our server, created a project using the webservice with the sample.xml file, and again it worked. Now the vendor is calling the web service from their application and receiving the following error, and stating that there is something with the Web Service or the SOAP Client on...
0
3974
by: jeoffh | last post by:
Background: I am trying to "merge" some attributes into an existing XML column in my MS SQL 2005 database. The general idea is that I have an XML column in a table and I would like to update/delete some values while leaving the other values alone. I am designing this database/table/column so maybe I could use attributes or elements/nodes, the choice is ultimately mine. The one constraint is that I have to allow for customized name/value pairs....
0
1244
by: r.battistoni | last post by:
Hy to everyone I have created a simple SAX parser for a very simple XML file. When I run the code that follows I get this error: "Invalid hexadecimal character reference" The strange thing is If I change the "chunk size" for the data I send to the parser, the error row changes. This behaviour is very strange!
0
8397
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
8310
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
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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
8605
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...
1
6167
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
5632
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
4158
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...
1
2731
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

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.