VS 2008. Using xmltransform in Mobile Device. NET 3.5
I am very new to Visual Studio 2008 and .Net, and can normally resolve most issues with internet searching, but I've hit an issue and am completely stumped.
I'm trying to build a mobile application using Visual Studio 2008. By default, the application seems to have imported a number of classes from the Compact Framework 3.5.
One part of my application involves taking an XML file, and translating it using an XSL script to another format. I am comfortable with the script.
However, when I come to use the 'system.xml.xsl.transform' functionality to do this transform, it shows up as an error in the editor:
In the 'Object Browser' it shows two different 'system.xml' classes. One of them has the xsltranslate available as 'system.xml.xsl.xsltranslate'. Another one (Labelled 'Compact Framework') doesn't, and has only 'system.xml.xsl.xslexception' available.
Namespace or type specified in the Imports 'System.Xml.Xsl.xmltransform' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
I tried removing the compact framework 'system.xml' reference from my project, and installing the other one instead (Which seems to be from .net v2)
which then appeared fine in the editor, but crashed on the mobile device, saying that the app was not designed for .net v2.
I've also tried using xsl.compiledtransform, but this seems to have the same problems. Available if I import the references for .net v2, but not if I use the references from CF v3.5.
How can I get the ability to apply an xsl translation to an XML document on a windows mobile device? (I'm currently targetting Windows Mobile 6, but want it to work on older devices also).
Would it work to update all my references to .net V2, or am I just landing myself with future problems?
Thanks in advance,
PS - Sorry if I'm using the wrong terminology. This is my first foray into detailed programming !
Hi, Ian: For Windows Mobile applications, you are limited to the functionality provided by the Compact Framework. You should remove references to the full .NET Framework (what you refer to as v2) from your project. See if this helps: http://social.msdn.microsoft.com/For...2-838712e382e4
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Thanks for your reply. I'm afraid the link in your answer was a few levels above my current level of expertise, but I'll keep trying to work it out.
As far as I can see, I need to get hold of 'msxml.tlb' and use this instead of the CF framework. I can see msxml.dll, but if it's better to use 'msxml.tlb', how do I get hold of this file?
Thanks again for your help,
Just wanted to say a big thank you for your help.
It's working in Windows Mobile 6 now. I just need to test it on a few other platforms, but as far as I can see, it's looking good. I didn't bother with the tlb file, and just used the msxml.dll. In case it helps anyone, here's some of the ugliest code in the world. Now I need to work out how to clean it up
' Establish an XMLDocument for the XML Data I want to translate.
Dim XMLHeader as new MSXML.DOMDocument
' ..... The script that sets the value in my input XML data
' THE TRANSLATION PART
' Determine the file path where the XSL script will be stored on the device
Dim path As String = System.Reflection.Assembly.GetExecutingAssembly().GetModules(0).FullyQualifiedName
path = path.Substring(0, path.LastIndexOf("\"))
' Establish the input source document, xsl script and output document
Dim Input As New MSXML.DOMDocument
Dim inputxsl As New MSXML.DOMDocument
Dim OutputDocument As String
' Load the XSL script
inputxsl.load(path + "\MyTranslationScript.xslt")
' Load the order header from the original XML data
' Now perform the translation
OutputDocument = Input.transformNode(inputxsl)
MsgBox("Successfully transformed the xml :" + OutputDocument)
I took the exact same code, and attempted to use it on a Pocket PC 2003. When I do this, and debug it, I have a problem with this line:
OutputDocument = Input.transformNode(inputxsl)
In Windows Mobile 6, the OutputDocument object is the result of putting Input through the inputxsl transformation. This is how it should be.
In Pocket PC 2003, the OutputDocument object is simply the contents of the inputxsl file. ie. The translation isn't working.
I'd very much welcome any suggestions.
Is it possible I imported the msxml.dll wrongly, or need to find some other version of msxml.dll (msxml2.dll or msxml.tlb) to get this working?
By Robert Lantry in forum .NET
Last Post: 04-05-2002, 08:03 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center