PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 7:39 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Jul 18, 2018 10:11 am 
Offline

Joined: Tue Jul 17, 2018 4:16 pm
Posts: 1
Hello all,

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

Rationale:

- 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:
MigraDoc.DocumentObjectModel.IO.Xml

implementation:

https://github.com/emazv72/MigraDoc

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.


Attachments:
File comment: Sample alternative template
migradoc.zip [3.47 KiB]
Downloaded 738 times
Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 18, 2018 12:24 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3092
Location: Cologne, Germany
Hi!

There is another project on GitHub dealing with XML serialization:
viewtopic.php?f=8&t=3764

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

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group