Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:32:14+00:00 2026-06-18T12:32:14+00:00

I’m looking for options to convert C# to XML and also deserialize back to

  • 0

I’m looking for options to convert C# to XML and also deserialize back to C# again. Anyone know of any existing solutions for this? I assume a Roslyn SyntaxTree is not Xml-serializable. I also assume making a xml-serializer for a syntaxtree would be quite a large undertaking. But maybee not?

Why do I need this? I want to generate code from an xml-model via xsl to syntaxtree-xml and then to c# (or maybee vb).

I don’t want to generate C# directly from XSL (can be done but I don’t feel it’s ideal). I need XSL because I’m also going to generate XAML and HTML from the XML-model and I’d like to also be able to generate any code behind needed etc.

I know about T4-templates but right now I’m looking at other options for various reasons.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:32:15+00:00Added an answer on June 18, 2026 at 12:32 pm

    Roslyn is an open compiler. I assume you can straightforwardly insert your own code to walk over the AST and dump it in XML format. Given that it is open, presumbly you can implement your own extension to read your dumped XML, and build a Roslyn AST (which I think can then be prettyprinted). That seems like a lot of work.

    For a canned solution, see C# AST in XML. A similar read-XML-to-make-AST would be needed for that solution, too.

    You might not want to use XML for trees; such files are generally enormous. See What would an AST (abstract syntax tree) for an object-oriented programming language look like?.

    It is likely better for you to operate within the context of a tool that parses and builds ASTs, do your manipulation directly on those ASTs, and then prettyprint the result. Our DMS system has both parsing (shown by the previous two examples) and prettyprinting for many languages including C# already built-in, and many useful APIs for inspecting/modifying/generating code from the ASTs it constructs. (XSL is lot less useful for analyzing ASTs than you might think; it doesn’t understand “context” [e.g., the surrounding scopes and declarations] that give programs the meaning they have).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.