none
Mysterious <atom:link>http://www.w3.org/2005/Atom</atom:link>

    Question

  • I have the requirement to add the following (xmlns:atom) to my xml document in the topmost element:

    <feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:atom="http://www.w3.org/2005/Atom"

    I accomplish this by using the XmlSerializerNamespaces as follows:

     

                                    XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

                                    ns.Add("atom", "http://www.w3.org/2005/Atom");

     

    This works great, but for some odd reason it is also adding the following at the tail end of the document which is breaking the xsd validation:

     

      <atom:link>http://www.w3.org/2005/Atom</atom:link>

    </feed>

     

     

    Question is, how do I prevent this from appearing or what is the best way to remove it?  I've tried to search for this node and replace it with no success, but the ideal solution would be to just prevent it in the first place.  The xml document that is generated is large (>100MB) so this task needs to take performance into consideration.

     

    Thank You



    Tuesday, April 05, 2011 3:53 PM

Answers

  • Can you show us a minimal but complete sample allowing us to reproduce the problem? Is there any chance that your XmlRoot class that you serialize has a property set up to be serialized as an "atom:link" element? I don't think XmlSerializer creates any elements without there being properties in the object it serializes.
    MVP Data Platform Development My blog
    • Marked as answer by Chris Fink Tuesday, April 05, 2011 5:16 PM
    Tuesday, April 05, 2011 4:20 PM