PDFsharp & MigraDoc Foundation

Migradoc xml serialization format
Page 1 of 1

Author:  emazv72 [ Wed Jul 18, 2018 10:11 am ]
Post subject:  Migradoc xml serialization format

Hello all,

Would you be interested in an alternative serialization format for the Migradoc Document?


- need to replace the reporting engine of an aging application with a full featured, template driven, no bells and whistles pdf generator tool.
- MigraDoc & PDFSharp ( + Mustache for data ) fit that scenario but...
- ... proprietary DDL language is an issue for us ( readability issues, unfamiliar syntax, lack of formatting tools, lack of a schema, etc )

After a few testing an alternative serializer implementation has been developed using an xml variant of the original ddl with the following features in mind:

- xml is the language of choice for the template. plain xml template is a bit more verbose, but it's well understood by our non-tech team members and has a more familiar syntax.
- original syntax/sugar elements should be preserved ( use CDATA wherever possibile)
- mustache specific data template elements to be injected into the template. Template must be be parseable by a conformant xml parser.
- the serializer/parser feature must sit on top without disrupting the code base wherever possibile.
- extend the template syntax ( e.g. external styles )

Key changes so far:

class DocumentObject:

new method:
internal abstract void Serialize(XmlSerializer serializer);

new package:



Sample serialization code ( HelloMigraDoc )

MigraDoc.DocumentObjectModel.IO.Xml.DdlWriter.WriteToFile(document, "MigraDoc.xml");

Sample xml template: see attached file.

Still missing:

- Serializer needs to use fragments to compact nodes ( review the stack/commit feature in the Serializer class)
- Parser code is still missing

Any comment or idea is welcome

Thank you.

File comment: Sample alternative template
migradoc.zip [3.47 KiB]
Downloaded 279 times

Author:  Thomas Hoevel [ Wed Jul 18, 2018 12:24 pm ]
Post subject:  Re: Migradoc xml serialization format


There is another project on GitHub dealing with XML serialization:

I don't know, how similar or different those XML implementations are.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group