├── LibXMLWrapperExample ├── LibXMLWrapperExample.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── janie.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── janie.xcuserdatad │ │ └── xcschemes │ │ ├── LibXMLWrapperExample.xcscheme │ │ └── xcschememanagement.plist ├── LibXMLWrapperExample │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Bridging-Header.h │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── LibXMLDoc.swift │ ├── LibXMLNode.swift │ └── PointDefaults.pattern └── LibXMLWrapperExampleTests │ ├── Info.plist │ └── LibXMLWrapperExampleTests.swift ├── README.md └── XMLProfiler ├── XMLProfiler.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── janie.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── janie.xcuserdatad │ └── xcschemes │ ├── XMLProfiler.xcscheme │ └── xcschememanagement.plist ├── XMLProfiler ├── Bridging-Header.h ├── VeryLargeSpotGrid.pattern └── main.swift └── XMLProfiler2 ├── Base.lproj └── MainMenu.xib ├── Images.xcassets └── AppIcon.appiconset │ └── Contents.json └── Info.plist /LibXMLWrapperExample/LibXMLWrapperExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 79D67D5A1AA7686A00333B9A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79D67D591AA7686A00333B9A /* AppDelegate.swift */; }; 11 | 79D67D5C1AA7686A00333B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 79D67D5B1AA7686A00333B9A /* Images.xcassets */; }; 12 | 79D67D5F1AA7686A00333B9A /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 79D67D5D1AA7686A00333B9A /* MainMenu.xib */; }; 13 | 79D67D6B1AA7686A00333B9A /* LibXMLWrapperExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79D67D6A1AA7686A00333B9A /* LibXMLWrapperExampleTests.swift */; }; 14 | 79D67D761AA768E300333B9A /* libxml2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 79D67D741AA768E300333B9A /* libxml2.2.dylib */; }; 15 | 79D67D771AA768E300333B9A /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 79D67D751AA768E300333B9A /* libxml2.dylib */; }; 16 | 79D67D7B1AA76A1900333B9A /* LibXMLDoc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79D67D791AA76A1900333B9A /* LibXMLDoc.swift */; }; 17 | 79D67D7C1AA76A1900333B9A /* LibXMLNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79D67D7A1AA76A1900333B9A /* LibXMLNode.swift */; }; 18 | 79D67D7E1AA76A2800333B9A /* PointDefaults.pattern in Resources */ = {isa = PBXBuildFile; fileRef = 79D67D7D1AA76A2800333B9A /* PointDefaults.pattern */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 79D67D651AA7686A00333B9A /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 79D67D4C1AA7686A00333B9A /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 79D67D531AA7686A00333B9A; 27 | remoteInfo = LibXMLWrapperExample; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 79D67D541AA7686A00333B9A /* LibXMLWrapperExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LibXMLWrapperExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 79D67D581AA7686A00333B9A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 79D67D591AA7686A00333B9A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 35 | 79D67D5B1AA7686A00333B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 36 | 79D67D5E1AA7686A00333B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 37 | 79D67D641AA7686A00333B9A /* LibXMLWrapperExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LibXMLWrapperExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 79D67D691AA7686A00333B9A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 39 | 79D67D6A1AA7686A00333B9A /* LibXMLWrapperExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibXMLWrapperExampleTests.swift; sourceTree = ""; }; 40 | 79D67D741AA768E300333B9A /* libxml2.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.2.dylib; path = usr/lib/libxml2.2.dylib; sourceTree = SDKROOT; }; 41 | 79D67D751AA768E300333B9A /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; 42 | 79D67D781AA768FE00333B9A /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = ""; }; 43 | 79D67D791AA76A1900333B9A /* LibXMLDoc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibXMLDoc.swift; sourceTree = ""; }; 44 | 79D67D7A1AA76A1900333B9A /* LibXMLNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibXMLNode.swift; sourceTree = ""; }; 45 | 79D67D7D1AA76A2800333B9A /* PointDefaults.pattern */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PointDefaults.pattern; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | 79D67D511AA7686A00333B9A /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | 79D67D761AA768E300333B9A /* libxml2.2.dylib in Frameworks */, 54 | 79D67D771AA768E300333B9A /* libxml2.dylib in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | 79D67D611AA7686A00333B9A /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 79D67D4B1AA7686A00333B9A = { 69 | isa = PBXGroup; 70 | children = ( 71 | 79D67D741AA768E300333B9A /* libxml2.2.dylib */, 72 | 79D67D751AA768E300333B9A /* libxml2.dylib */, 73 | 79D67D561AA7686A00333B9A /* LibXMLWrapperExample */, 74 | 79D67D671AA7686A00333B9A /* LibXMLWrapperExampleTests */, 75 | 79D67D551AA7686A00333B9A /* Products */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | 79D67D551AA7686A00333B9A /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 79D67D541AA7686A00333B9A /* LibXMLWrapperExample.app */, 83 | 79D67D641AA7686A00333B9A /* LibXMLWrapperExampleTests.xctest */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 79D67D561AA7686A00333B9A /* LibXMLWrapperExample */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 79D67D591AA7686A00333B9A /* AppDelegate.swift */, 92 | 79D67D781AA768FE00333B9A /* Bridging-Header.h */, 93 | 79D67D791AA76A1900333B9A /* LibXMLDoc.swift */, 94 | 79D67D7A1AA76A1900333B9A /* LibXMLNode.swift */, 95 | 79D67D7D1AA76A2800333B9A /* PointDefaults.pattern */, 96 | 79D67D5B1AA7686A00333B9A /* Images.xcassets */, 97 | 79D67D5D1AA7686A00333B9A /* MainMenu.xib */, 98 | 79D67D571AA7686A00333B9A /* Supporting Files */, 99 | ); 100 | path = LibXMLWrapperExample; 101 | sourceTree = ""; 102 | }; 103 | 79D67D571AA7686A00333B9A /* Supporting Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 79D67D581AA7686A00333B9A /* Info.plist */, 107 | ); 108 | name = "Supporting Files"; 109 | sourceTree = ""; 110 | }; 111 | 79D67D671AA7686A00333B9A /* LibXMLWrapperExampleTests */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 79D67D6A1AA7686A00333B9A /* LibXMLWrapperExampleTests.swift */, 115 | 79D67D681AA7686A00333B9A /* Supporting Files */, 116 | ); 117 | path = LibXMLWrapperExampleTests; 118 | sourceTree = ""; 119 | }; 120 | 79D67D681AA7686A00333B9A /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 79D67D691AA7686A00333B9A /* Info.plist */, 124 | ); 125 | name = "Supporting Files"; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | 79D67D531AA7686A00333B9A /* LibXMLWrapperExample */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = 79D67D6E1AA7686A00333B9A /* Build configuration list for PBXNativeTarget "LibXMLWrapperExample" */; 134 | buildPhases = ( 135 | 79D67D501AA7686A00333B9A /* Sources */, 136 | 79D67D511AA7686A00333B9A /* Frameworks */, 137 | 79D67D521AA7686A00333B9A /* Resources */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = LibXMLWrapperExample; 144 | productName = LibXMLWrapperExample; 145 | productReference = 79D67D541AA7686A00333B9A /* LibXMLWrapperExample.app */; 146 | productType = "com.apple.product-type.application"; 147 | }; 148 | 79D67D631AA7686A00333B9A /* LibXMLWrapperExampleTests */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 79D67D711AA7686A00333B9A /* Build configuration list for PBXNativeTarget "LibXMLWrapperExampleTests" */; 151 | buildPhases = ( 152 | 79D67D601AA7686A00333B9A /* Sources */, 153 | 79D67D611AA7686A00333B9A /* Frameworks */, 154 | 79D67D621AA7686A00333B9A /* Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | 79D67D661AA7686A00333B9A /* PBXTargetDependency */, 160 | ); 161 | name = LibXMLWrapperExampleTests; 162 | productName = LibXMLWrapperExampleTests; 163 | productReference = 79D67D641AA7686A00333B9A /* LibXMLWrapperExampleTests.xctest */; 164 | productType = "com.apple.product-type.bundle.unit-test"; 165 | }; 166 | /* End PBXNativeTarget section */ 167 | 168 | /* Begin PBXProject section */ 169 | 79D67D4C1AA7686A00333B9A /* Project object */ = { 170 | isa = PBXProject; 171 | attributes = { 172 | LastUpgradeCheck = 0630; 173 | ORGANIZATIONNAME = "Red Queen Coder, LLC"; 174 | TargetAttributes = { 175 | 79D67D531AA7686A00333B9A = { 176 | CreatedOnToolsVersion = 6.3; 177 | }; 178 | 79D67D631AA7686A00333B9A = { 179 | CreatedOnToolsVersion = 6.3; 180 | TestTargetID = 79D67D531AA7686A00333B9A; 181 | }; 182 | }; 183 | }; 184 | buildConfigurationList = 79D67D4F1AA7686A00333B9A /* Build configuration list for PBXProject "LibXMLWrapperExample" */; 185 | compatibilityVersion = "Xcode 3.2"; 186 | developmentRegion = English; 187 | hasScannedForEncodings = 0; 188 | knownRegions = ( 189 | en, 190 | Base, 191 | ); 192 | mainGroup = 79D67D4B1AA7686A00333B9A; 193 | productRefGroup = 79D67D551AA7686A00333B9A /* Products */; 194 | projectDirPath = ""; 195 | projectRoot = ""; 196 | targets = ( 197 | 79D67D531AA7686A00333B9A /* LibXMLWrapperExample */, 198 | 79D67D631AA7686A00333B9A /* LibXMLWrapperExampleTests */, 199 | ); 200 | }; 201 | /* End PBXProject section */ 202 | 203 | /* Begin PBXResourcesBuildPhase section */ 204 | 79D67D521AA7686A00333B9A /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | 79D67D7E1AA76A2800333B9A /* PointDefaults.pattern in Resources */, 209 | 79D67D5C1AA7686A00333B9A /* Images.xcassets in Resources */, 210 | 79D67D5F1AA7686A00333B9A /* MainMenu.xib in Resources */, 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | 79D67D621AA7686A00333B9A /* Resources */ = { 215 | isa = PBXResourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | /* End PBXResourcesBuildPhase section */ 222 | 223 | /* Begin PBXSourcesBuildPhase section */ 224 | 79D67D501AA7686A00333B9A /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 79D67D7B1AA76A1900333B9A /* LibXMLDoc.swift in Sources */, 229 | 79D67D5A1AA7686A00333B9A /* AppDelegate.swift in Sources */, 230 | 79D67D7C1AA76A1900333B9A /* LibXMLNode.swift in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | 79D67D601AA7686A00333B9A /* Sources */ = { 235 | isa = PBXSourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | 79D67D6B1AA7686A00333B9A /* LibXMLWrapperExampleTests.swift in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXSourcesBuildPhase section */ 243 | 244 | /* Begin PBXTargetDependency section */ 245 | 79D67D661AA7686A00333B9A /* PBXTargetDependency */ = { 246 | isa = PBXTargetDependency; 247 | target = 79D67D531AA7686A00333B9A /* LibXMLWrapperExample */; 248 | targetProxy = 79D67D651AA7686A00333B9A /* PBXContainerItemProxy */; 249 | }; 250 | /* End PBXTargetDependency section */ 251 | 252 | /* Begin PBXVariantGroup section */ 253 | 79D67D5D1AA7686A00333B9A /* MainMenu.xib */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | 79D67D5E1AA7686A00333B9A /* Base */, 257 | ); 258 | name = MainMenu.xib; 259 | sourceTree = ""; 260 | }; 261 | /* End PBXVariantGroup section */ 262 | 263 | /* Begin XCBuildConfiguration section */ 264 | 79D67D6C1AA7686A00333B9A /* Debug */ = { 265 | isa = XCBuildConfiguration; 266 | buildSettings = { 267 | ALWAYS_SEARCH_USER_PATHS = NO; 268 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 269 | CLANG_CXX_LIBRARY = "libc++"; 270 | CLANG_ENABLE_MODULES = YES; 271 | CLANG_ENABLE_OBJC_ARC = YES; 272 | CLANG_WARN_BOOL_CONVERSION = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 275 | CLANG_WARN_EMPTY_BODY = YES; 276 | CLANG_WARN_ENUM_CONVERSION = YES; 277 | CLANG_WARN_INT_CONVERSION = YES; 278 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 279 | CLANG_WARN_UNREACHABLE_CODE = YES; 280 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 281 | CODE_SIGN_IDENTITY = "-"; 282 | COPY_PHASE_STRIP = NO; 283 | DEBUG_INFORMATION_FORMAT = dwarf; 284 | ENABLE_STRICT_OBJC_MSGSEND = YES; 285 | GCC_C_LANGUAGE_STANDARD = gnu99; 286 | GCC_DYNAMIC_NO_PIC = NO; 287 | GCC_NO_COMMON_BLOCKS = YES; 288 | GCC_OPTIMIZATION_LEVEL = 0; 289 | GCC_PREPROCESSOR_DEFINITIONS = ( 290 | "DEBUG=1", 291 | "$(inherited)", 292 | ); 293 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | HEADER_SEARCH_PATHS = ( 301 | "$(inherited)", 302 | "/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", 303 | "$(SDKROOT)/usr/include/libxml2", 304 | ); 305 | MACOSX_DEPLOYMENT_TARGET = 10.10; 306 | MTL_ENABLE_DEBUG_INFO = YES; 307 | ONLY_ACTIVE_ARCH = YES; 308 | OTHER_LDFLAGS = "-lxml2"; 309 | SDKROOT = macosx; 310 | SWIFT_OBJC_BRIDGING_HEADER = "LibXMLWrapperExample/Bridging-Header.h"; 311 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 312 | }; 313 | name = Debug; 314 | }; 315 | 79D67D6D1AA7686A00333B9A /* Release */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ALWAYS_SEARCH_USER_PATHS = NO; 319 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 320 | CLANG_CXX_LIBRARY = "libc++"; 321 | CLANG_ENABLE_MODULES = YES; 322 | CLANG_ENABLE_OBJC_ARC = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_CONSTANT_CONVERSION = YES; 325 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 326 | CLANG_WARN_EMPTY_BODY = YES; 327 | CLANG_WARN_ENUM_CONVERSION = YES; 328 | CLANG_WARN_INT_CONVERSION = YES; 329 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 330 | CLANG_WARN_UNREACHABLE_CODE = YES; 331 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 332 | CODE_SIGN_IDENTITY = "-"; 333 | COPY_PHASE_STRIP = NO; 334 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 335 | ENABLE_NS_ASSERTIONS = NO; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu99; 338 | GCC_NO_COMMON_BLOCKS = YES; 339 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 340 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 341 | GCC_WARN_UNDECLARED_SELECTOR = YES; 342 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 343 | GCC_WARN_UNUSED_FUNCTION = YES; 344 | GCC_WARN_UNUSED_VARIABLE = YES; 345 | HEADER_SEARCH_PATHS = ( 346 | "$(inherited)", 347 | "/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", 348 | "$(SDKROOT)/usr/include/libxml2", 349 | ); 350 | MACOSX_DEPLOYMENT_TARGET = 10.10; 351 | MTL_ENABLE_DEBUG_INFO = NO; 352 | OTHER_LDFLAGS = "-lxml2"; 353 | SDKROOT = macosx; 354 | SWIFT_OBJC_BRIDGING_HEADER = "LibXMLWrapperExample/Bridging-Header.h"; 355 | }; 356 | name = Release; 357 | }; 358 | 79D67D6F1AA7686A00333B9A /* Debug */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 362 | COMBINE_HIDPI_IMAGES = YES; 363 | INFOPLIST_FILE = LibXMLWrapperExample/Info.plist; 364 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 365 | PRODUCT_NAME = "$(TARGET_NAME)"; 366 | }; 367 | name = Debug; 368 | }; 369 | 79D67D701AA7686A00333B9A /* Release */ = { 370 | isa = XCBuildConfiguration; 371 | buildSettings = { 372 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 373 | COMBINE_HIDPI_IMAGES = YES; 374 | INFOPLIST_FILE = LibXMLWrapperExample/Info.plist; 375 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 376 | PRODUCT_NAME = "$(TARGET_NAME)"; 377 | }; 378 | name = Release; 379 | }; 380 | 79D67D721AA7686A00333B9A /* Debug */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | BUNDLE_LOADER = "$(TEST_HOST)"; 384 | COMBINE_HIDPI_IMAGES = YES; 385 | FRAMEWORK_SEARCH_PATHS = ( 386 | "$(DEVELOPER_FRAMEWORKS_DIR)", 387 | "$(inherited)", 388 | ); 389 | GCC_PREPROCESSOR_DEFINITIONS = ( 390 | "DEBUG=1", 391 | "$(inherited)", 392 | ); 393 | INFOPLIST_FILE = LibXMLWrapperExampleTests/Info.plist; 394 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 395 | PRODUCT_NAME = "$(TARGET_NAME)"; 396 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LibXMLWrapperExample.app/Contents/MacOS/LibXMLWrapperExample"; 397 | }; 398 | name = Debug; 399 | }; 400 | 79D67D731AA7686A00333B9A /* Release */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | BUNDLE_LOADER = "$(TEST_HOST)"; 404 | COMBINE_HIDPI_IMAGES = YES; 405 | FRAMEWORK_SEARCH_PATHS = ( 406 | "$(DEVELOPER_FRAMEWORKS_DIR)", 407 | "$(inherited)", 408 | ); 409 | INFOPLIST_FILE = LibXMLWrapperExampleTests/Info.plist; 410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LibXMLWrapperExample.app/Contents/MacOS/LibXMLWrapperExample"; 413 | }; 414 | name = Release; 415 | }; 416 | /* End XCBuildConfiguration section */ 417 | 418 | /* Begin XCConfigurationList section */ 419 | 79D67D4F1AA7686A00333B9A /* Build configuration list for PBXProject "LibXMLWrapperExample" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | 79D67D6C1AA7686A00333B9A /* Debug */, 423 | 79D67D6D1AA7686A00333B9A /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | defaultConfigurationName = Release; 427 | }; 428 | 79D67D6E1AA7686A00333B9A /* Build configuration list for PBXNativeTarget "LibXMLWrapperExample" */ = { 429 | isa = XCConfigurationList; 430 | buildConfigurations = ( 431 | 79D67D6F1AA7686A00333B9A /* Debug */, 432 | 79D67D701AA7686A00333B9A /* Release */, 433 | ); 434 | defaultConfigurationIsVisible = 0; 435 | }; 436 | 79D67D711AA7686A00333B9A /* Build configuration list for PBXNativeTarget "LibXMLWrapperExampleTests" */ = { 437 | isa = XCConfigurationList; 438 | buildConfigurations = ( 439 | 79D67D721AA7686A00333B9A /* Debug */, 440 | 79D67D731AA7686A00333B9A /* Release */, 441 | ); 442 | defaultConfigurationIsVisible = 0; 443 | }; 444 | /* End XCConfigurationList section */ 445 | }; 446 | rootObject = 79D67D4C1AA7686A00333B9A /* Project object */; 447 | } 448 | -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample.xcodeproj/project.xcworkspace/xcuserdata/janie.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonoPlot/Swift-libxml/ccdf83994051aec569e67fe07550e7fdebb8bc86/LibXMLWrapperExample/LibXMLWrapperExample.xcodeproj/project.xcworkspace/xcuserdata/janie.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample.xcodeproj/xcuserdata/janie.xcuserdatad/xcschemes/LibXMLWrapperExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample.xcodeproj/xcuserdata/janie.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LibXMLWrapperExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 79D67D531AA7686A00333B9A 16 | 17 | primary 18 | 19 | 20 | 79D67D631AA7686A00333B9A 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) <2015>, 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | // 6 | // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | // 8 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation 9 | // and/or other materials provided with the distribution. 10 | // 11 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 13 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | import Cocoa 18 | 19 | @NSApplicationMain 20 | class AppDelegate: NSObject, NSApplicationDelegate { 21 | 22 | @IBOutlet weak var window: NSWindow! 23 | 24 | 25 | func applicationDidFinishLaunching(aNotification: NSNotification) { 26 | // Insert code here to initialize your application 27 | 28 | let patternURL = bundleResourceURL("PointDefaults.pattern") 29 | let patternDocument = LibXMLDoc(xmlURL: patternURL) 30 | 31 | if let rootNode = patternDocument.rootNode { 32 | outputXMLTree(rootNode, indentLevel: 0) 33 | } 34 | 35 | 36 | } 37 | 38 | func applicationWillTerminate(aNotification: NSNotification) { 39 | // Insert code here to tear down your application 40 | } 41 | 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | Default 539 | 540 | 541 | 542 | 543 | 544 | 545 | Left to Right 546 | 547 | 548 | 549 | 550 | 551 | 552 | Right to Left 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | Default 564 | 565 | 566 | 567 | 568 | 569 | 570 | Left to Right 571 | 572 | 573 | 574 | 575 | 576 | 577 | Right to Left 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample/Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import 6 | #import 7 | #import 8 | #import 9 | #import 10 | 11 | static inline UInt32 xmlElementTypeToInt(xmlElementType type) { 12 | return (UInt32) type; 13 | } -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.redqueencoder.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2015 Red Queen Coder, LLC. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample/LibXMLDoc.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) <2015>, 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | // 6 | // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | // 8 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation 9 | // and/or other materials provided with the distribution. 10 | // 11 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 13 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | import Foundation 18 | 19 | 20 | class LibXMLDoc { 21 | 22 | let document: xmlDocPtr 23 | private weak var internalRootNode: LibXMLNode? 24 | 25 | init(xmlURL: NSURL) { 26 | document = xmlParseFile(xmlURL.fileSystemRepresentation) 27 | } 28 | 29 | deinit { 30 | xmlFreeDoc(document) 31 | } 32 | 33 | var rootNode:LibXMLNode? { 34 | if let previousRootNode = internalRootNode { 35 | return previousRootNode 36 | } else { 37 | let myRootNode = xmlDocGetRootElement(document) 38 | if myRootNode != nil { 39 | let computedRootNode = LibXMLNode(xmlNode: myRootNode, xmlDocument: self) 40 | internalRootNode = computedRootNode 41 | return computedRootNode 42 | } else { 43 | return nil 44 | } 45 | } 46 | } 47 | 48 | } 49 | 50 | func bundleResourceURL(resourceName:String) -> NSURL { 51 | let bundleURL = NSBundle.mainBundle().resourceURL 52 | return NSURL(string:resourceName, relativeToURL:bundleURL!)! 53 | } -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExample/LibXMLNode.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) <2015>, 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | // 6 | // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | // 8 | // 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation 9 | // and/or other materials provided with the distribution. 10 | // 11 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 12 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 13 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | // GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | import Foundation 18 | 19 | class LibXMLNode { 20 | 21 | private let xmlNode: xmlNodePtr 22 | let xmlDocument: LibXMLDoc 23 | 24 | init(xmlNode: xmlNodePtr, xmlDocument: LibXMLDoc) { 25 | self.xmlNode = xmlNode 26 | self.xmlDocument = xmlDocument 27 | } 28 | 29 | deinit { 30 | // maybe deallocate the xmlNode 31 | } 32 | 33 | lazy var nodeName: String = { 34 | return String.fromCString(UnsafePointer(self.xmlNode.memory.name))! 35 | }() 36 | 37 | lazy var nodeChildren: [LibXMLNode] = { 38 | 39 | // This is going to be an array of XML_ELEMENT_NODE 40 | var array = [LibXMLNode]() 41 | 42 | let currentNode = self.xmlNode.memory.children 43 | 44 | 45 | 46 | for var currentNodePtr = currentNode; currentNodePtr != nil; currentNodePtr = currentNodePtr.memory.next { 47 | let childNode = LibXMLNode(xmlNode: currentNodePtr, xmlDocument: self.xmlDocument) 48 | 49 | // xmlNodeIsText() returns a status of 1 if the node is a text node and 0 if it is not. 50 | // We want to append the child node only if we know it isn't a text node. -JKC 51 | if xmlNodeIsText(currentNodePtr) == 0 { 52 | array.append(childNode) 53 | } 54 | } 55 | 56 | return array 57 | }() 58 | 59 | lazy var nodeValue: String? = { 60 | let textValue = xmlNodeListGetString(self.xmlDocument.document, self.xmlNode.memory.children, 1) 61 | if (textValue != nil) { 62 | let nodeString = String.fromCString(UnsafePointer(textValue))! 63 | free(textValue) 64 | return nodeString 65 | } else { 66 | return nil 67 | } 68 | }() 69 | 70 | } 71 | 72 | func outputXMLTree(nodeParameter:LibXMLNode, indentLevel:Int = 0) -> (){ 73 | 74 | let nodes = nodeParameter.nodeChildren 75 | 76 | var tabs:String = "" 77 | for currentTab in (0.. 2 | 3 | 1.00 4 | 1.00 5 | 50.00 6 | 100 7 | 8 | 1000 9 | 1000 10 | 11 | Solution 1 12 | 0.40 13 | 0.00 14 | 0.00 15 | 16 | 17 | 0 18 | 0 19 | 0 20 | Solution 1 21 | 0 22 | 23 | 24 | 1000 25 | 0 26 | 0 27 | Solution 1 28 | 0 29 | 30 | 31 | 1000 32 | 1000 33 | 0 34 | Solution 1 35 | 0 36 | 37 | 38 | 0 39 | 1000 40 | 0 41 | Solution 1 42 | 0 43 | 44 | -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.redqueencoder.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LibXMLWrapperExample/LibXMLWrapperExampleTests/LibXMLWrapperExampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LibXMLWrapperExampleTests.swift 3 | // LibXMLWrapperExampleTests 4 | // 5 | // Created by Janie Clayton-Hasz on 3/4/15. 6 | // Copyright (c) 2015 Red Queen Coder, LLC. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import XCTest 11 | 12 | class LibXMLWrapperExampleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Swift Wrappers for libxml2 2 | 3 | This repository holds a sample project that shows how to integrate libxml2, a C toolkit, with Swift. I wrote two wrapper classes to make integrating libxml2 into your project easier: 4 | 5 | - LibXMLDoc 6 | - LibXMLNode 7 | 8 | There is an example project that contains these two wrapper classes and a profiling project that shows how much faster libxml2 is than using NSXMLParser. 9 | 10 | For a more detailed explanation of this library, [please refer back to my blog post about it](http://redqueencoder.com/wrapping-libxml2-for-swift/). 11 | 12 | # Hooking Up libxml2 To Your Xcode Project 13 | 14 | libXML is included on your machine, but it isn’t included by default in Xcode. It will need to be important and linked to your project for Xcode to be able to see it. 15 | 16 | Go to your project and find your Build Settings in your Project. Search your Build Settings for Header Search Paths. In your project’s search paths, add the following: 17 | 18 | > $(SDKROOT)/usr/include/libxml2 19 | 20 | While still in your Build Settings, search for **Other Linker Flags.** Add this line to your linker flags: 21 | 22 | > -lxml2 23 | 24 | Now go to your Targets and find your Build Phases. Find the tab that says **Link Binaries with Library**. Click on the “+” sign to load a new library to link to the project. Search for “libxml2.” There should be two results. Add both of those results to your project. 25 | 26 | Lastly, you will need to import an Objective-C bridging header into your project. The Objective-C bridging header is a file that exists in this project, so you just need to drag it from the sample project over to your project. 27 | 28 | After the bridging header is added to your project, go back to your Build Settings and search for **Objective-C Bridging Header**. You will need to add a line that has your project name and the bridging header name in it. For example, in the sample project LibXMLWrapperExample, the line added to the bridging header was: 29 | 30 | > LibXMLWrapperExample/Bridging-Header.h 31 | -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 790288EF1A78117300BD9CB9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 790288EE1A78117300BD9CB9 /* Images.xcassets */; }; 11 | 790289051A78120E00BD9CB9 /* libxml2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 790288DE1A76E49800BD9CB9 /* libxml2.2.dylib */; }; 12 | 790289061A78120E00BD9CB9 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 790288DB1A76DD0A00BD9CB9 /* libxml2.dylib */; }; 13 | 790289071A78121900BD9CB9 /* VeryLargeSpotGrid.pattern in Resources */ = {isa = PBXBuildFile; fileRef = 79D864271A72C3B6005B787F /* VeryLargeSpotGrid.pattern */; }; 14 | 790289081A78124800BD9CB9 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793BC7931A72BBC90031A343 /* main.swift */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 790288DB1A76DD0A00BD9CB9 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; 19 | 790288DE1A76E49800BD9CB9 /* libxml2.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.2.dylib; path = usr/lib/libxml2.2.dylib; sourceTree = SDKROOT; }; 20 | 790288E11A76F02000BD9CB9 /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = ""; }; 21 | 790288E81A78117300BD9CB9 /* XMLProfiler.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XMLProfiler.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 790288EB1A78117300BD9CB9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | 790288EE1A78117300BD9CB9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 24 | 790288F11A78117300BD9CB9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 25 | 793BC7931A72BBC90031A343 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; 26 | 79D864271A72C3B6005B787F /* VeryLargeSpotGrid.pattern */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = VeryLargeSpotGrid.pattern; sourceTree = ""; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | 790288E51A78117300BD9CB9 /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | 790289051A78120E00BD9CB9 /* libxml2.2.dylib in Frameworks */, 35 | 790289061A78120E00BD9CB9 /* libxml2.dylib in Frameworks */, 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 790288E91A78117300BD9CB9 /* XMLProfiler2 */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | 790288EE1A78117300BD9CB9 /* Images.xcassets */, 46 | 790288F01A78117300BD9CB9 /* MainMenu.xib */, 47 | 790288EA1A78117300BD9CB9 /* Supporting Files */, 48 | ); 49 | path = XMLProfiler2; 50 | sourceTree = ""; 51 | }; 52 | 790288EA1A78117300BD9CB9 /* Supporting Files */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 790288EB1A78117300BD9CB9 /* Info.plist */, 56 | ); 57 | name = "Supporting Files"; 58 | sourceTree = ""; 59 | }; 60 | 793BC7871A72BBC90031A343 = { 61 | isa = PBXGroup; 62 | children = ( 63 | 790288DE1A76E49800BD9CB9 /* libxml2.2.dylib */, 64 | 790288DB1A76DD0A00BD9CB9 /* libxml2.dylib */, 65 | 793BC7921A72BBC90031A343 /* XMLProfiler */, 66 | 790288E91A78117300BD9CB9 /* XMLProfiler2 */, 67 | 793BC7911A72BBC90031A343 /* Products */, 68 | ); 69 | sourceTree = ""; 70 | }; 71 | 793BC7911A72BBC90031A343 /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 790288E81A78117300BD9CB9 /* XMLProfiler.app */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 793BC7921A72BBC90031A343 /* XMLProfiler */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 790288E11A76F02000BD9CB9 /* Bridging-Header.h */, 83 | 793BC7931A72BBC90031A343 /* main.swift */, 84 | 79D864271A72C3B6005B787F /* VeryLargeSpotGrid.pattern */, 85 | ); 86 | path = XMLProfiler; 87 | sourceTree = ""; 88 | }; 89 | /* End PBXGroup section */ 90 | 91 | /* Begin PBXNativeTarget section */ 92 | 790288E71A78117300BD9CB9 /* XMLProfiler */ = { 93 | isa = PBXNativeTarget; 94 | buildConfigurationList = 790288FF1A78117300BD9CB9 /* Build configuration list for PBXNativeTarget "XMLProfiler" */; 95 | buildPhases = ( 96 | 790288E41A78117300BD9CB9 /* Sources */, 97 | 790288E51A78117300BD9CB9 /* Frameworks */, 98 | 790288E61A78117300BD9CB9 /* Resources */, 99 | ); 100 | buildRules = ( 101 | ); 102 | dependencies = ( 103 | ); 104 | name = XMLProfiler; 105 | productName = XMLProfiler2; 106 | productReference = 790288E81A78117300BD9CB9 /* XMLProfiler.app */; 107 | productType = "com.apple.product-type.application"; 108 | }; 109 | /* End PBXNativeTarget section */ 110 | 111 | /* Begin PBXProject section */ 112 | 793BC7881A72BBC90031A343 /* Project object */ = { 113 | isa = PBXProject; 114 | attributes = { 115 | LastUpgradeCheck = 0610; 116 | ORGANIZATIONNAME = "Red Queen Coder, LLC"; 117 | TargetAttributes = { 118 | 790288E71A78117300BD9CB9 = { 119 | CreatedOnToolsVersion = 6.1.1; 120 | }; 121 | }; 122 | }; 123 | buildConfigurationList = 793BC78B1A72BBC90031A343 /* Build configuration list for PBXProject "XMLProfiler" */; 124 | compatibilityVersion = "Xcode 3.2"; 125 | developmentRegion = English; 126 | hasScannedForEncodings = 0; 127 | knownRegions = ( 128 | en, 129 | Base, 130 | ); 131 | mainGroup = 793BC7871A72BBC90031A343; 132 | productRefGroup = 793BC7911A72BBC90031A343 /* Products */; 133 | projectDirPath = ""; 134 | projectRoot = ""; 135 | targets = ( 136 | 790288E71A78117300BD9CB9 /* XMLProfiler */, 137 | ); 138 | }; 139 | /* End PBXProject section */ 140 | 141 | /* Begin PBXResourcesBuildPhase section */ 142 | 790288E61A78117300BD9CB9 /* Resources */ = { 143 | isa = PBXResourcesBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | 790288EF1A78117300BD9CB9 /* Images.xcassets in Resources */, 147 | 790289071A78121900BD9CB9 /* VeryLargeSpotGrid.pattern in Resources */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXResourcesBuildPhase section */ 152 | 153 | /* Begin PBXSourcesBuildPhase section */ 154 | 790288E41A78117300BD9CB9 /* Sources */ = { 155 | isa = PBXSourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | 790289081A78124800BD9CB9 /* main.swift in Sources */, 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | }; 162 | /* End PBXSourcesBuildPhase section */ 163 | 164 | /* Begin PBXVariantGroup section */ 165 | 790288F01A78117300BD9CB9 /* MainMenu.xib */ = { 166 | isa = PBXVariantGroup; 167 | children = ( 168 | 790288F11A78117300BD9CB9 /* Base */, 169 | ); 170 | name = MainMenu.xib; 171 | sourceTree = ""; 172 | }; 173 | /* End PBXVariantGroup section */ 174 | 175 | /* Begin XCBuildConfiguration section */ 176 | 790289001A78117300BD9CB9 /* Debug */ = { 177 | isa = XCBuildConfiguration; 178 | buildSettings = { 179 | ALWAYS_SEARCH_USER_PATHS = NO; 180 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 181 | CODE_SIGN_IDENTITY = "-"; 182 | COMBINE_HIDPI_IMAGES = YES; 183 | GCC_PREPROCESSOR_DEFINITIONS = ( 184 | "DEBUG=1", 185 | "$(inherited)", 186 | ); 187 | INFOPLIST_FILE = XMLProfiler2/Info.plist; 188 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 189 | PRODUCT_NAME = "$(TARGET_NAME)"; 190 | }; 191 | name = Debug; 192 | }; 193 | 790289011A78117300BD9CB9 /* Release */ = { 194 | isa = XCBuildConfiguration; 195 | buildSettings = { 196 | ALWAYS_SEARCH_USER_PATHS = NO; 197 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 198 | CODE_SIGN_IDENTITY = "-"; 199 | COMBINE_HIDPI_IMAGES = YES; 200 | INFOPLIST_FILE = XMLProfiler2/Info.plist; 201 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 202 | PRODUCT_NAME = "$(TARGET_NAME)"; 203 | }; 204 | name = Release; 205 | }; 206 | 793BC7951A72BBC90031A343 /* Debug */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ALWAYS_SEARCH_USER_PATHS = YES; 210 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 211 | CLANG_CXX_LIBRARY = "libc++"; 212 | CLANG_ENABLE_MODULES = YES; 213 | CLANG_ENABLE_OBJC_ARC = YES; 214 | CLANG_WARN_BOOL_CONVERSION = YES; 215 | CLANG_WARN_CONSTANT_CONVERSION = YES; 216 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 217 | CLANG_WARN_EMPTY_BODY = YES; 218 | CLANG_WARN_ENUM_CONVERSION = YES; 219 | CLANG_WARN_INT_CONVERSION = YES; 220 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 221 | CLANG_WARN_UNREACHABLE_CODE = YES; 222 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 223 | COPY_PHASE_STRIP = NO; 224 | ENABLE_STRICT_OBJC_MSGSEND = YES; 225 | GCC_C_LANGUAGE_STANDARD = gnu99; 226 | GCC_DYNAMIC_NO_PIC = NO; 227 | GCC_OPTIMIZATION_LEVEL = 0; 228 | GCC_PREPROCESSOR_DEFINITIONS = ( 229 | "DEBUG=1", 230 | "$(inherited)", 231 | ); 232 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 233 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 235 | GCC_WARN_UNDECLARED_SELECTOR = YES; 236 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 237 | GCC_WARN_UNUSED_FUNCTION = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | HEADER_SEARCH_PATHS = ( 240 | "$(inherited)", 241 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 242 | "$(SDKROOT)/usr/include/libxml2", 243 | ); 244 | MACOSX_DEPLOYMENT_TARGET = 10.10; 245 | MTL_ENABLE_DEBUG_INFO = YES; 246 | ONLY_ACTIVE_ARCH = YES; 247 | OTHER_LDFLAGS = "-lxml2"; 248 | SDKROOT = macosx; 249 | SWIFT_OBJC_BRIDGING_HEADER = "XMLProfiler/Bridging-Header.h"; 250 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 251 | }; 252 | name = Debug; 253 | }; 254 | 793BC7961A72BBC90031A343 /* Release */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ALWAYS_SEARCH_USER_PATHS = YES; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | COPY_PHASE_STRIP = YES; 272 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 273 | ENABLE_NS_ASSERTIONS = NO; 274 | ENABLE_STRICT_OBJC_MSGSEND = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu99; 276 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 277 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 278 | GCC_WARN_UNDECLARED_SELECTOR = YES; 279 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 280 | GCC_WARN_UNUSED_FUNCTION = YES; 281 | GCC_WARN_UNUSED_VARIABLE = YES; 282 | HEADER_SEARCH_PATHS = ( 283 | "$(inherited)", 284 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 285 | "$(SDKROOT)/usr/include/libxml2", 286 | ); 287 | MACOSX_DEPLOYMENT_TARGET = 10.10; 288 | MTL_ENABLE_DEBUG_INFO = NO; 289 | OTHER_LDFLAGS = "-lxml2"; 290 | SDKROOT = macosx; 291 | SWIFT_OBJC_BRIDGING_HEADER = "XMLProfiler/Bridging-Header.h"; 292 | }; 293 | name = Release; 294 | }; 295 | /* End XCBuildConfiguration section */ 296 | 297 | /* Begin XCConfigurationList section */ 298 | 790288FF1A78117300BD9CB9 /* Build configuration list for PBXNativeTarget "XMLProfiler" */ = { 299 | isa = XCConfigurationList; 300 | buildConfigurations = ( 301 | 790289001A78117300BD9CB9 /* Debug */, 302 | 790289011A78117300BD9CB9 /* Release */, 303 | ); 304 | defaultConfigurationIsVisible = 0; 305 | defaultConfigurationName = Release; 306 | }; 307 | 793BC78B1A72BBC90031A343 /* Build configuration list for PBXProject "XMLProfiler" */ = { 308 | isa = XCConfigurationList; 309 | buildConfigurations = ( 310 | 793BC7951A72BBC90031A343 /* Debug */, 311 | 793BC7961A72BBC90031A343 /* Release */, 312 | ); 313 | defaultConfigurationIsVisible = 0; 314 | defaultConfigurationName = Release; 315 | }; 316 | /* End XCConfigurationList section */ 317 | }; 318 | rootObject = 793BC7881A72BBC90031A343 /* Project object */; 319 | } 320 | -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler.xcodeproj/project.xcworkspace/xcuserdata/janie.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonoPlot/Swift-libxml/ccdf83994051aec569e67fe07550e7fdebb8bc86/XMLProfiler/XMLProfiler.xcodeproj/project.xcworkspace/xcuserdata/janie.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler.xcodeproj/xcuserdata/janie.xcuserdatad/xcschemes/XMLProfiler.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler.xcodeproj/xcuserdata/janie.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | XMLProfiler.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 790288E71A78117300BD9CB9 16 | 17 | primary 18 | 19 | 20 | 790288F61A78117300BD9CB9 21 | 22 | primary 23 | 24 | 25 | 793BC78F1A72BBC90031A343 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler/Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import 6 | #import 7 | #import 8 | #import 9 | #import 10 | 11 | static inline UInt32 xmlElementTypeToInt(xmlElementType type) { 12 | return (UInt32) type; 13 | } -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler/main.swift: -------------------------------------------------------------------------------- 1 | // 2 | // main.swift 3 | // XMLProfiler 4 | // 5 | // Created by Janie Clayton-Hasz on 1/23/15. 6 | // Copyright (c) 2015 Red Queen Coder, LLC. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class ThrowAwayClassForParsing: NSObject, NSXMLParserDelegate { 12 | 13 | func parser(parser: NSXMLParser!, 14 | didStartElement elementName: String!, 15 | namespaceURI: String!, qualifiedName qName: String!, 16 | attributes attributeDict: [NSObject : AnyObject]!) { 17 | 18 | } 19 | 20 | func parser(parser: NSXMLParser!, 21 | didEndElement elementName: String!, 22 | namespaceURI: String!, 23 | qualifiedName qName: String!) { 24 | 25 | } 26 | 27 | } 28 | 29 | let myThrowawayDelegateClass = ThrowAwayClassForParsing() 30 | 31 | func bundleResourceURL(resourceName:String) -> NSURL { 32 | let bundleURL = NSBundle.mainBundle().resourceURL 33 | return NSURL(string:resourceName, relativeToURL:bundleURL!)! 34 | } 35 | 36 | let largePatternFileString = "VeryLargeSpotGrid.pattern" 37 | 38 | // Profiling Convenience function 39 | func printTimeElapsedWhenRunningCode(title:String, operation:()->()) { 40 | let startTime = CFAbsoluteTimeGetCurrent() 41 | operation() 42 | let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime 43 | println("Time elapsed for \(title): \(timeElapsed) s") 44 | } 45 | 46 | // Need to load a file two different ways: NSFileHandler and NSData loadFromFile. 47 | // Profile to find which is faster 48 | 49 | func dataLoadFromFile() { 50 | // Is there more to this? I think I am missing something. -JKC 51 | let fileURL = bundleResourceURL(largePatternFileString) 52 | let patternData = NSData(contentsOfURL: fileURL)! 53 | } 54 | 55 | func dataLoadFromFileHandler() { 56 | 57 | // No, I am not doing any error handling and lots of this is really bad. -JKC 58 | // Is there more to this? I think I am missing something. -JKC 59 | let fileURL = bundleResourceURL(largePatternFileString) 60 | var myError: NSError? = nil 61 | let fileHandle = NSFileHandle(forReadingFromURL: fileURL, error: &myError)! 62 | let patternData = fileHandle.readDataToEndOfFile() 63 | println("dataLoadFromFileHandler pattern data length: \(patternData.length)") 64 | fileHandle.closeFile() 65 | } 66 | 67 | 68 | // Need to parse a file three different ways: Tree based and event based with either NSXMLParser or libxml2 69 | // Profile to find which is faster 70 | 71 | // Tree Based Parsing (NSXMLDocument) 72 | func treeBasedParsingFromURL() { 73 | let fileURL = bundleResourceURL(largePatternFileString) 74 | 75 | var myError:NSError? = nil 76 | let xmlDocFromData = NSXMLDocument(contentsOfURL: fileURL, options: 0, error: &myError)! 77 | 78 | let rootElement = xmlDocFromData.rootElement()! 79 | let firstChild = rootElement.childAtIndex(0)! 80 | } 81 | 82 | func treeBasedParsingFromDataPersistedObject() { 83 | let fileURL = bundleResourceURL(largePatternFileString) 84 | let patternData = NSData(contentsOfURL: fileURL)! 85 | var myError:NSError? = nil 86 | let xmlDocFromData = NSXMLDocument(data: patternData, options: 0, error: &myError) 87 | } 88 | 89 | 90 | // Tree Based Parsing (libxml2) 91 | func treeBasedParsingUsingLibxml() { 92 | let fileURL = bundleResourceURL(largePatternFileString) 93 | let document: xmlDocPtr = xmlParseFile(fileURL.fileSystemRepresentation) 94 | let nodePointer: xmlNodePtr = xmlDocGetRootElement(document) 95 | let nodeName = String.fromCString(UnsafePointer(nodePointer.memory.name)) 96 | } 97 | 98 | 99 | // Profile the times to parse 100 | printTimeElapsedWhenRunningCode("Tree Based Parsing From URL") { 101 | treeBasedParsingFromURL() 102 | } 103 | 104 | printTimeElapsedWhenRunningCode("Tree Based Parsing From Data Persisted Object") { 105 | treeBasedParsingFromDataPersistedObject() 106 | } 107 | 108 | printTimeElapsedWhenRunningCode("Event Based Parsing Using NSXMLParser") { 109 | let patternURL = bundleResourceURL(largePatternFileString) 110 | let parser = NSXMLParser(contentsOfURL: patternURL)! 111 | 112 | parser.delegate = myThrowawayDelegateClass 113 | parser.parse() 114 | } 115 | 116 | printTimeElapsedWhenRunningCode("Tree Based Parsing Using libxml") { 117 | treeBasedParsingUsingLibxml() 118 | } -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler2/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | Default 539 | 540 | 541 | 542 | 543 | 544 | 545 | Left to Right 546 | 547 | 548 | 549 | 550 | 551 | 552 | Right to Left 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | Default 564 | 565 | 566 | 567 | 568 | 569 | 570 | Left to Right 571 | 572 | 573 | 574 | 575 | 576 | 577 | Right to Left 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler2/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /XMLProfiler/XMLProfiler2/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.redqueencoder.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2015 Red Queen Coder, LLC. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | --------------------------------------------------------------------------------