473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Transform XML with XSL in compact framework (c#)

12
I know compact framework doesn't support XslTranform, but is ther any way that you can work around this if you want to transform a XML-document with a XSL sheet?
Mar 22 '07 #1
11 8694
Sladan
12
check this http://www.xprogramming.com/xpmag/ac...xperiments.htm
Thanks, but you cant use XslTransform in compact framework :-(
Mar 22 '07 #3
dorinbogdan
839 Expert 512MB
You can use MSXML DOM object, by importing the type library or through Reflection.
See these 2 C# examples.
To apply the XSL template over XML use the transformNode() method of the DOM object.

For reference, I give you a JavaScript example:
[html]<PRE nd="52"><html>
<body>

<script type="text/javascript">

// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("cdcatalog.xml")

// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("cdcatalog.xsl")

// Transform
document.write(xml.transformNode(xsl))

</script>

</body>
</html>
</PRE>[/html]

You can use the version existing on your system:
MSXML2.DOMDocument.3.0,
MSXML2.DOMDocument.4.0 or
Microsoft.XMLDOM

If not sure what version you have, run Start/Run/regedit, and search for it.
Mar 22 '07 #4
dorinbogdan
839 Expert 512MB
A simpler solution to use the XML DOM object:
From Project/Add Reference/COM add a reference to Microsoft XML v4.0.
Add this line in code:
Expand|Select|Wrap|Line Numbers
  1. using MSXML2;
Then you can instantiate a DOM object, like:
Expand|Select|Wrap|Line Numbers
  1. MSXML2.DOMDocument40 doc = new DOMDocument40Class();
  2.  
When using the doc object you will see listed all its methods:
doc.load, doc.loadXML, doc.transformNode....

I hope this helps.
Mar 22 '07 #5
Sladan
12
Yes it did! Thanks a lot! I had almost given up. :-)
Mar 23 '07 #6
dorinbogdan
839 Expert 512MB
Glad to hear that.
You're always welcome.
God bless you,
Dorin.
Mar 23 '07 #7
Sladan
12
It seems that I took out my victory a little to early. I tried to add the dll-file like you said.

"From Project/Add Reference/COM add a reference to Microsoft XML v4.0."

However I didn't have a section named COM. So i downloaded msxml4.dll and tried to add it, but i didn't work. So i downloaded msxml3.dll instead and it worked fine.

Now I wrote

Expand|Select|Wrap|Line Numbers
  1. using MSXML2;
  2.  
and then

Expand|Select|Wrap|Line Numbers
  1. MSXML2.DOMDocument30 doc = new DOMDocument30Class();
  2.  

I get a COMException and the following description:

COM object with CLSID '{F5078F32-C551-11D3-89B9-0000F81FE221}' cannot be created due to the following error: 0x80040154.

Thanks in advance!
Mar 23 '07 #8
dorinbogdan
839 Expert 512MB
Did you register the dll?

If not, try to run "regsvr32 msxml3.dll" within Start/Run.
Or install the MSXML kit.
Mar 23 '07 #9
Sladan
12
Only getting errors, I guess it could be Vista messing it up. I'll just have to write a converter manually. Thanks anyway, really appreciate you taking an interest in my problem.
Mar 26 '07 #10
dorinbogdan
839 Expert 512MB
I'm sorry about that strange behavior.
However, keep the contact here.

Regarding the compact framework, try also to post any questions on .Net forum.

Thanks,
Dorin.
Mar 26 '07 #11
I want convert the xml file to html file.I have xml file in \\abc.xml and xls file is in D:\abc.xsl can u tell the code to get abc.html after the fallowd line.

MSXML2.DOMDocument40 doc = new DOMDocument40Class();

Regardds,
koti.

I'm sorry about that strange behavior.
However, keep the contact here.

Regarding the compact framework, try also to post any questions on .Net forum.

Thanks,
Dorin.
Mar 13 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: boble | last post by:
Sorry, it's may be off topic ;_((( The following article http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppc2k3/ht ml/winmob03.asp states that a.. Microsoft Windows .NET...
0
by: Earle Oxner | last post by:
We are developing an application on PocketPC2002 platform and we are trying to make webservice calls using HTTPS. HTTP works fine but HTTPS does not work. The same code which doesn't work on...
2
by: Duncan | last post by:
I am using the evaluation version of CE.NET 4.1. I had also installed the release version of the Compact Framework. I uninstalled the CE.NET 4.1, and then realized I needed it again and...
1
by: Asad Khan | last post by:
Hi, I have Visual Studio 2002 Enterprise Architecture Edition. I was wondering if anyone has any information on how I can develop applications for .Net Compact Framework using this IDE. I've heard...
2
by: paul | last post by:
I have developed an application for pocket pc that requires multiple forms to be open at any one time. The user is able to flick from one to the other, making changes to each as and when necessary...
4
by: André Giesing | last post by:
Hello NG! I've got a short question: Is there a difference of the internal representation of a Hashtable between the Compact Framework and the normal Framework? I've got the suspicion,...
0
by: Roland Rosier | last post by:
Hello, I am trying to understand Managed C++ and the .Net Framework, and as far as I can tell, you add a /CLR option to the compiler to make it generate MSIL from C++. However, I need to...
5
by: brett | last post by:
When I do Console.Write("something here") or WriteLine() on the Compact Framework, nothing appears in the output window. I have also tried it on another developer's machine with the same results. ...
1
by: Sladan | last post by:
I know compact framework doesn't support XslTranform, but is ther any way that you can work around this if you want to transform a XML-document with a XSL sheet?
3
by: Greg | last post by:
Hello all, I am looking to download an image from a website from within a compact framework pda app. I have tried everything I could find and thus I turn to you. Any help or suggestions would be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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...
0
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,...
0
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...

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.