IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

VS2010 C# Code Generation Options · View
VitalyT
Posted: Tuesday, August 17, 2010 3:03:39 PM
Rank: Member

Joined: 4/9/2009
Posts: 11
Even though XMLSpy 2010.3 SP1 received some treatment to work with VS2010, the part where it generates C# code wasn't really updated.

I'm seeing the same old code syntax that was there since VS2005. And it makes use of now obsolete code, which produces compilation warnings, like the one shown below...

For project AltovaXML it creates file xmldocument.cs which uses the following constructor for XmlNode class:
Code:

        static public XmlNode Load(string filename)
        {
            XmlDataDocument doc = new XmlDataDocument();
            doc.Load(filename);
            return doc;
        }

This produces warnings during compilation:
xmldocument.cs(23,4): warning CS0618: 'System.Xml.XmlDataDocument' is obsolete: 'XmlDataDocument class will be removed in a future release.'

Maybe there wasn't as much change in the XML layer from VS2005 to VS2008, but there is plenty of change with VS2010 now, and Altova team was expected to respond accordingly.

For now we have to change the code manually every time after generation, wasting our time and wondering how much performance we are losing by using the obsolete code instead of the new XML code...
Code:

        static public XmlNode Load(string filename)
        {
#pragma warning disable 618
            XmlDataDocument doc = new XmlDataDocument();
#pragma warning restore 618
            doc.Load(filename);
            return doc;
        }

We are going to update our XMLSpy Enterprise license, but hiccups like this make it a hard decision, because we are not getting anything new in the code generation.

Please, Altova developers, step in and make it done right!




vlad
Posted: Wednesday, August 18, 2010 8:47:26 AM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
Thanks for pointing to this - it was an oversight on our side without any consequences though - your code will work both with XMLDataDocument and with XMLDocument, but in order to avoid such warnings in future we will change the call in v2011.

And, if I may add, you sound a bit unfair to us. I'm sure you do not run to Microsoft and complain with them, because they didn't update their XSLT engine to XSLT 2.0 since many years. But you fall in panic if you see a warning from a code generated by Altova XMLSpy. Please be rest assured - we are testing our software before releasing it and we made sure it works in VS2010!
Rocco
Posted: Wednesday, August 18, 2010 10:39:20 AM
Rank: Advanced Member

Joined: 5/16/2009
Posts: 82
Hi VitalyT,

You could modify some of the file used for the code generation rather than changing every time the generated code. You can find them in:

C:\Program Files\Altova\XMLSpy2010\spl\

For example, such 'Load' method is located in:

C:\Program Files\Altova\XMLSpy2010\spl\cs\AltovaXML\XMLDocument.cs

In some case you may have to modify the template files (.spl) located in that very same folder. Here it is the documentation about SPL.

Hope this could help a bit.

Cheers

VitalyT
Posted: Wednesday, August 18, 2010 7:01:25 PM
Rank: Member

Joined: 4/9/2009
Posts: 11
Thank you, Rocco. Replacing XmlDataDocument with XmlDocument did the trick.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.