We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is an issue on mapping simple tags (a tag with just inner text) that have optional attributes.
When there is at least one attribute present, everything work fine:
<root> <tag optionalAttribute="attribute value">innetText</testString> </root>
But when there is no attribute present:
<root> <tag>innetText</testString> </root>
mapping using the same model produces nil:
nil
class Root: XMLMappable { var nodeName: String! var tag: Tag? required init?(map: XMLMap) {} func mapping(map: XMLMap) { tag <- map["tag"] } } class Tag: XMLMappable { var nodeName: String! var optionalAttribute: String? var text: String? required init?(map: XMLMap) {} func mapping(map: XMLMap) { optionalAttribute <- map.attributes["optionalAttribute"] text <- map.innerText } }
The text was updated successfully, but these errors were encountered:
Fixed #29. Issue with optional attributes in simple tags
ed28bd8
gcharita
Successfully merging a pull request may close this issue.
There is an issue on mapping simple tags (a tag with just inner text) that have optional attributes.
When there is at least one attribute present, everything work fine:
But when there is no attribute present:
mapping using the same model produces
nil
:The text was updated successfully, but these errors were encountered: