tadija / AEXML

Swift minion for simple and lightweight XML parsing
MIT License
1.01k stars 200 forks source link

Add child with end tag #167

Closed evanxlh closed 4 years ago

evanxlh commented 4 years ago

How to add child with end tag?

eg. I want to add Category node, and also end with .

<root>
<Category name: 'category'></Category>
</root>
tadija commented 4 years ago

it seems that you need to have a value for this node in order to generate the end tag too:

let doc = AEXMLDocument()
doc.addChild(name: "Category", value: "Test")
print(doc.xml) // <Category>Test</Category>