VS 2008. Using xmltransform in Mobile Device. NET 3.5


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: VS 2008. Using xmltransform in Mobile Device. NET 3.5

  1. #1
    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:

    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 !

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    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!

  3. #3
    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.

  4. #4
    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


    ' 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.

  5. #5
    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.

Similar Threads

  1. .NOT vs .NET
    By Robert Lantry in forum .NET
    Replies: 88
    Last Post: 04-05-2002, 07:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center