From 89faad54a35a6293be11c48d5873102d600526df Mon Sep 17 00:00:00 2001 From: David Mohundro Date: Fri, 12 Feb 2021 20:27:48 -0600 Subject: [PATCH 1/4] feat: rename SWXMLHash class to XMLHash Related to #242. --- Package.swift | 2 +- SWXMLHash.xcodeproj/project.pbxproj | 40 ++++++------ .../xcschemes/SWXMLHash OSX.xcscheme | 28 ++++----- .../xcschemes/SWXMLHash iOS.xcscheme | 28 ++++----- .../xcschemes/SWXMLHash tvOS.xcscheme | 28 ++++----- .../xcschemes/SWXMLHash watchOS.xcscheme | 10 +-- .../Contents.swift | 4 +- Source/SWXMLHash.swift | 62 +++++++++---------- Tests/LinuxMain.swift | 2 +- .../LazyTypesConversionTests.swift | 4 +- .../LazyWhiteSpaceParsingTests.swift | 2 +- .../SWXMLHashTests/LazyXMLParsingTests.swift | 6 +- .../MixedTextWithXMLElementsTests.swift | 2 +- ...versionArrayOfNonPrimitiveTypesTests.swift | 2 +- .../TypeConversionBasicTypesTests.swift | 4 +- .../TypeConversionComplexTypesTests.swift | 2 +- .../TypeConversionPrimitypeTypesTests.swift | 2 +- .../WhiteSpaceParsingTests.swift | 2 +- ...igTests.swift => XMLHashConfigTests.swift} | 8 +-- Tests/SWXMLHashTests/XMLParsingTests.swift | 18 +++--- 20 files changed, 121 insertions(+), 135 deletions(-) rename Tests/SWXMLHashTests/{SWXMLHashConfigTests.swift => XMLHashConfigTests.swift} (90%) diff --git a/Package.swift b/Package.swift index d6847e6f..aa2f1aaf 100644 --- a/Package.swift +++ b/Package.swift @@ -1,7 +1,7 @@ // swift-tools-version:5.3 // -// SWXMLHash.swift +// Package.swift // SWXMLHash // // Copyright (c) 2014 David Mohundro diff --git a/SWXMLHash.xcodeproj/project.pbxproj b/SWXMLHash.xcodeproj/project.pbxproj index 45f54f95..07109018 100644 --- a/SWXMLHash.xcodeproj/project.pbxproj +++ b/SWXMLHash.xcodeproj/project.pbxproj @@ -42,9 +42,9 @@ CDC6D12B1D32D77F00570DE5 /* LazyWhiteSpaceParsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D12A1D32D77F00570DE5 /* LazyWhiteSpaceParsingTests.swift */; }; CDC6D12C1D32D77F00570DE5 /* LazyWhiteSpaceParsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D12A1D32D77F00570DE5 /* LazyWhiteSpaceParsingTests.swift */; }; CDC6D12D1D32D77F00570DE5 /* LazyWhiteSpaceParsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D12A1D32D77F00570DE5 /* LazyWhiteSpaceParsingTests.swift */; }; - CDC6D12F1D32D79F00570DE5 /* SWXMLHashConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D12E1D32D79F00570DE5 /* SWXMLHashConfigTests.swift */; }; - CDC6D1301D32D79F00570DE5 /* SWXMLHashConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D12E1D32D79F00570DE5 /* SWXMLHashConfigTests.swift */; }; - CDC6D1311D32D79F00570DE5 /* SWXMLHashConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D12E1D32D79F00570DE5 /* SWXMLHashConfigTests.swift */; }; + CDC6D12F1D32D79F00570DE5 /* XMLHashConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D12E1D32D79F00570DE5 /* XMLHashConfigTests.swift */; }; + CDC6D1301D32D79F00570DE5 /* XMLHashConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D12E1D32D79F00570DE5 /* XMLHashConfigTests.swift */; }; + CDC6D1311D32D79F00570DE5 /* XMLHashConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D12E1D32D79F00570DE5 /* XMLHashConfigTests.swift */; }; CDC6D1331D32D7C300570DE5 /* LazyTypesConversionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D1321D32D7C300570DE5 /* LazyTypesConversionTests.swift */; }; CDC6D1341D32D7C300570DE5 /* LazyTypesConversionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D1321D32D7C300570DE5 /* LazyTypesConversionTests.swift */; }; CDC6D1351D32D7C300570DE5 /* LazyTypesConversionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D1321D32D7C300570DE5 /* LazyTypesConversionTests.swift */; }; @@ -144,7 +144,7 @@ CDC6D1221D32D73900570DE5 /* MixedTextWithXMLElementsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MixedTextWithXMLElementsTests.swift; sourceTree = ""; }; CDC6D1261D32D76400570DE5 /* LazyXMLParsingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LazyXMLParsingTests.swift; sourceTree = ""; }; CDC6D12A1D32D77F00570DE5 /* LazyWhiteSpaceParsingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LazyWhiteSpaceParsingTests.swift; sourceTree = ""; }; - CDC6D12E1D32D79F00570DE5 /* SWXMLHashConfigTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SWXMLHashConfigTests.swift; sourceTree = ""; }; + CDC6D12E1D32D79F00570DE5 /* XMLHashConfigTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XMLHashConfigTests.swift; sourceTree = ""; }; CDC6D1321D32D7C300570DE5 /* LazyTypesConversionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LazyTypesConversionTests.swift; sourceTree = ""; }; CDC6D1361D32D7F400570DE5 /* TypeConversionBasicTypesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TypeConversionBasicTypesTests.swift; sourceTree = ""; }; CDC6D13A1D32D84900570DE5 /* TypeConversionComplexTypesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TypeConversionComplexTypesTests.swift; sourceTree = ""; }; @@ -275,7 +275,7 @@ CDC7F33C1B0ACC98006BF6E7 /* OSX */, 6C42BECC2051834B00137D31 /* shim.swift */, CD6083FF196CA106000B4F8D /* Supporting Files */, - CDC6D12E1D32D79F00570DE5 /* SWXMLHashConfigTests.swift */, + CDC6D12E1D32D79F00570DE5 /* XMLHashConfigTests.swift */, CD4B5F3919E2C42D005C1F33 /* test.xml */, CD291F1E1BF635BE009A1FA6 /* tvOS */, CDC6D1421D32D9D200570DE5 /* TypeConversionArrayOfNonPrimitiveTypesTests.swift */, @@ -486,7 +486,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0710; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1240; TargetAttributes = { CD6083EE196CA106000B4F8D = { CreatedOnToolsVersion = 6.0; @@ -618,7 +618,7 @@ CDC6D1371D32D7F400570DE5 /* TypeConversionBasicTypesTests.swift in Sources */, CDC6D11B1D32D6CE00570DE5 /* XMLParsingTests.swift in Sources */, CDC6D1271D32D76400570DE5 /* LazyXMLParsingTests.swift in Sources */, - CDC6D12F1D32D79F00570DE5 /* SWXMLHashConfigTests.swift in Sources */, + CDC6D12F1D32D79F00570DE5 /* XMLHashConfigTests.swift in Sources */, 6C42BED1205183A100137D31 /* shim.swift in Sources */, CDC6D13F1D32D98400570DE5 /* TypeConversionPrimitypeTypesTests.swift in Sources */, E25A0776261CF79300C68B90 /* XMLParsingValidationTests.swift in Sources */, @@ -648,7 +648,7 @@ CDC6D1381D32D7F400570DE5 /* TypeConversionBasicTypesTests.swift in Sources */, CDC6D11C1D32D6CE00570DE5 /* XMLParsingTests.swift in Sources */, CDC6D1281D32D76400570DE5 /* LazyXMLParsingTests.swift in Sources */, - CDC6D1301D32D79F00570DE5 /* SWXMLHashConfigTests.swift in Sources */, + CDC6D1301D32D79F00570DE5 /* XMLHashConfigTests.swift in Sources */, 6C42BED2205183A100137D31 /* shim.swift in Sources */, CDC6D1401D32D98400570DE5 /* TypeConversionPrimitypeTypesTests.swift in Sources */, E25A0777261CF79300C68B90 /* XMLParsingValidationTests.swift in Sources */, @@ -678,7 +678,7 @@ CDC6D1391D32D7F400570DE5 /* TypeConversionBasicTypesTests.swift in Sources */, CDC6D11D1D32D6CE00570DE5 /* XMLParsingTests.swift in Sources */, CDC6D1291D32D76400570DE5 /* LazyXMLParsingTests.swift in Sources */, - CDC6D1311D32D79F00570DE5 /* SWXMLHashConfigTests.swift in Sources */, + CDC6D1311D32D79F00570DE5 /* XMLHashConfigTests.swift in Sources */, 6C42BED3205183A100137D31 /* shim.swift in Sources */, CDC6D1411D32D98400570DE5 /* TypeConversionPrimitypeTypesTests.swift in Sources */, E25A0778261CF79300C68B90 /* XMLParsingValidationTests.swift in Sources */, @@ -745,6 +745,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -770,7 +771,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -808,6 +809,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -826,7 +828,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -845,7 +847,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = marker; CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -853,7 +855,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "drmohundro.$(PRODUCT_NAME:rfc1034identifier).${PLATFORM_NAME}"; PRODUCT_NAME = SWXMLHash; @@ -869,7 +871,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; BITCODE_GENERATION_MODE = bitcode; CLANG_ENABLE_MODULES = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -877,7 +879,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "drmohundro.$(PRODUCT_NAME:rfc1034identifier).${PLATFORM_NAME}"; PRODUCT_NAME = SWXMLHash; @@ -1044,7 +1046,7 @@ SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Debug; }; @@ -1070,7 +1072,7 @@ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Release; }; @@ -1088,7 +1090,7 @@ SDKROOT = appletvos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Debug; }; @@ -1108,7 +1110,7 @@ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Release; }; diff --git a/SWXMLHash.xcodeproj/xcshareddata/xcschemes/SWXMLHash OSX.xcscheme b/SWXMLHash.xcodeproj/xcshareddata/xcschemes/SWXMLHash OSX.xcscheme index 8acede09..83395503 100644 --- a/SWXMLHash.xcodeproj/xcshareddata/xcschemes/SWXMLHash OSX.xcscheme +++ b/SWXMLHash.xcodeproj/xcshareddata/xcschemes/SWXMLHash OSX.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + @@ -40,17 +49,6 @@ - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + @@ -40,17 +49,6 @@ - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + @@ -40,17 +49,6 @@ - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> - - - - """ -var xml = SWXMLHash.parse(xmlWithNamespace) +var xml = XMLHash.parse(xmlWithNamespace) // one root element let count = xml["root"].all.count @@ -99,6 +99,6 @@ struct Book: XMLIndexerDeserializable { } } -xml = SWXMLHash.parse(booksXML) +xml = XMLHash.parse(booksXML) let books: [Book] = try xml["root"]["books"]["book"].value() diff --git a/Source/SWXMLHash.swift b/Source/SWXMLHash.swift index a69d3ed1..23210992 100644 --- a/Source/SWXMLHash.swift +++ b/Source/SWXMLHash.swift @@ -37,7 +37,7 @@ import FoundationXML let rootElementName = "SWXMLHash_Root_Element" /// Parser options -public class SWXMLHashOptions { +public class XMLHashOptions { internal init() {} /// determines whether to parse the XML with lazy parsing or not @@ -63,10 +63,10 @@ public class SWXMLHashOptions { } /// Simple XML parser -public class SWXMLHash { - let options: SWXMLHashOptions +public class XMLHash { + let options: XMLHashOptions - private init(_ options: SWXMLHashOptions = SWXMLHashOptions()) { + private init(_ options: XMLHashOptions = XMLHashOptions()) { self.options = options } @@ -74,14 +74,14 @@ public class SWXMLHash { Method to configure how parsing works. - parameters: - - configAction: a block that passes in an `SWXMLHashOptions` object with + - configAction: a block that passes in an `XMLHashOptions` object with options to be set - - returns: an `SWXMLHash` instance + - returns: an `XMLHash` instance */ - class public func config(_ configAction: (SWXMLHashOptions) -> Void) -> SWXMLHash { - let opts = SWXMLHashOptions() + class public func config(_ configAction: (XMLHashOptions) -> Void) -> XMLHash { + let opts = XMLHashOptions() configAction(opts) - return SWXMLHash(opts) + return XMLHash(opts) } /** @@ -120,7 +120,7 @@ public class SWXMLHash { - returns: An XMLIndexer instance that is used to look up elements in the XML */ class public func parse(_ xml: String) -> XMLIndexer { - SWXMLHash().parse(xml) + XMLHash().parse(xml) } /** @@ -130,7 +130,7 @@ public class SWXMLHash { - returns: An XMLIndexer instance that is used to look up elements in the XML */ class public func parse(_ data: Data) -> XMLIndexer { - SWXMLHash().parse(data) + XMLHash().parse(data) } /** @@ -179,7 +179,7 @@ struct Stack { } protocol SimpleXmlParser { - init(_ options: SWXMLHashOptions) + init(_ options: XMLHashOptions) func parse(_ data: Data) -> XMLIndexer } @@ -268,7 +268,7 @@ extension XMLParserDelegate { /// The implementation of XMLParserDelegate and where the lazy parsing actually happens. class LazyXMLParser: NSObject, SimpleXmlParser, XMLParserDelegate { - required init(_ options: SWXMLHashOptions) { + required init(_ options: XMLHashOptions) { root = XMLElement(name: rootElementName, options: options) self.options = options super.init() @@ -280,7 +280,7 @@ class LazyXMLParser: NSObject, SimpleXmlParser, XMLParserDelegate { var data: Data? var ops: [IndexOp] = [] - let options: SWXMLHashOptions + let options: XMLHashOptions func parse(_ data: Data) -> XMLIndexer { self.data = data @@ -365,7 +365,7 @@ class LazyXMLParser: NSObject, SimpleXmlParser, XMLParserDelegate { /// The implementation of XMLParserDelegate and where the parsing actually happens. class FullXMLParser: NSObject, SimpleXmlParser, XMLParserDelegate { - required init(_ options: SWXMLHashOptions) { + required init(_ options: XMLHashOptions) { root = XMLElement(name: rootElementName, options: options) self.options = options super.init() @@ -373,7 +373,7 @@ class FullXMLParser: NSObject, SimpleXmlParser, XMLParserDelegate { let root: XMLElement var parentStack = Stack() - let options: SWXMLHashOptions + let options: XMLHashOptions var parsingError: ParsingError? func parse(_ data: Data) -> XMLIndexer { @@ -544,7 +544,7 @@ public enum IndexingError: Error { // swiftlint:enable identifier_name } -/// Returned from SWXMLHash, allows easy element lookup into XML data. +/// Returned from XMLHash, allows easy element lookup into XML data. public enum XMLIndexer { case element(XMLElement) case list([XMLElement]) @@ -936,7 +936,7 @@ public class XMLElement: XMLContent { var count: Int = 0 var index: Int - let options: SWXMLHashOptions + let options: XMLHashOptions var xmlChildren: [XMLElement] { children.compactMap { $0 as? XMLElement } @@ -948,9 +948,9 @@ public class XMLElement: XMLContent { - parameters: - name: The name of the element to be initialized - index: The index of the element to be initialized - - options: The SWXMLHash options + - options: The XMLHash options */ - init(name: String, index: Int = 0, options: SWXMLHashOptions) { + init(name: String, index: Int = 0, options: XMLHashOptions) { self.name = name self.index = index self.options = options @@ -1023,11 +1023,11 @@ extension XMLElement: CustomStringConvertible { // On macOS, `XMLElement` is defined in Foundation. // So, the code referencing `XMLElement` generates above error. // Following code allow to using `SWXMLhash.XMLElement` in client codes. -extension SWXMLHash { - public typealias XMLElement = SWXMLHashXMLElement +extension XMLHash { + public typealias XMLElement = XMLHashXMLElement } -public typealias SWXMLHashXMLElement = XMLElement +public typealias XMLHashXMLElement = XMLElement fileprivate extension String { func compare(_ str2: String?, _ insensitive: Bool) -> Bool { @@ -1050,10 +1050,10 @@ extension XMLIndexer { /** Allows for element lookup by matching attribute values using a String backed RawRepresentables (E.g. `String` backed `enum` cases) - + - Note: Convenience for withAttribute(String, String) - + - parameters: - attr: should the name of the attribute to match on - value: should be the value of the attribute to match on @@ -1068,10 +1068,10 @@ extension XMLIndexer { /** Find an XML element at the current level by element name using a String backed RawRepresentable (E.g. `String` backed `enum` cases) - + - Note: Convenience for byKey(String) - + - parameter key: The element name to index by - returns: instance of XMLIndexer to match the element (or elements) found by key - throws: Throws an XMLIndexingError.Key if no element was found @@ -1083,10 +1083,10 @@ extension XMLIndexer { /** Find an XML element at the current level by element name using a String backed RawRepresentable (E.g. `String` backed `enum` cases) - + - Note: Convenience for self[String] - + - parameter key: The element name to index by - returns: instance of XMLIndexer to match the element (or elements) found by */ @@ -1100,9 +1100,9 @@ extension XMLIndexer { /*: Provides XMLIndexer Serialization/Deserialization using String backed RawRepresentables Added by [PeeJWeeJ](https://github.com/PeeJWeeJ) */ extension XMLElement { - /** + /** Find an attribute by name using a String backed RawRepresentable (E.g. `String` backed `enum` cases) - + - Note: Convenience for self[String] */ diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index 965b10e8..4a514ab3 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -32,7 +32,7 @@ XCTMain([ testCase(LazyWhiteSpaceParsingTests.allTests), testCase(LazyXMLParsingTests.allTests), testCase(MixedTextWithXMLElementsTests.allTests), - testCase(SWXMLHashConfigTests.allTests), + testCase(XMLHashConfigTests.allTests), testCase(TypeConversionArrayOfNonPrimitiveTypesTests.allTests), testCase(TypeConversionBasicTypesTests.allTests), testCase(TypeConversionComplexTypesTests.allTests), diff --git a/Tests/SWXMLHashTests/LazyTypesConversionTests.swift b/Tests/SWXMLHashTests/LazyTypesConversionTests.swift index 9f6f9493..eddf00ab 100644 --- a/Tests/SWXMLHashTests/LazyTypesConversionTests.swift +++ b/Tests/SWXMLHashTests/LazyTypesConversionTests.swift @@ -47,7 +47,7 @@ class LazyTypesConversionTests: XCTestCase { override func setUp() { super.setUp() - parser = SWXMLHash.config { cfg in cfg.shouldProcessLazily = true }.parse(xmlWithBasicTypes) + parser = XMLHash.config { cfg in cfg.shouldProcessLazily = true }.parse(xmlWithBasicTypes) } func testShouldConvertValueToNonOptional() { @@ -69,7 +69,7 @@ class LazyTypesConversionTests: XCTestCase { } func testShouldBeAbleToGetUserInfoDuringDeserialization() { - parser = SWXMLHash.config { config in + parser = XMLHash.config { config in let options = SampleUserInfo(apiVersion: .v1) config.userInfo = [ SampleUserInfo.key: options ] }.parse(xmlWithBasicTypes) diff --git a/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift b/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift index 625088ea..90f3a062 100644 --- a/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift +++ b/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift @@ -44,7 +44,7 @@ class LazyWhiteSpaceParsingTests: XCTestCase { let path = bundle.path(forResource: "test", ofType: "xml")! #endif let data = try! Data(contentsOf: URL(fileURLWithPath: path)) - xml = SWXMLHash.lazy(data) + xml = XMLHash.lazy(data) } // issue #6 diff --git a/Tests/SWXMLHashTests/LazyXMLParsingTests.swift b/Tests/SWXMLHashTests/LazyXMLParsingTests.swift index 331d7528..c67b04cd 100644 --- a/Tests/SWXMLHashTests/LazyXMLParsingTests.swift +++ b/Tests/SWXMLHashTests/LazyXMLParsingTests.swift @@ -64,7 +64,7 @@ class LazyXMLParsingTests: XCTestCase { override func setUp() { super.setUp() - xml = SWXMLHash.config { config in config.shouldProcessLazily = true }.parse(xmlToParse) + xml = XMLHash.config { config in config.shouldProcessLazily = true }.parse(xmlToParse) } func testShouldBeAbleToParseIndividualElements() { @@ -126,7 +126,7 @@ class LazyXMLParsingTests: XCTestCase { func testShouldHandleInterleavingXMLElements() { let interleavedXml = "

