Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > ASP.NET

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-16-2009, 03:23 PM
ian.morgan ian.morgan is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
VS 2008. Using xmltransform in Mobile Device. NET 3.5

Hi Forum,

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:

Quote:
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.
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.

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,

Ian.

PS - Sorry if I'm using the wrong terminology. This is my first foray into detailed programming !
Reply With Quote
  #2  
Old 10-16-2009, 04:50 PM
Phil Weber Phil Weber is offline
Super Moderator
 
Join Date: Nov 2003
Location: Portland, OR
Posts: 8,171
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
__________________
Phil Weber
http://www.philweber.com

Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Reply With Quote
  #3  
Old 10-16-2009, 06:06 PM
ian.morgan ian.morgan is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
Hi Phil,

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,

Ian.
Reply With Quote
  #4  
Old 10-16-2009, 08:36 PM
ian.morgan ian.morgan is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
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

Quote:

' 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
Input.loadXML(XMLHeader.OuterXml)
' Now perform the translation
OutputDocument = Input.transformNode(inputxsl)
MsgBox("Successfully transformed the xml :" + OutputDocument)
Thanks again,

Ian.
Reply With Quote
  #5  
Old 10-26-2009, 06:02 PM
ian.morgan ian.morgan is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
Me Again....

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?

Thanks again,

Ian.
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
.NOT vs .NET Robert Lantry .NET 88 04-05-2002 08:03 AM


All times are GMT -4. The time now is 11:31 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.