docx
docx copied to clipboard
Adding a validator
Currently it is possible to add a paragraph inside a paragraph. And having documents with more then 200 pages in a production environment makes it sometimes quite cumbersome to debug what went wrong. Especially because of word failing to give any error message whatsoever.
It would be really nice if there would be a validator that raises an exception as soon as you try to add a paragraph inside a paragraph, or any other illegal action.
It should be captured by type definitions, so it shouldn't be possible to add a paragraph inside a paragraph. It wouldn't compile
No, this is not true at all. We use the type definitions heavily, but we are still able to do this very easily
Op vr 27 okt. 2023 00:14 schreef Dolan @.***>:
It should be captured by type definitions, so it shouldn't be possible to add a paragraph inside a paragraph. It wouldn't compile
— Reply to this email directly, view it on GitHub https://github.com/dolanmiu/docx/issues/2395#issuecomment-1781964246, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANSQXPEJ6LWQPRSBWV4EKZ3YBLOGDAVCNFSM6AAAAAA6POTGVCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBRHE3DIMRUGY . You are receiving this because you authored the thread.Message ID: @.***>
@dolanmiu Could you reopen this? I think you misunderstood me.
Oh I see
Then there is something wrong with the type definitions.
Regarding a validator: docx uses https://github.com/ChristophWurst/xmllint-action to validate the generated xml against https://github.com/dolanmiu/docx/blob/master/ooxml-schemas/microsoft/wml-2010.xsd
Maybe you could implement something similar?