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 960339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:10:03+00:00 2026-05-16T01:10:03+00:00

I am creating an XML file using the System.Xml.Serialization module. I have a class

  • 0

I am creating an XML file using the System.Xml.Serialization module.
I have a class that gets serialized into an XML file. The file looks like this:

<itemList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <itemListed>
    <item ID="81288" Synopsys="Reset search point" CompletedTime="7/27/10 4:12 PM" Resolver="owner1" />
    <item ID="81285" Synopsys="Added contructor" CompletedTime="6/05/10 9:23 AM" Resolver="owner2" />
  </itemListed>
</itemList>

Problem is, I would like it to generate this:

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="item.xsl"?>
  <itemListed>
    <item ID="81288" Synopsys="Reset search point" CompletedTime="7/27/10 4:12 PM" Resolver="owner1" />
    <item ID="81285" Synopsys="Added contructor" CompletedTime="6/05/10 9:23 AM" Resolver="owner2" />
  </itemListed>

Any idea what I need to change to my class?

My code:


public class Item
{
[XmlAttribute("ID")]
public string ID { get; set; }

    [XmlAttribute("Synopsys")]
    public string Synopsys { get; set; }

    [XmlAttribute("CompletedTime")]
    public string CompletedTime { get; set; }

    [XmlAttribute("Resolver")]
    public string Resolver { get; set; }
}

public class ItemList
{
    [XmlArray(ElementName = "itemListed")]
    [XmlArrayItem(ElementName = "item")]
    public List<Item> ItemList { get; set; }
}

I appreciate any help.
Thanks
Tony

  • 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-05-16T01:10:03+00:00Added an answer on May 16, 2026 at 1:10 am

    I haven’t found an easy way to customize the stylesheet or the encoding line but I found a good suggestion here:

    link text

    The idea is to pretty much write your own serialization class. I took the idea from the article and I created a class that serializes the class (using the C# library) then a filter modifies the header to modify the encoding line and add the stylesheet line.
    When I load the xml, I read the file, I pass it through the filter to remove the stylesheet line and I change back the encoding line. Once I have done that, I use the de-serializer provided by C#.
    It seems to work.

    Tony

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

Sidebar

Ask A Question

Stats

  • Questions 510k
  • Answers 510k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The WPF border is inheriting from class Decorator. It is… May 16, 2026 at 4:53 pm
  • Editorial Team
    Editorial Team added an answer You can't append nodes that belong to one DOM tree… May 16, 2026 at 4:53 pm
  • Editorial Team
    Editorial Team added an answer Apple has some sample code over at the iOS Dev… May 16, 2026 at 4:53 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a DataTable that I'm creating an XML file from using .WriteXML(..), although
seWhen i creating a new class file i got these namespaces by default, using
Folks, We have been using OpenXml APIs found in System.IO.Packaging for creating a package
I have a class that unmarshals xml from a 3rd party source (I have
I have an application that stores large amount of files (XML and binary) in
i am using following code to convert xml file to datatable but its just
We're about to make data transformation from one system to another using SSIS. We
Long term lurker, first time poster here. I have written a class to model
I need to parse a fairly large XML file (varying between about a hundred
I'm creating a Windows Phone 7 application that will consume an exposed webservice. For

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.