Sign in to follow this  


Recommended Posts

Hi, I'm trying to dynamically allocate form controls at runtime. The first step is to parse Form Designer files generated by visual studio. I didnt encounter any problems while writing the xml file (using xmltextwriter) but reading seems to be tricky.

XmlTextReader reader = new XmlTextReader("titles.xml");
reader.WhitespaceHandling = WhitespaceHandling.Significant;
string nsName = reader.ReadElementString("namespace");
string className = reader.ReadElementString("class");
reader.ReadStartElement("statement"); // exception here
        <expression type>invocation</expression type>
            <expression type>boolean</expression type>

This is a simplified version of my xml file with only one statement but the problem is still there. (Exception: "< is unexpected token. The exptected token is '='") I think i have a problem with my xml format but i can't find the problem.

Share this post

Link to post
Share on other sites
I don't know if this is the only problem, but you can't have element names with spaces in them ("<expression type>"). Try something like expression_type.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this