-
Notifications
You must be signed in to change notification settings - Fork 1.2k
SR-9758: XMLParser.parse()
should return false
if abortParsing()
is called.
#1867
New issue
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
Conversation
Foundation/XMLParser.swift
Outdated
if _parserError == nil { | ||
_parserError = NSError(domain: XMLParser.errorDomain, code: Int(parseResult)) | ||
} | ||
result = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is not the best way, but it would be better than just return true
.
Foundation/XMLParser.swift
Outdated
@@ -465,16 +465,18 @@ open class XMLParser : NSObject { | |||
} | |||
|
|||
internal func _handleParseResult(_ parseResult: Int32) -> Bool { | |||
return true | |||
/* | |||
var result = true | |||
if parseResult != 0 { | |||
if parseResult != -1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be simpler to write this as :
if parseResult == 0 {
return true
} else {
if _parserError == nil {
_parserError = NSError(domain: XMLParser.errorDomain, code: Int(parseResult))
}
}
return false
If more interpretation of parseResult
is added in the future, it will reduce the extra levels of indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review. I will rewrite it.
@swift-ci test |
@swift-ci test |
Thank you! |
@swift-ci test |
@swift-ci test and merge |
As the Apple's document says,
parse()
should return false in there is an error or if the parsing operation is aborted.Resolves SR-9758.