Comments (4)
I looked into this. I created the document like this:
svg = try AEXMLDocument(xml: """
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
</svg>
""")
however, when I save this I get only this:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>
AEXMLOptions
isn't ready for inheritance, since it is a struct and you didn't use a protocol.
However, I assume you are open for me to change this?. I will send you a pull request.
from aexml.
Maybe I should initiate the document with a root element and a DTD already included?
from aexml.
Hi @themadone, I think that extending AEXMLOptions
with another subtype for this purpose is a good idea (rather than extending existing DocumentHeader
type). I'm not sure if this would affect parsing in some unexpected way, but if not that it should be a simple change. Creating the document with a custom root element is also a valid option I guess.
from aexml.
I facing the same issue, through some code trace, AEXMLOptions
currently not possible to extend other headers.
As a work around, I create a new class inherit from AEXMLDocument
and override the xml
computed property like this:
class PlistDocument: AEXMLDocument {
override var xml: String {
var xml = "\(options.documentHeader.xmlString)\n"
let plistDTD = """
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n
"""
xml += plistDTD
xml += root.xml
return xml
}
}
It work expected. Any better solution for this requirement or if need some enhancement for AEXMLOptions
(maybe some refactor with DI), feel free to tell me and I will make a PR when I get free time. 😅
===
P.S.
Maybe somebody would say why not using PropertyListSerialization
to make Plist
file in my case.
I have no idea how to handle NSNumber
and wrong precision of floating number in the black box of PropertyListSerialization
. 🤦♂️
from aexml.
Related Issues (20)
- module compiled with Swift 5.0 cannot be imported by the Swift 5.1 compiler. HOT 3
- could not find module 'AEXML' for target 'arm64-apple-ios'; found: x86_64 HOT 1
- AEXMLDocument Retain Cycle
- XML incomplete parsing
- module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler HOT 6
- module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler HOT 4
- Add child with end tag HOT 1
- Parser doesn't handle "0" or "1" for Booleans HOT 1
- Sorted attributes
- Build Target out of date HOT 3
- AEXML.modulemap not found on iOS 14 HOT 4
- Xcode 12 build warning - 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0 HOT 1
- Question
- Ability to exclude standalone attribute from document header HOT 3
- When <ruby> elements are used in html, other texts are vanished. HOT 1
- Error while parsing large files on linux
- Apple Silicon support HOT 4
- Privacy Manifest HOT 1
- Could not find module 'AEXML' for target 'x86_64-apple-ios-simulator'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aexml.