Add a namespace to the serialization process?

Topics: serialization
May 22, 2012 at 10:37 PM


In serializing to GraphML, I would like to serialize my node data into an element structure that is understood by yEd.

As such, I need to add a namespace (xmlns:y="") to the serializer and customize my node serialization.

    public class Node {
        public XmlSerializerNamespaces xmlns;

        public Node(string name) {
            Name = name;
            xmlns = new XmlSerializerNamespaces();
            xmlns.Add("y", "");
            xmlns.Add("yed", "");

        public string Name { get; set; }


However, after calling the QuickGraph serializer, 

var settings = new XmlWriterSettings();
settings.Indent = true;

var writer = XmlWriter.Create(outpath + Path.DirectorySeparatorChar + name + ".graphml", settings);
graph.SerializeToGraphML(writer, graph.GetVertexIdentity(), graph.GetEdgeIdentity());

the new namespaces do not show up.  Anyone encounter such an issue before or know how to solve it?