CoreOffice / XMLCoder

Easy XML parsing using Codable protocols in Swift
https://coreoffice.github.io/XMLCoder/
MIT License
793 stars 104 forks source link

Add DOCTYPE tag #252

Closed bfreeTax closed 1 year ago

bfreeTax commented 1 year ago

I need to encode my structure and add DOCTYPE just after xml version="1.0" ... tag, this is the example XML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE myService PUBLIC "-//Domain//DTD MyService v1//EN" "http://dtd.domain.com/myService_v1.dtd">
<myService>
        <order>
                <value>My important value</value>
       </order>
</myService>

Forxml version="1.0" ... I use XMLHeader, but I can't find anything for "inject" DOCTYPE. Is that even posible ?

Joannis commented 1 year ago

I'm not the creator - but I am an active maintainer of the library. I don't think this is currently possible, but I'll check out if we can fix that.

Joannis commented 1 year ago

Hey @bfreeTax, I've added a draft PR that should work for you. I've yet to add tests, before reviewing & merging it. At least you have something to try out for now.

bfreeTax commented 1 year ago

Hey @bfreeTax, I've added a draft PR that should work for you. I've yet to add tests, before reviewing & merging it. At least you have something to try out for now.

Hey @Joannis tested and works perfect!! Thanks for taking the time!