one

two

three

four
" - let parsed = SWXMLHash.parse(interleavedXml) + let parsed = XMLHash.parse(interleavedXml) let result = parsed["html"]["body"].children.map({ $0.element!.text }).joined(separator: ", ") XCTAssertEqual(result, "one, two, three, four") @@ -134,7 +134,7 @@ class LazyXMLParsingTests: XCTestCase { func testShouldBeAbleToProvideADescriptionForTheDocument() { let descriptionXml = "puppies" - let parsed = SWXMLHash.parse(descriptionXml) + let parsed = XMLHash.parse(descriptionXml) XCTAssertEqual(parsed.description, "puppies") } diff --git a/Tests/SWXMLHashTests/MixedTextWithXMLElementsTests.swift b/Tests/SWXMLHashTests/MixedTextWithXMLElementsTests.swift index 77a6f4d2..760458af 100644 --- a/Tests/SWXMLHashTests/MixedTextWithXMLElementsTests.swift +++ b/Tests/SWXMLHashTests/MixedTextWithXMLElementsTests.swift @@ -34,7 +34,7 @@ class MixedTextWithXMLElementsTests: XCTestCase { override func setUp() { super.setUp() let xmlContent = "Here is a cool thing A and second cool thing B" - xml = SWXMLHash.parse(xmlContent) + xml = XMLHash.parse(xmlContent) } func testShouldBeAbleToGetAllContentsInsideOfAnElement() { diff --git a/Tests/SWXMLHashTests/TypeConversionArrayOfNonPrimitiveTypesTests.swift b/Tests/SWXMLHashTests/TypeConversionArrayOfNonPrimitiveTypesTests.swift index 8d743ec8..8f0076c9 100644 --- a/Tests/SWXMLHashTests/TypeConversionArrayOfNonPrimitiveTypesTests.swift +++ b/Tests/SWXMLHashTests/TypeConversionArrayOfNonPrimitiveTypesTests.swift @@ -88,7 +88,7 @@ class TypeConversionArrayOfNonPrimitiveTypesTests: XCTestCase { override func setUp() { super.setUp() - parser = SWXMLHash.parse(xmlWithArraysOfTypes) + parser = XMLHash.parse(xmlWithArraysOfTypes) } func testShouldConvertArrayOfGoodBasicitemsItemsToNonOptional() { diff --git a/Tests/SWXMLHashTests/TypeConversionBasicTypesTests.swift b/Tests/SWXMLHashTests/TypeConversionBasicTypesTests.swift index 867a10dd..b701b356 100644 --- a/Tests/SWXMLHashTests/TypeConversionBasicTypesTests.swift +++ b/Tests/SWXMLHashTests/TypeConversionBasicTypesTests.swift @@ -76,7 +76,7 @@ class TypeConversionBasicTypesTests: XCTestCase { override func setUp() { super.setUp() - parser = SWXMLHash.parse(xmlWithBasicTypes) + parser = XMLHash.parse(xmlWithBasicTypes) } func testShouldConvertValueToNonOptional() { @@ -600,7 +600,7 @@ class TypeConversionBasicTypesTests: XCTestCase { } func testShouldBeAbleToGetUserInfoDuringDeserialization() { - parser = SWXMLHash.config { config in + parser = XMLHash.config { config in let options = SampleUserInfo(apiVersion: .v1) config.userInfo = [ SampleUserInfo.key: options ] }.parse(xmlWithBasicTypes) diff --git a/Tests/SWXMLHashTests/TypeConversionComplexTypesTests.swift b/Tests/SWXMLHashTests/TypeConversionComplexTypesTests.swift index f247c686..e73bb179 100644 --- a/Tests/SWXMLHashTests/TypeConversionComplexTypesTests.swift +++ b/Tests/SWXMLHashTests/TypeConversionComplexTypesTests.swift @@ -76,7 +76,7 @@ class TypeConversionComplexTypesTests: XCTestCase { override func setUp() { super.setUp() - parser = SWXMLHash.parse(xmlWithComplexType) + parser = XMLHash.parse(xmlWithComplexType) } func testShouldConvertComplexitemToNonOptional() { diff --git a/Tests/SWXMLHashTests/TypeConversionPrimitypeTypesTests.swift b/Tests/SWXMLHashTests/TypeConversionPrimitypeTypesTests.swift index 218c6d4f..ef1546ed 100644 --- a/Tests/SWXMLHashTests/TypeConversionPrimitypeTypesTests.swift +++ b/Tests/SWXMLHashTests/TypeConversionPrimitypeTypesTests.swift @@ -50,7 +50,7 @@ class TypeConversionPrimitypeTypesTests: XCTestCase { override func setUp() { super.setUp() - parser = SWXMLHash.parse(xmlWithArraysOfTypes) + parser = XMLHash.parse(xmlWithArraysOfTypes) } func testShouldConvertArrayOfGoodIntsToNonOptional() { diff --git a/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift b/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift index dabb1877..21f569ea 100644 --- a/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift +++ b/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift @@ -43,7 +43,7 @@ class WhiteSpaceParsingTests: XCTestCase { let path = bundle.path(forResource: "test", ofType: "xml")! #endif let data = try! Data(contentsOf: URL(fileURLWithPath: path)) - xml = SWXMLHash.parse(data) + xml = XMLHash.parse(data) } // issue #6 diff --git a/Tests/SWXMLHashTests/SWXMLHashConfigTests.swift b/Tests/SWXMLHashTests/XMLHashConfigTests.swift similarity index 90% rename from Tests/SWXMLHashTests/SWXMLHashConfigTests.swift rename to Tests/SWXMLHashTests/XMLHashConfigTests.swift index 45dee98f..3c45f191 100644 --- a/Tests/SWXMLHashTests/SWXMLHashConfigTests.swift +++ b/Tests/SWXMLHashTests/XMLHashConfigTests.swift @@ -26,7 +26,7 @@ import SWXMLHash import XCTest -class SWXMLHashConfigTests: XCTestCase { +class XMLHashConfigTests: XCTestCase { var parser: XMLIndexer? let xmlWithNamespace = """ () throws -> Void)] { +extension XMLHashConfigTests { + static var allTests: [(String, (XMLHashConfigTests) -> () throws -> Void)] { [ ("testShouldAllowProcessingNamespacesOrNot", testShouldAllowProcessingNamespacesOrNot) ] diff --git a/Tests/SWXMLHashTests/XMLParsingTests.swift b/Tests/SWXMLHashTests/XMLParsingTests.swift index 3611b134..564e85ea 100644 --- a/Tests/SWXMLHashTests/XMLParsingTests.swift +++ b/Tests/SWXMLHashTests/XMLParsingTests.swift @@ -68,7 +68,7 @@ class XMLParsingTests: XCTestCase { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. - xml = SWXMLHash.parse(xmlToParse) + xml = XMLHash.parse(xmlToParse) } func testShouldBeAbleToParseIndividualElements() { @@ -131,7 +131,7 @@ class XMLParsingTests: XCTestCase { func testShouldBeAbleToLookUpElementsByNameAndAttributeCaseInsensitive() { do { - let xmlInsensitive = SWXMLHash.config({ config in + let xmlInsensitive = XMLHash.config({ config in config.caseInsensitive = true }).parse(xmlToParse) let value = try xmlInsensitive["rOOt"]["catalOg"]["bOOk"].withAttribute("iD", "Bk102")["authOr"].element?.text @@ -174,7 +174,7 @@ class XMLParsingTests: XCTestCase { func testShouldBeAbleToIterateOverMixedContent() { let mixedContentXml = "

mixed content iteration support" - let parsed = SWXMLHash.parse(mixedContentXml) + let parsed = XMLHash.parse(mixedContentXml) let element = parsed["html"]["body"]["p"].element XCTAssertNotNil(element) if let element = element { @@ -216,13 +216,13 @@ class XMLParsingTests: XCTestCase { ] for (index, mixedContentXml) in mixedContentXmlInputs.enumerated() { - XCTAssertEqual(SWXMLHash.parse(mixedContentXml).element!.recursiveText, recursiveTextOutputs[index]) + XCTAssertEqual(XMLHash.parse(mixedContentXml).element!.recursiveText, recursiveTextOutputs[index]) } } func testShouldHandleInterleavingXMLElements() { let interleavedXml = "

one

two

three

four
" - let parsed = SWXMLHash.parse(interleavedXml) + let parsed = XMLHash.parse(interleavedXml) let result = parsed["html"]["body"].children.map({ $0.element!.text }).joined(separator: ", ") XCTAssertEqual(result, "one, two, three, four") @@ -230,14 +230,14 @@ class XMLParsingTests: XCTestCase { func testShouldBeAbleToProvideADescriptionForTheDocument() { let descriptionXml = "puppies" - let parsed = SWXMLHash.parse(descriptionXml) + let parsed = XMLHash.parse(descriptionXml) XCTAssertEqual(parsed.description, "puppies") } func testShouldBeAbleToGetInnerXML() { let testXML = "puppies12" - let parsed = SWXMLHash.parse(testXML) + let parsed = XMLHash.parse(testXML) XCTAssertEqual(parsed["root"]["foo"].element!.innerXML, "puppies12") } @@ -318,7 +318,7 @@ class XMLParsingTests: XCTestCase {
""" - let parser = SWXMLHash.parse(xmlToParse) + let parser = XMLHash.parse(xmlToParse) let subIndexer = parser["root"].filterChildren { _, index in index >= 2 && index <= 5 } @@ -363,7 +363,7 @@ class XMLParsingTests: XCTestCase { func testShouldThrowErrorForInvalidXML() { let invalidXML = "what is this" var err: ParsingError? - let parser = SWXMLHash.config { config in + let parser = XMLHash.config { config in config.detectParsingErrors = true }.parse(invalidXML) From cb7663bd033e2d071a13bc37bb9437ad4b7d9099 Mon Sep 17 00:00:00 2001 From: David Mohundro Date: Fri, 12 Feb 2021 20:31:56 -0600 Subject: [PATCH 2/4] docs: update class names --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1534c9f9..3768ade8 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ To set any of the configuration options, you use the `configure` method, like so: ```swift -let xml = SWXMLHash.config { +let xml = XMLHash.config { config in // set any config options here }.parse(xmlToParse) @@ -162,7 +162,7 @@ All examples below can be found in the included ### Initialization ```swift -let xml = SWXMLHash.parse(xmlToParse) +let xml = XMLHash.parse(xmlToParse) ``` Alternatively, if you're parsing a large XML file and need the best performance, @@ -172,17 +172,17 @@ for performance reasons. See the error handling for one caveat regarding lazy loading. ```swift -let xml = SWXMLHash.config { +let xml = XMLHash.config { config in config.shouldProcessLazily = true }.parse(xmlToParse) ``` The above approach uses the new config method, but there is also a `lazy` method -directly off of `SWXMLHash`. +directly off of `XMLHash`. ```swift -let xml = SWXMLHash.lazy(xmlToParse) +let xml = XMLHash.lazy(xmlToParse) ``` ### Single Element Lookup From 784f8618a7c8e27c522f268ca09a1b9106697851 Mon Sep 17 00:00:00 2001 From: David Mohundro Date: Fri, 12 Feb 2021 20:38:27 -0600 Subject: [PATCH 3/4] fix: rename file to match type --- SWXMLHash.xcodeproj/project.pbxproj | 20 +++++++++---------- Source/{SWXMLHash.swift => XMLHash.swift} | 0 .../XMLParsingValidationTests.swift | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) rename Source/{SWXMLHash.swift => XMLHash.swift} (100%) diff --git a/SWXMLHash.xcodeproj/project.pbxproj b/SWXMLHash.xcodeproj/project.pbxproj index 07109018..fd485542 100644 --- a/SWXMLHash.xcodeproj/project.pbxproj +++ b/SWXMLHash.xcodeproj/project.pbxproj @@ -22,10 +22,10 @@ CD4B5F3A19E2C42D005C1F33 /* test.xml in Resources */ = {isa = PBXBuildFile; fileRef = CD4B5F3919E2C42D005C1F33 /* test.xml */; }; CD6083F5196CA106000B4F8D /* SWXMLHash.h in Headers */ = {isa = PBXBuildFile; fileRef = CD6083F4196CA106000B4F8D /* SWXMLHash.h */; settings = {ATTRIBUTES = (Public, ); }; }; CD6083FB196CA106000B4F8D /* SWXMLHash.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD6083EF196CA106000B4F8D /* SWXMLHash.framework */; }; - CD60840C196CA11D000B4F8D /* SWXMLHash.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD60840B196CA11D000B4F8D /* SWXMLHash.swift */; }; + CD60840C196CA11D000B4F8D /* XMLHash.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD60840B196CA11D000B4F8D /* XMLHash.swift */; }; CD7934C41A7581E600867857 /* test.xml in Resources */ = {isa = PBXBuildFile; fileRef = CD4B5F3919E2C42D005C1F33 /* test.xml */; }; CD7934C51A7581F200867857 /* SWXMLHash.h in Headers */ = {isa = PBXBuildFile; fileRef = CD6083F4196CA106000B4F8D /* SWXMLHash.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CD7934C61A7581F500867857 /* SWXMLHash.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD60840B196CA11D000B4F8D /* SWXMLHash.swift */; }; + CD7934C61A7581F500867857 /* XMLHash.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD60840B196CA11D000B4F8D /* XMLHash.swift */; }; CD9D05371A757D8B003CCB21 /* SWXMLHash.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD9D052C1A757D8B003CCB21 /* SWXMLHash.framework */; }; CDC6D11B1D32D6CE00570DE5 /* XMLParsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D11A1D32D6CE00570DE5 /* XMLParsingTests.swift */; }; CDC6D11C1D32D6CE00570DE5 /* XMLParsingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC6D11A1D32D6CE00570DE5 /* XMLParsingTests.swift */; }; @@ -63,8 +63,8 @@ CDDEC7561BF6311B00AB138B /* SWXMLHash.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDDEC74C1BF6311A00AB138B /* SWXMLHash.framework */; }; CDDEC7701BF632D200AB138B /* SWXMLHash.h in Headers */ = {isa = PBXBuildFile; fileRef = CD6083F4196CA106000B4F8D /* SWXMLHash.h */; settings = {ATTRIBUTES = (Public, ); }; }; CDDEC7711BF632DD00AB138B /* SWXMLHash.h in Headers */ = {isa = PBXBuildFile; fileRef = CD6083F4196CA106000B4F8D /* SWXMLHash.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CDEA72731C00B0D900C10B28 /* SWXMLHash.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD60840B196CA11D000B4F8D /* SWXMLHash.swift */; }; - CDEA72741C00B0E300C10B28 /* SWXMLHash.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD60840B196CA11D000B4F8D /* SWXMLHash.swift */; }; + CDEA72731C00B0D900C10B28 /* XMLHash.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD60840B196CA11D000B4F8D /* XMLHash.swift */; }; + CDEA72741C00B0E300C10B28 /* XMLHash.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD60840B196CA11D000B4F8D /* XMLHash.swift */; }; E25A0776261CF79300C68B90 /* XMLParsingValidationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E25A0775261CF79300C68B90 /* XMLParsingValidationTests.swift */; }; E25A0777261CF79300C68B90 /* XMLParsingValidationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E25A0775261CF79300C68B90 /* XMLParsingValidationTests.swift */; }; E25A0778261CF79300C68B90 /* XMLParsingValidationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E25A0775261CF79300C68B90 /* XMLParsingValidationTests.swift */; }; @@ -136,7 +136,7 @@ CD6083F4196CA106000B4F8D /* SWXMLHash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SWXMLHash.h; sourceTree = ""; }; CD6083FA196CA106000B4F8D /* SWXMLHash iOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SWXMLHash iOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; CD608400196CA106000B4F8D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - CD60840B196CA11D000B4F8D /* SWXMLHash.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SWXMLHash.swift; sourceTree = ""; }; + CD60840B196CA11D000B4F8D /* XMLHash.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XMLHash.swift; sourceTree = ""; }; CD9D052C1A757D8B003CCB21 /* SWXMLHash.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SWXMLHash.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CD9D05361A757D8B003CCB21 /* SWXMLHash OSX Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SWXMLHash OSX Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; CDC6D11A1D32D6CE00570DE5 /* XMLParsingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XMLParsingTests.swift; sourceTree = ""; }; @@ -248,7 +248,7 @@ 6C42BED4205183AF00137D31 /* shim.swift */, CD6083F2196CA106000B4F8D /* Supporting Files */, CD6083F4196CA106000B4F8D /* SWXMLHash.h */, - CD60840B196CA11D000B4F8D /* SWXMLHash.swift */, + CD60840B196CA11D000B4F8D /* XMLHash.swift */, 54B83CC41C849D9B00D588B5 /* XMLIndexer+XMLIndexerDeserializable.swift */, ); path = Source; @@ -604,7 +604,7 @@ buildActionMask = 2147483647; files = ( 6C42BED8205183B000137D31 /* shim.swift in Sources */, - CD60840C196CA11D000B4F8D /* SWXMLHash.swift in Sources */, + CD60840C196CA11D000B4F8D /* XMLHash.swift in Sources */, 54B83CC51C849D9B00D588B5 /* XMLIndexer+XMLIndexerDeserializable.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -634,7 +634,7 @@ buildActionMask = 2147483647; files = ( 6C42BED5205183B000137D31 /* shim.swift in Sources */, - CD7934C61A7581F500867857 /* SWXMLHash.swift in Sources */, + CD7934C61A7581F500867857 /* XMLHash.swift in Sources */, 54B83CC61C849D9B00D588B5 /* XMLIndexer+XMLIndexerDeserializable.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -664,7 +664,7 @@ buildActionMask = 2147483647; files = ( 6C42BED6205183B000137D31 /* shim.swift in Sources */, - CDEA72731C00B0D900C10B28 /* SWXMLHash.swift in Sources */, + CDEA72731C00B0D900C10B28 /* XMLHash.swift in Sources */, 54B83CC71C849D9B00D588B5 /* XMLIndexer+XMLIndexerDeserializable.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -694,7 +694,7 @@ buildActionMask = 2147483647; files = ( 6C42BED7205183B000137D31 /* shim.swift in Sources */, - CDEA72741C00B0E300C10B28 /* SWXMLHash.swift in Sources */, + CDEA72741C00B0E300C10B28 /* XMLHash.swift in Sources */, 54B83CC81C849D9B00D588B5 /* XMLIndexer+XMLIndexerDeserializable.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Source/SWXMLHash.swift b/Source/XMLHash.swift similarity index 100% rename from Source/SWXMLHash.swift rename to Source/XMLHash.swift diff --git a/Tests/SWXMLHashTests/XMLParsingValidationTests.swift b/Tests/SWXMLHashTests/XMLParsingValidationTests.swift index bf37b9f2..5c364df1 100644 --- a/Tests/SWXMLHashTests/XMLParsingValidationTests.swift +++ b/Tests/SWXMLHashTests/XMLParsingValidationTests.swift @@ -70,7 +70,7 @@ class XMLParsingValidationTests: XCTestCase { func testValidatePriceOutOfBounds() { do { - let xml = SWXMLHash.parse(xmlToParseOOB) + let xml = XMLHash.parse(xmlToParseOOB) let _: BasicItem = try xml["root"]["basicItem"].value() XCTFail("Unexpected lack of exception.") } catch BasicItemValidation.priceOutOfBounds(let price) { @@ -82,7 +82,7 @@ class XMLParsingValidationTests: XCTestCase { func testValidatePriceInBounds() { do { - let xml = SWXMLHash.parse(xmlToParseIB) + let xml = XMLHash.parse(xmlToParseIB) let value: BasicItem = try xml["root"]["basicItem"].value() XCTAssertEqual(value.price, 99.14, "Unexpected price.") } catch BasicItemValidation.priceOutOfBounds(let price) { From c61b98fb039285899bce4ce520821ca48a8e0f9f Mon Sep 17 00:00:00 2001 From: David Mohundro Date: Tue, 28 Sep 2021 20:25:28 -0500 Subject: [PATCH 4/4] fix: rename comment header, too --- Source/XMLHash.swift | 2 +- Source/XMLIndexer+XMLIndexerDeserializable.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/XMLHash.swift b/Source/XMLHash.swift index 23210992..5ea2acf6 100644 --- a/Source/XMLHash.swift +++ b/Source/XMLHash.swift @@ -1,5 +1,5 @@ // -// SWXMLHash.swift +// XMLHash.swift // SWXMLHash // // Copyright (c) 2014 David Mohundro diff --git a/Source/XMLIndexer+XMLIndexerDeserializable.swift b/Source/XMLIndexer+XMLIndexerDeserializable.swift index a1f6a06e..2ddb8f31 100644 --- a/Source/XMLIndexer+XMLIndexerDeserializable.swift +++ b/Source/XMLIndexer+XMLIndexerDeserializable.swift @@ -1,5 +1,5 @@ // -// SWXMLHash+TypeConversion.swift +// XMLHash+TypeConversion.swift // SWXMLHash // // Copyright (c) 2016 Maciek Grzybowskio