473,466 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Transform XML with XSL in compact framework (c#)

12 New Member
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 8695
Sladan
12 New Member
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 Recognized Expert Contributor
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 Recognized Expert Contributor
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 New Member
Yes it did! Thanks a lot! I had almost given up. :-)
Mar 23 '07 #6
dorinbogdan
839 Recognized Expert Contributor
Glad to hear that.
You're always welcome.
God bless you,
Dorin.
Mar 23 '07 #7
Sladan
12 New Member
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 Recognized Expert Contributor
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 New Member
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 Recognized Expert Contributor
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
koti9876
3 New Member
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
1
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...
0
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...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.