diff --git a/.gitignore b/.gitignore index 7019237..de93b6f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,11 +11,14 @@ build/ !default.perspectivev3 xcuserdata *.xccheckout +*.xcscmblueprint *.moved-aside DerivedData *.hmap *.ipa *.xcuserstate +*.dSYM.zip +*.dSYM # CocoaPods # @@ -30,4 +33,4 @@ Pods/ # Add this line if you want to avoid checking in source code from Carthage dependencies. # Carthage/Checkouts -Carthage/Build \ No newline at end of file +Carthage/Build diff --git a/GPXTracker/CartFile b/GPXTracker/CartFile new file mode 100644 index 0000000..02c3b26 --- /dev/null +++ b/GPXTracker/CartFile @@ -0,0 +1,3 @@ +github "tid-kijyun/Kanna" +github "pkluz/PKHUD" +github "marmelroy/Zip" diff --git a/GPXTracker/Cartfile.resolved b/GPXTracker/Cartfile.resolved new file mode 100644 index 0000000..2c99d66 --- /dev/null +++ b/GPXTracker/Cartfile.resolved @@ -0,0 +1,3 @@ +github "marmelroy/Zip" "1.1.0" +github "pkluz/PKHUD" "5.0.0" +github "tid-kijyun/Kanna" "4.0.0" diff --git a/GPXTracker/Carthage/Checkouts/Kanna/.github/ISSUE_TEMPLATE.md b/GPXTracker/Carthage/Checkouts/Kanna/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..36c6b5e --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,19 @@ +### Description: + + +### Installation method: +- [ ] Carthage +- [ ] CocoaPods(1.1.0 or later) +- [ ] Swift Package Manager +- [ ] Manually +- [ ] other: () + +### Library version: +- [ ] v2.1.1 +- [ ] other: () + +### Xcode version: +- [ ] 8.1 (Swift 3) +- [ ] 8.1 (Swift 2.3) +- [ ] 7.3.1 +- [ ] other: () diff --git a/GPXTracker/Carthage/Checkouts/Kanna/.gitignore b/GPXTracker/Carthage/Checkouts/Kanna/.gitignore new file mode 100644 index 0000000..f34834a --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/.gitignore @@ -0,0 +1,32 @@ +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control +# +# Pods/ + +.build +Packages + diff --git a/GPXTracker/Carthage/Checkouts/Kanna/.swift-version b/GPXTracker/Carthage/Checkouts/Kanna/.swift-version new file mode 100644 index 0000000..81daaa3 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/.swift-version @@ -0,0 +1,2 @@ +4.0.3 + diff --git a/GPXTracker/Carthage/Checkouts/Kanna/.travis.yml b/GPXTracker/Carthage/Checkouts/Kanna/.travis.yml new file mode 100644 index 0000000..1e870fa --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/.travis.yml @@ -0,0 +1,37 @@ +env: + global: + - LC_CTYPE=en_US.UTF-8 + +matrix: + include: + - os: osx + language: objective-c + osx_image: xcode9.2 + script: + - set -o pipefail + - xcodebuild build-for-testing test-without-building -scheme Kanna -configuration Release ENABLE_TESTABILITY=YES | xcpretty -c + - xcodebuild build-for-testing test-without-building -scheme Kanna -configuration Release -sdk iphonesimulator -destination "name=iPhone 7" ENABLE_TESTABILITY=YES | xcpretty -c + - xcodebuild build-for-testing test-without-building -scheme Kanna -configuration Release -sdk appletvsimulator -destination "name=Apple TV" ENABLE_TESTABILITY=YES | xcpretty -c + - xcodebuild -scheme Kanna -configuration Release -sdk watchsimulator -destination "name=Apple Watch - 38mm" + - os: osx + language: generic + osx_image: xcode9.2 + script: + - swift build + - swift test + - os: linux + language: generic + sudo: required + dist: trusty + before_install: + - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" + script: + - swift --version + - swift build + - swift test + env: + - SWIFT_VERSION=4.0.3 + +notifications: + email: false + diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Carthage/Build b/GPXTracker/Carthage/Checkouts/Kanna/Carthage/Build new file mode 120000 index 0000000..76f9ba2 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Carthage/Build @@ -0,0 +1 @@ +../../../../Carthage/Build \ No newline at end of file diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Base.xcconfig b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Base.xcconfig new file mode 100644 index 0000000..4db7aff --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Base.xcconfig @@ -0,0 +1,42 @@ +// +// Base.xcconfig +// Kanna +// +// Created by Atsushi Kiwaki on 2016/12/05. +// Copyright © 2016 Atsushi Kiwaki. All rights reserved. +// +ALWAYS_SEARCH_USER_PATHS = NO +CLANG_CXX_LANGUAGE_STANDARD = gnu++0x +CLANG_CXX_LIBRARY = libc++ +CLANG_ENABLE_MODULES = YES +CLANG_ENABLE_OBJC_ARC = YES +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_BOOL_CONVERSION = YES +CLANG_WARN_CONSTANT_CONVERSION = YES +CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR +CLANG_WARN_EMPTY_BODY = YES +CLANG_WARN_ENUM_CONVERSION = YES +CLANG_WARN_INT_CONVERSION = YES +CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR +CLANG_WARN_UNREACHABLE_CODE = YES +CURRENT_PROJECT_VERSION = 1 +ENABLE_STRICT_OBJC_MSGSEND = YES +GCC_C_LANGUAGE_STANDARD = gnu99 +GCC_WARN_64_TO_32_BIT_CONVERSION = YES +GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR +GCC_WARN_UNDECLARED_SELECTOR = YES +GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE +GCC_WARN_UNUSED_FUNCTION = YES +GCC_WARN_UNUSED_VARIABLE = YES +VERSION_INFO_PREFIX = +VERSIONING_SYSTEM = apple-generic + +CODE_SIGNING_REQUIRED = NO +CODE_SIGN_IDENTITY = +MACOSX_DEPLOYMENT_TARGET = 10.9 +IPHONEOS_DEPLOYMENT_TARGET = 8.0 +WATCHOS_DEPLOYMENT_TARGET = 2.0 +TVOS_DEPLOYMENT_TARGET = 9.0 + +HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 +SWIFT_INCLUDE_PATHS = $(SRCROOT)/Modules diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Debug.xcconfig b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Debug.xcconfig new file mode 100644 index 0000000..42e21dc --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Debug.xcconfig @@ -0,0 +1,19 @@ +// +// Debug.xcconfig +// Kanna +// +// Created by Atsushi Kiwaki on 2016/12/05. +// Copyright © 2016 Atsushi Kiwaki. All rights reserved. +// +#include "Base.xcconfig" + +BITCODE_GENERATION_MODE = marker +MTL_ENABLE_DEBUG_INFO = YES +COPY_PHASE_STRIP = NO +ENABLE_TESTABILITY = YES +GCC_OPTIMIZATION_LEVEL = 0 +GCC_DYNAMIC_NO_PIC = NO +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) DEBUG=1 +GCC_SYMBOLS_PRIVATE_EXTERN = NO +ONLY_ACTIVE_ARCH = YES +SWIFT_OPTIMIZATION_LEVEL = -Onone diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Kanna.xcconfig b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Kanna.xcconfig new file mode 100644 index 0000000..4a9bb5b --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Kanna.xcconfig @@ -0,0 +1,31 @@ +// +// Kanna.xcconfig +// Kanna +// +// Created by Atsushi Kiwaki on 2016/12/05. +// Copyright © 2016 Atsushi Kiwaki. All rights reserved. +// +COMBINE_HIDPI_IMAGES = YES +DEFINES_MODULE = YES +DYLIB_COMPATIBILITY_VERSION = 1 +DYLIB_CURRENT_VERSION = 1 +DYLIB_INSTALL_NAME_BASE = @rpath +FRAMEWORK_VERSION = A +INFOPLIST_FILE = Sources/Kanna/Info.plist +PRODUCT_BUNDLE_IDENTIFIER = com.tid.$(PRODUCT_NAME:rfc1034identifier) +PRODUCT_NAME = $(PROJECT_NAME) +SKIP_INSTALL = YES + +SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator +TARGETED_DEVICE_FAMILY = 1,2,3,4 + +ENABLE_BITCODE[sdk=iphone*] = YES; +ENABLE_BITCODE[sdk=watch*] = YES; +ENABLE_BITCODE[sdk=appletv*] = YES; + +LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks +LD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks +LD_RUNPATH_SEARCH_PATHS[sdk=watch*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks +LD_RUNPATH_SEARCH_PATHS[sdk=appletv*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks + +APPLICATION_EXTENSION_API_ONLY = YES; diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Release.xcconfig b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Release.xcconfig new file mode 100644 index 0000000..4505f4d --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Release.xcconfig @@ -0,0 +1,15 @@ +// +// Release.xcconfig +// Kanna +// +// Created by Atsushi Kiwaki on 2016/12/05. +// Copyright © 2016 Atsushi Kiwaki. All rights reserved. +// +#include "Base.xcconfig" + +COPY_PHASE_STRIP = YES +ENABLE_NS_ASSERTIONS = NO +MTL_ENABLE_DEBUG_INFO = NO +VALIDATE_PRODUCT = YES +DEBUG_INFORMATION_FORMAT = dwarf-with-dsym +BITCODE_GENERATION_MODE = bitcode diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Tests.xcconfig b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Tests.xcconfig new file mode 100644 index 0000000..2f9f5b3 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Configurations/Tests.xcconfig @@ -0,0 +1,17 @@ +// +// Tests.xcconfig +// Kanna +// +// Created by Atsushi Kiwaki on 2016/12/05. +// Copyright © 2016 Atsushi Kiwaki. All rights reserved. +// +COMBINE_HIDPI_IMAGES = YES +INFOPLIST_FILE = Tests/KannaTests/Info.plist +PRODUCT_BUNDLE_IDENTIFIER = com.tid.$(PRODUCT_NAME:rfc1034identifier) +PRODUCT_NAME = $(PROJECT_NAME)Tests + +SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator + +LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks +LD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks +LD_RUNPATH_SEARCH_PATHS[sdk=appletv*] = $(inherited) @executable_path/Frameworks @loader_path/Frameworks diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Kanna.podspec b/GPXTracker/Carthage/Checkouts/Kanna/Kanna.podspec new file mode 100644 index 0000000..063acd9 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Kanna.podspec @@ -0,0 +1,23 @@ +Pod::Spec.new do |s| + s.name = "Kanna" + s.version = "4.0.0" + s.summary = "Kanna is an XML/HTML parser for iOS/macOS/watchOS/tvOS and Linux." + s.homepage = "https://github.com/tid-kijyun/Kanna" + s.license = 'MIT' + s.author = { "Atsushi Kiwaki" => "tid.develop@gmail.com" } + s.source = { :git => "https://github.com/tid-kijyun/Kanna.git", :tag => s.version.to_s } + s.social_media_url = 'https://twitter.com/_tid_' + + s.ios.deployment_target = '8.0' + s.osx.deployment_target = '10.9' + s.tvos.deployment_target = "9.0" + s.watchos.deployment_target = "2.0" + s.requires_arc = true + s.preserve_path = 'Modules/*' + s.source_files = ['Sources/**/*.swift', 'Sources/**/*.h'] + s.xcconfig = { + 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2', + 'SWIFT_INCLUDE_PATHS' => '$(SRCROOT)/Kanna/Modules' + } +end + diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Kanna.xcodeproj/project.pbxproj b/GPXTracker/Carthage/Checkouts/Kanna/Kanna.xcodeproj/project.pbxproj new file mode 100644 index 0000000..f3e1596 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Kanna.xcodeproj/project.pbxproj @@ -0,0 +1,535 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1E7ADC3D1DF4F3FC006E1815 /* Kanna.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E7ADC331DF4F3FC006E1815 /* Kanna.framework */; }; + 1E7ADC561DF4F567006E1815 /* CSS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7ADC4F1DF4F567006E1815 /* CSS.swift */; }; + 1E7ADC581DF4F567006E1815 /* Kanna.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E7ADC511DF4F567006E1815 /* Kanna.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1E7ADC591DF4F567006E1815 /* Kanna.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7ADC521DF4F567006E1815 /* Kanna.swift */; }; + 1E7ADC5A1DF4F567006E1815 /* libxmlHTMLDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7ADC531DF4F567006E1815 /* libxmlHTMLDocument.swift */; }; + 1E7ADC5B1DF4F567006E1815 /* libxmlHTMLNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7ADC541DF4F567006E1815 /* libxmlHTMLNode.swift */; }; + 1E7ADC5C1DF4F567006E1815 /* libxmlParserOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7ADC551DF4F567006E1815 /* libxmlParserOption.swift */; }; + 1E7ADC931DF55B37006E1815 /* KannaTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7ADC8B1DF55B37006E1815 /* KannaTests.swift */; }; + 1E7ADC941DF55B37006E1815 /* KannaTutorialsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7ADC8C1DF55B37006E1815 /* KannaTutorialsTest.swift */; }; + 1E7ADCA01DF5907F006E1815 /* libraries.xml in Resources */ = {isa = PBXBuildFile; fileRef = 1E7ADC9B1DF5907F006E1815 /* libraries.xml */; }; + 1E7ADCA11DF5907F006E1815 /* sample.html in Resources */ = {isa = PBXBuildFile; fileRef = 1E7ADC9C1DF5907F006E1815 /* sample.html */; }; + 1E7ADCA21DF5907F006E1815 /* test_HTML4.html in Resources */ = {isa = PBXBuildFile; fileRef = 1E7ADC9D1DF5907F006E1815 /* test_HTML4.html */; }; + 1E7ADCA31DF5907F006E1815 /* test_XML_ExcelWorkbook.xml in Resources */ = {isa = PBXBuildFile; fileRef = 1E7ADC9E1DF5907F006E1815 /* test_XML_ExcelWorkbook.xml */; }; + 1E7ADCA41DF5907F006E1815 /* versions.xml in Resources */ = {isa = PBXBuildFile; fileRef = 1E7ADC9F1DF5907F006E1815 /* versions.xml */; }; + 1EC805FA1FA2FB2F0067D3DA /* Deprecated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EC805F91FA2FB2F0067D3DA /* Deprecated.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 1E7ADC3E1DF4F3FC006E1815 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1E7ADC2A1DF4F3FC006E1815 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1E7ADC321DF4F3FC006E1815; + remoteInfo = Kanna; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1E7ADC331DF4F3FC006E1815 /* Kanna.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Kanna.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1E7ADC3C1DF4F3FC006E1815 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 1E7ADC4F1DF4F567006E1815 /* CSS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CSS.swift; sourceTree = ""; }; + 1E7ADC501DF4F567006E1815 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 1E7ADC511DF4F567006E1815 /* Kanna.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Kanna.h; sourceTree = ""; }; + 1E7ADC521DF4F567006E1815 /* Kanna.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Kanna.swift; sourceTree = ""; }; + 1E7ADC531DF4F567006E1815 /* libxmlHTMLDocument.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = libxmlHTMLDocument.swift; sourceTree = ""; }; + 1E7ADC541DF4F567006E1815 /* libxmlHTMLNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = libxmlHTMLNode.swift; sourceTree = ""; }; + 1E7ADC551DF4F567006E1815 /* libxmlParserOption.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = libxmlParserOption.swift; sourceTree = ""; }; + 1E7ADC641DF4F7E1006E1815 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = ""; }; + 1E7ADC651DF4F80E006E1815 /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + 1E7ADC661DF4F86F006E1815 /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 1E7ADC671DF4F885006E1815 /* Kanna.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Kanna.xcconfig; sourceTree = ""; }; + 1E7ADC681DF4F8D5006E1815 /* Tests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Tests.xcconfig; sourceTree = ""; }; + 1E7ADC8A1DF55B37006E1815 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Tests/KannaTests/Info.plist; sourceTree = SOURCE_ROOT; }; + 1E7ADC8B1DF55B37006E1815 /* KannaTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = KannaTests.swift; path = Tests/KannaTests/KannaTests.swift; sourceTree = SOURCE_ROOT; }; + 1E7ADC8C1DF55B37006E1815 /* KannaTutorialsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = KannaTutorialsTest.swift; path = Tests/KannaTests/KannaTutorialsTest.swift; sourceTree = SOURCE_ROOT; }; + 1E7ADC9B1DF5907F006E1815 /* libraries.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = libraries.xml; sourceTree = ""; }; + 1E7ADC9C1DF5907F006E1815 /* sample.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = sample.html; sourceTree = ""; }; + 1E7ADC9D1DF5907F006E1815 /* test_HTML4.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = test_HTML4.html; sourceTree = ""; }; + 1E7ADC9E1DF5907F006E1815 /* test_XML_ExcelWorkbook.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = test_XML_ExcelWorkbook.xml; sourceTree = ""; }; + 1E7ADC9F1DF5907F006E1815 /* versions.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = versions.xml; sourceTree = ""; }; + 1EC805F91FA2FB2F0067D3DA /* Deprecated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Deprecated.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1E7ADC2F1DF4F3FC006E1815 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1E7ADC391DF4F3FC006E1815 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1E7ADC3D1DF4F3FC006E1815 /* Kanna.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1E7ADC291DF4F3FC006E1815 = { + isa = PBXGroup; + children = ( + 1E7ADC4D1DF4F567006E1815 /* Sources */, + 1E7ADC5D1DF4F576006E1815 /* Tests */, + 1E7ADC631DF4F7BC006E1815 /* Configurations */, + 1E7ADC341DF4F3FC006E1815 /* Products */, + ); + sourceTree = ""; + }; + 1E7ADC341DF4F3FC006E1815 /* Products */ = { + isa = PBXGroup; + children = ( + 1E7ADC331DF4F3FC006E1815 /* Kanna.framework */, + 1E7ADC3C1DF4F3FC006E1815 /* Tests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 1E7ADC4D1DF4F567006E1815 /* Sources */ = { + isa = PBXGroup; + children = ( + 1E7ADC4E1DF4F567006E1815 /* Kanna */, + ); + path = Sources; + sourceTree = ""; + }; + 1E7ADC4E1DF4F567006E1815 /* Kanna */ = { + isa = PBXGroup; + children = ( + 1E7ADC511DF4F567006E1815 /* Kanna.h */, + 1E7ADC521DF4F567006E1815 /* Kanna.swift */, + 1E7ADC4F1DF4F567006E1815 /* CSS.swift */, + 1E7ADC531DF4F567006E1815 /* libxmlHTMLDocument.swift */, + 1E7ADC541DF4F567006E1815 /* libxmlHTMLNode.swift */, + 1E7ADC551DF4F567006E1815 /* libxmlParserOption.swift */, + 1EC805F91FA2FB2F0067D3DA /* Deprecated.swift */, + 1E7ADC501DF4F567006E1815 /* Info.plist */, + ); + path = Kanna; + sourceTree = ""; + }; + 1E7ADC5D1DF4F576006E1815 /* Tests */ = { + isa = PBXGroup; + children = ( + 1E7ADC5E1DF4F576006E1815 /* KannaTests */, + ); + path = Tests; + sourceTree = ""; + }; + 1E7ADC5E1DF4F576006E1815 /* KannaTests */ = { + isa = PBXGroup; + children = ( + 1E7ADC8B1DF55B37006E1815 /* KannaTests.swift */, + 1E7ADC8C1DF55B37006E1815 /* KannaTutorialsTest.swift */, + 1E7ADC9A1DF5907F006E1815 /* Data */, + 1E7ADC8A1DF55B37006E1815 /* Info.plist */, + ); + name = KannaTests; + path = Kanna; + sourceTree = ""; + }; + 1E7ADC631DF4F7BC006E1815 /* Configurations */ = { + isa = PBXGroup; + children = ( + 1E7ADC641DF4F7E1006E1815 /* Base.xcconfig */, + 1E7ADC651DF4F80E006E1815 /* Debug.xcconfig */, + 1E7ADC661DF4F86F006E1815 /* Release.xcconfig */, + 1E7ADC671DF4F885006E1815 /* Kanna.xcconfig */, + 1E7ADC681DF4F8D5006E1815 /* Tests.xcconfig */, + ); + path = Configurations; + sourceTree = ""; + }; + 1E7ADC9A1DF5907F006E1815 /* Data */ = { + isa = PBXGroup; + children = ( + 1E7ADC9B1DF5907F006E1815 /* libraries.xml */, + 1E7ADC9C1DF5907F006E1815 /* sample.html */, + 1E7ADC9D1DF5907F006E1815 /* test_HTML4.html */, + 1E7ADC9E1DF5907F006E1815 /* test_XML_ExcelWorkbook.xml */, + 1E7ADC9F1DF5907F006E1815 /* versions.xml */, + ); + name = Data; + path = Tests/KannaTests/Data; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 1E7ADC301DF4F3FC006E1815 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1E7ADC581DF4F567006E1815 /* Kanna.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 1E7ADC321DF4F3FC006E1815 /* Kanna */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1E7ADC471DF4F3FC006E1815 /* Build configuration list for PBXNativeTarget "Kanna" */; + buildPhases = ( + 1E7ADC2E1DF4F3FC006E1815 /* Sources */, + 1E7ADC2F1DF4F3FC006E1815 /* Frameworks */, + 1E7ADC301DF4F3FC006E1815 /* Headers */, + 1E7ADC311DF4F3FC006E1815 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Kanna; + productName = Kanna; + productReference = 1E7ADC331DF4F3FC006E1815 /* Kanna.framework */; + productType = "com.apple.product-type.framework"; + }; + 1E7ADC3B1DF4F3FC006E1815 /* Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1E7ADC4A1DF4F3FC006E1815 /* Build configuration list for PBXNativeTarget "Tests" */; + buildPhases = ( + 1E7ADC381DF4F3FC006E1815 /* Sources */, + 1E7ADC391DF4F3FC006E1815 /* Frameworks */, + 1E7ADC3A1DF4F3FC006E1815 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1E7ADC3F1DF4F3FC006E1815 /* PBXTargetDependency */, + ); + name = Tests; + productName = KannaTests; + productReference = 1E7ADC3C1DF4F3FC006E1815 /* Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 1E7ADC2A1DF4F3FC006E1815 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0810; + LastUpgradeCheck = 0900; + ORGANIZATIONNAME = "Atsushi Kiwaki"; + TargetAttributes = { + 1E7ADC321DF4F3FC006E1815 = { + CreatedOnToolsVersion = 8.1; + ProvisioningStyle = Automatic; + }; + 1E7ADC3B1DF4F3FC006E1815 = { + CreatedOnToolsVersion = 8.1; + DevelopmentTeam = DP9Q5R8635; + LastSwiftMigration = 0810; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 1E7ADC2D1DF4F3FC006E1815 /* Build configuration list for PBXProject "Kanna" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 1E7ADC291DF4F3FC006E1815; + productRefGroup = 1E7ADC341DF4F3FC006E1815 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1E7ADC321DF4F3FC006E1815 /* Kanna */, + 1E7ADC3B1DF4F3FC006E1815 /* Tests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1E7ADC311DF4F3FC006E1815 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1E7ADC3A1DF4F3FC006E1815 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1E7ADCA21DF5907F006E1815 /* test_HTML4.html in Resources */, + 1E7ADCA11DF5907F006E1815 /* sample.html in Resources */, + 1E7ADCA01DF5907F006E1815 /* libraries.xml in Resources */, + 1E7ADCA41DF5907F006E1815 /* versions.xml in Resources */, + 1E7ADCA31DF5907F006E1815 /* test_XML_ExcelWorkbook.xml in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1E7ADC2E1DF4F3FC006E1815 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1EC805FA1FA2FB2F0067D3DA /* Deprecated.swift in Sources */, + 1E7ADC5C1DF4F567006E1815 /* libxmlParserOption.swift in Sources */, + 1E7ADC5A1DF4F567006E1815 /* libxmlHTMLDocument.swift in Sources */, + 1E7ADC561DF4F567006E1815 /* CSS.swift in Sources */, + 1E7ADC5B1DF4F567006E1815 /* libxmlHTMLNode.swift in Sources */, + 1E7ADC591DF4F567006E1815 /* Kanna.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1E7ADC381DF4F3FC006E1815 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1E7ADC931DF55B37006E1815 /* KannaTests.swift in Sources */, + 1E7ADC941DF55B37006E1815 /* KannaTutorialsTest.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 1E7ADC3F1DF4F3FC006E1815 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 1E7ADC321DF4F3FC006E1815 /* Kanna */; + targetProxy = 1E7ADC3E1DF4F3FC006E1815 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1E7ADC451DF4F3FC006E1815 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1E7ADC651DF4F80E006E1815 /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 1E7ADC461DF4F3FC006E1815 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1E7ADC661DF4F86F006E1815 /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_SUSPICIOUS_MOVES = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 1E7ADC481DF4F3FC006E1815 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1E7ADC671DF4F885006E1815 /* Kanna.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = Sources/Kanna/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.tid.Kanna; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; + }; + name = Debug; + }; + 1E7ADC491DF4F3FC006E1815 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1E7ADC671DF4F885006E1815 /* Kanna.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = Sources/Kanna/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.tid.Kanna; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; + }; + name = Release; + }; + 1E7ADC4B1DF4F3FC006E1815 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1E7ADC681DF4F8D5006E1815 /* Tests.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ENABLE_MODULES = YES; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = DP9Q5R8635; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.tid.KannaTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + }; + name = Debug; + }; + 1E7ADC4C1DF4F3FC006E1815 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1E7ADC681DF4F8D5006E1815 /* Tests.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ENABLE_MODULES = YES; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = DP9Q5R8635; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.tid.KannaTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1E7ADC2D1DF4F3FC006E1815 /* Build configuration list for PBXProject "Kanna" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1E7ADC451DF4F3FC006E1815 /* Debug */, + 1E7ADC461DF4F3FC006E1815 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1E7ADC471DF4F3FC006E1815 /* Build configuration list for PBXNativeTarget "Kanna" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1E7ADC481DF4F3FC006E1815 /* Debug */, + 1E7ADC491DF4F3FC006E1815 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1E7ADC4A1DF4F3FC006E1815 /* Build configuration list for PBXNativeTarget "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1E7ADC4B1DF4F3FC006E1815 /* Debug */, + 1E7ADC4C1DF4F3FC006E1815 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1E7ADC2A1DF4F3FC006E1815 /* Project object */; +} diff --git a/GPXTracker2/GPXTracker2.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/GPXTracker/Carthage/Checkouts/Kanna/Kanna.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 69% rename from GPXTracker2/GPXTracker2.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to GPXTracker/Carthage/Checkouts/Kanna/Kanna.xcodeproj/project.xcworkspace/contents.xcworkspacedata index d49837d..f85a0e5 100644 --- a/GPXTracker2/GPXTracker2.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/GPXTracker/Carthage/Checkouts/Kanna/Kanna.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:Kanna.xcodeproj"> diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Kanna.xcodeproj/xcshareddata/xcschemes/Kanna.xcscheme b/GPXTracker/Carthage/Checkouts/Kanna/Kanna.xcodeproj/xcshareddata/xcschemes/Kanna.xcscheme new file mode 100644 index 0000000..d0163f5 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Kanna.xcodeproj/xcshareddata/xcschemes/Kanna.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GPXTracker/Carthage/Checkouts/Kanna/LICENSE b/GPXTracker/Carthage/Checkouts/Kanna/LICENSE new file mode 100644 index 0000000..30070be --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 - 2015 Atsushi Kiwaki (@_tid_) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Modules/libxml2-kanna.h b/GPXTracker/Carthage/Checkouts/Kanna/Modules/libxml2-kanna.h new file mode 100644 index 0000000..15dae3f --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Modules/libxml2-kanna.h @@ -0,0 +1,3 @@ +#import +#import +#import diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Modules/module.modulemap b/GPXTracker/Carthage/Checkouts/Kanna/Modules/module.modulemap new file mode 100644 index 0000000..b18b454 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Modules/module.modulemap @@ -0,0 +1,6 @@ +module libxmlKanna [system] { + link "xml2" + umbrella header "libxml2-kanna.h" + export * + module * { export * } +} diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Package.swift b/GPXTracker/Carthage/Checkouts/Kanna/Package.swift new file mode 100644 index 0000000..0b2ca28 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Package.swift @@ -0,0 +1,25 @@ +// swift-tools-version:4.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. +import PackageDescription + +let package = Package( + name: "Kanna", + products: [ + .library(name: "Kanna", targets: ["Kanna"]), + ], + dependencies: [ + .package(url: "https://github.com/tid-kijyun/SwiftClibxml2.git", from: "1.0.0") + ], + targets: [ + .target(name: "Kanna", + path: "Sources", + exclude: [ + "Sources/Info.plist", + "Sources/Kanna.h", + "Tests/KannaTests/Data" + ]), + .testTarget(name: "KannaTests", + dependencies: ["Kanna"] + ) + ] +) diff --git a/GPXTracker/Carthage/Checkouts/Kanna/README.md b/GPXTracker/Carthage/Checkouts/Kanna/README.md new file mode 100644 index 0000000..41a3d41 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/README.md @@ -0,0 +1,182 @@ +Kanna(鉋) +================= + +Kanna(鉋) is an XML/HTML parser for cross-platform(macOS, iOS, tvOS, watchOS and Linux!). + +It was inspired by [Nokogiri](https://github.com/sparklemotion/nokogiri)(鋸). + +[![Build Status](https://travis-ci.org/tid-kijyun/Kanna.svg?branch=master)](https://travis-ci.org/tid-kijyun/Kanna) +[![Platform](http://img.shields.io/badge/platform-ios_osx_watchos_tvos_linux-lightgrey.svg?style=flat)](https://developer.apple.com/resources/) +[![Cocoapod](http://img.shields.io/cocoapods/v/Kanna.svg?style=flat)](http://cocoadocs.org/docsets/Kanna/) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![Swift Package Manager](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) +[![Reference Status](https://www.versioneye.com/objective-c/kanna/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/kanna/references) + +:information_source: [Documentation](http://tid-kijyun.github.io/Kanna/) + + +Features: +================= +- [x] XPath 1.0 support for document searching +- [x] CSS3 selector support for document searching +- [x] Support for namespaces +- [x] Comprehensive test suite + +Installation: +================= + +### Swift 4 (beta) +If you want to use Swift 4, please use branch `feature/v4.0.0`. +This is a beta version. There may be API changes. + +### Swift 3.0 + +##### CocoaPods +**:warning: CocoaPods (`1.1.0 or later`) is required.** + +Adding it to your `Podfile`: +```ruby +use_frameworks! +pod 'Kanna', '~> 2.1.0' +``` + +##### Carthage +Adding it to your `Cartfile`: + +```ogdl +github "tid-kijyun/Kanna" ~> 2.1.0 +``` + +1. In the project settings add `$(SDKROOT)/usr/include/libxml2` to the "header search paths" field + +##### Swift Package Manager + +Installing libxml2 to your computer: + +```bash +// macOS +$ brew install libxml2 +$ brew link --force libxml2 + +// Linux(Ubuntu) +$ sudo apt-get install libxml2-dev +``` + +Adding it to your `Package.swift`: + +```swift +import PackageDescription + +let package = Package( + name: "YourProject", + + dependencies: [ + .Package(url: "https://github.com/tid-kijyun/Kanna.git", majorVersion: 2) + ] +) +``` + +```bash +$ swift build +``` + +*Note: When a build error occurs, please try run the following command:* +```bash +$ sudo apt-get install pkg-config +``` + +##### Manual Installation +1. Add these files to your project: + [Kanna.swift](Source/Kanna.swift) + [CSS.swift](Source/CSS.swift) + [libxmlHTMLDocument.swift](Source/libxml/libxmlHTMLDocument.swift) + [libxmlHTMLNode.swift](Source/libxml/libxmlHTMLNode.swift) + [libxmlParserOption.swift](Source/libxml/libxmlParserOption.swift) + [Modules](Modules) +1. In the target settings add `$(SDKROOT)/usr/include/libxml2` to the `Search Paths > Header Search Paths` field +1. In the target settings add `$(SRCROOT)/Modules` to the `Swift Compiler - Search Paths > Import Paths` field + +### Swift 2.x + +Three means of installation are supported: + +##### CocoaPods +**:warning: CocoaPods (`0.39 or later`) is required.** + +Adding it to your `Podfile`: +```ruby +use_frameworks! +pod 'Kanna', '~> 1.1.0' +``` + +##### Carthage +Adding it to your `Cartfile`: + +```ogdl +github "tid-kijyun/Kanna" ~> 1.1.0 +``` + +##### Manual Installation +1. Add these files to your project: + [Kanna.swift](Source/Kanna.swift) + [CSS.swift](Source/CSS.swift) + [libxmlHTMLDocument.swift](Source/libxml/libxmlHTMLDocument.swift) + [libxmlHTMLNode.swift](Source/libxml/libxmlHTMLNode.swift) + [libxmlParserOption.swift](Source/libxml/libxmlParserOption.swift) +1. In the target settings add `$(SDKROOT)/usr/include/libxml2` to the `Search Paths > Header Search Paths` field +1. In the target settings add `-lxml2` to the `Linking > Other Linker Flags` field +1. Import `libxml` headers: + + Copy the those import statements: + + ```objective-c + #import + #import + #import + ``` + + and paste them into your [Modulename]-Bridging-Header.h + +*Note: With manual installation, this library doesn't need to be imported, or namespace-qualified in your code.* + +Synopsis: +================= + +```swift +import Kanna + +let html = "..." + +if let doc = HTML(html: html, encoding: .utf8) { + print(doc.title) + + // Search for nodes by CSS + for link in doc.css("a, link") { + print(link.text) + print(link["href"]) + } + + // Search for nodes by XPath + for link in doc.xpath("//a | //link") { + print(link.text) + print(link["href"]) + } +} +``` + +```swift +let xml = "..." +if let doc = Kanna.XML(xml: xml, encoding: .utf8) { + let namespaces = [ + "o": "urn:schemas-microsoft-com:office:office", + "ss": "urn:schemas-microsoft-com:office:spreadsheet" + ] + if let author = doc.at_xpath("//o:Author", namespaces: namespaces) { + print(author.text) + } +} +``` + +License: +================= +The MIT License. See the LICENSE file for more infomation. diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/CSS.swift b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/CSS.swift new file mode 100755 index 0000000..ed8a284 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/CSS.swift @@ -0,0 +1,353 @@ +/**@file CSS.swift + +Kanna + +Copyright (c) 2015 Atsushi Kiwaki (@_tid_) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +import Foundation + +#if SWIFT_PACKAGE +import SwiftClibxml2 +#else +import libxmlKanna +#endif + +typealias AKRegularExpression = NSRegularExpression +typealias AKTextCheckingResult = NSTextCheckingResult + +public enum CSSError: Error { + case UnsupportSyntax(String) +} + +/** +CSS +*/ +public struct CSS { + /** + CSS3 selector to XPath + + @param selector CSS3 selector + + @return XPath + */ + public static func toXPath(_ selector: String) throws -> String { + var xpath = "//" + var str = selector + var prev = str + + while str.utf16.count > 0 { + var attributes: [String] = [] + var combinator: String = "" + + if let result = matchBlank(str) { + str = String(str[str.index(str.startIndex, offsetBy: result.range.length).. (String) -> AKTextCheckingResult? { + return { str in + let length = str.utf16.count + do { + let regex = try AKRegularExpression(pattern: pattern, options: .caseInsensitive) + if let result = regex.firstMatch(in: str, options: .reportProgress, range: NSRange(location: 0, length: length)) { + return result + } + } catch _ { + + } + return nil + } +} + +private func nth(prefix: String, a: Int, b: Int) -> String { + let sibling = "\(prefix)-sibling::*" + if a == 0 { + return "count(\(sibling)) = \(b-1)" + } else if a > 0 { + if b != 0 { + return "((count(\(sibling)) + 1) >= \(b)) and ((((count(\(sibling)) + 1)-\(b)) mod \(a)) = 0)" + } + return "((count(\(sibling)) + 1) mod \(a)) = 0" + } + let a = abs(a) + return "(count(\(sibling)) + 1) <= \(b)" + ((a != 1) ? " and ((((count(\(sibling)) + 1)-\(b)) mod \(a) = 0)" : "") +} + +// a(n) + b | a(n) - b +private func nth_child(a: Int, b: Int) -> String { + return nth(prefix: "preceding", a: a, b: b) +} + +private func nth_last_child(a: Int, b: Int) -> String { + return nth(prefix: "following", a: a, b: b) +} + +private let matchBlank = firstMatch("^\\s*|\\s$") +private let matchElement = firstMatch("^([a-z0-9\\*_-]+)((\\|)([a-z0-9\\*_-]+))?") +private let matchClassId = firstMatch("^([#.])([a-z0-9\\*_-]+)") +private let matchAttr1 = firstMatch("^\\[([^\\]]*)\\]") +private let matchAttr2 = firstMatch("^\\[\\s*([^~\\|\\^\\$\\*=\\s]+)\\s*([~\\|\\^\\$\\*]?=)\\s*(.*)\\s*\\]") +private let matchAttrN = firstMatch("^:not\\((.*?\\)?)\\)") +private let matchPseudo = firstMatch("^:([\'\"()a-z0-9_+-]+)") +private let matchCombinator = firstMatch("^\\s*([\\s>+~,])\\s*") +private let matchSubNthChild = firstMatch("^(nth-child|nth-last-child)\\(\\s*(odd|even|\\d+)\\s*\\)") +private let matchSubNthChildN = firstMatch("^(nth-child|nth-last-child)\\(\\s*(-?\\d*)n(\\+\\d+)?\\s*\\)") +private let matchSubNthOfType = firstMatch("nth-of-type\\((odd|even|\\d+)\\)") +private let matchSubContains = firstMatch("contains\\([\"\'](.*?)[\"\']\\)") +private let matchSubBlank = firstMatch("^\\s*$") + +private func substringWithRangeAtIndex(_ result: AKTextCheckingResult, str: String, at: Int) -> String { + if result.numberOfRanges > at { + let range = result.range(at: at) + if range.length > 0 { + let startIndex = str.index(str.startIndex, offsetBy: range.location) + let endIndex = str.index(startIndex, offsetBy: range.length) + return String(str[startIndex.. String { + if let result = matchElement(str) { + let (text, text2) = (substringWithRangeAtIndex(result, str: str, at: 1), + substringWithRangeAtIndex(result, str: str, at: 4)) + + if skip { + str = String(str[str.index(str.startIndex, offsetBy: result.range.length).. String? { + if let result = matchClassId(str) { + let (attr, text) = (substringWithRangeAtIndex(result, str: str, at: 1), + substringWithRangeAtIndex(result, str: str, at: 2)) + if skip { + str = String(str[str.index(str.startIndex, offsetBy: result.range.length).. String? { + if let result = matchAttr2(str) { + let (attr, expr, text) = (substringWithRangeAtIndex(result, str: str, at: 1), + substringWithRangeAtIndex(result, str: str, at: 2), + substringWithRangeAtIndex(result, str: str, at: 3).replacingOccurrences(of: "[\'\"](.*)[\'\"]", with: "$1", options: .regularExpression, range: nil)) + + if skip { + str = String(str[str.index(str.startIndex, offsetBy: result.range.length)..= 1) and (((position()-1) mod 2) = 0)" + } else if arg1 == "even" { + return "(position() mod 2) = 0" + } else { + return "position() = \(arg1)" + } + } else if let sub = matchSubContains(one) { + let text = substringWithRangeAtIndex(sub, str: one, at: 1) + return "contains(., '\(text)')" + } else { + return nil + } + } + } + return nil +} + +private func getAttrNot(_ str: inout String, skip: Bool = true) -> String? { + if let result = matchAttrN(str) { + var one = substringWithRangeAtIndex(result, str: str, at: 1) + if skip { + str = String(str[str.index(str.startIndex, offsetBy: result.range.length).. String? { + if let result = matchCombinator(str) { + let one = substringWithRangeAtIndex(result, str: str, at: 1) + if skip { + str = String(str[str.index(str.startIndex, offsetBy: result.range.length)..": + return "/" + case "+": + return "/following-sibling::*[1]/self::" + case "~": + return "/following-sibling::" + default: + if let _ = matchSubBlank(one) { + return "//" + } else { + return " | //" + } + } + } + return nil +} diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Deprecated.swift b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Deprecated.swift new file mode 100644 index 0000000..43143b0 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Deprecated.swift @@ -0,0 +1,65 @@ +// +// Deprecated.swift +// Kanna +// +// Created by Atsushi Kiwaki on 2017/10/27. +// Copyright © 2017 Atsushi Kiwaki. All rights reserved. +// + +import Foundation + +//------------------------------------------------------------- +// XML +//------------------------------------------------------------- +@available(*, unavailable, message: "Use XML(xml: String, url: String?, encoding: String.Encoding, option: ParseOption). The type of the second argument has been changed to String.Encoding from UInt.") +public func XML(xml: String, url: String?, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} + +@available(*, unavailable, message: "Use XML(xml: String, encoding: String.Encoding, option: ParseOption). The type of the second argument has been changed to String.Encoding from UInt.") +public func XML(xml: String, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} + +@available(*, unavailable, message: "Use XML(xml: Data, url: String?, encoding: String.Encoding, option: ParseOption). The type of the first argument has been changed to Data and the type of the second argument has been changed to String.Encoding from UInt.") +public func XML(xml: NSData, url: String?, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} + +@available(*, unavailable, message: "Use XML(xml: Data, encoding: String.Encoding, option: ParseOption). The type of the first argument has been changed to Data and the type of the second argument has been changed to String.Encoding from UInt.") +public func XML(xml: NSData, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} + +@available(*, unavailable, message: "Use XML(url: URL, encoding: String.Encoding, option: ParseOption). The type of the second argument has been changed to String.Encoding from UInt.") +public func XML(url: URL, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} + +//------------------------------------------------------------- +// HTML +//------------------------------------------------------------- +@available(*, unavailable, message: "Use HTML(html: String, url: String?, encoding: String.Encoding, option: ParseOption). The type of the second argument has been changed to String.Encoding from UInt.") +public func HTML(html: String, url: String?, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} + +@available(*, unavailable, message: "Use HTML(html: String, encoding: String.Encoding, option: ParseOption). The type of the second argument has been changed to String.Encoding from UInt.") +public func HTML(html: String, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} + +@available(*, unavailable, message: "Use HTML(html: Data, url: String?, encoding: String.Encoding, option: ParseOption). The type of the first argument has been changed to Data and the type of the second argument has been changed to String.Encoding from UInt.") +public func HTML(html: NSData, url: String?, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} + +@available(*, unavailable, message: "Use HTML(html: Data, encoding: String.Encoding, option: ParseOption). The type of the first argument has been changed to Data and the type of the second argument has been changed to String.Encoding from UInt.") +public func HTML(html: NSData, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} + +@available(*, unavailable, message: "Use HTML(url: URL, encoding: String.Encoding, option: ParseOption). The type of the second argument has been changed to String.Encoding from UInt.") +public func HTML(url: URL, encoding: UInt, option: ParseOption = kDefaultXmlParseOption) -> XMLDocument? { + return nil +} diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Info.plist b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Info.plist new file mode 100644 index 0000000..9741941 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 4.0.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright + Copyright © 2015 Atsushi Kiwaki. All rights reserved. + NSPrincipalClass + + + diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Kanna.h b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Kanna.h new file mode 100644 index 0000000..9ef687b --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Kanna.h @@ -0,0 +1,33 @@ +/**@file Kanna.h + +Kanna + +Copyright (c) 2015 Atsushi Kiwaki (@_tid_) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#import + +//! Project version number for Kanna. +FOUNDATION_EXPORT double KannaVersionNumber; + +//! Project version string for Kanna. +FOUNDATION_EXPORT const unsigned char KannaVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Kanna.swift b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Kanna.swift new file mode 100755 index 0000000..035c683 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/Kanna.swift @@ -0,0 +1,401 @@ +/**@file Kanna.swift + +Kanna + +Copyright (c) 2015 Atsushi Kiwaki (@_tid_) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +import Foundation + +#if SWIFT_PACKAGE +import SwiftClibxml2 +#else +import libxmlKanna +#endif + +/* +ParseOption +*/ +public enum ParseOption { + // libxml2 + case xmlParseUseLibxml(Libxml2XMLParserOptions) + case htmlParseUseLibxml(Libxml2HTMLParserOptions) +} + +public let kDefaultXmlParseOption = ParseOption.xmlParseUseLibxml([.RECOVER, .NOERROR, .NOWARNING]) +public let kDefaultHtmlParseOption = ParseOption.htmlParseUseLibxml([.RECOVER, .NOERROR, .NOWARNING]) + +public enum ParseError: Error { + case Empty + case EncodingMismatch + case InvalidOptions +} + +/** +Parse XML + +@param xml an XML string +@param url the base URL to use for the document +@param encoding the document encoding +@param options a ParserOption +*/ +public func XML(xml: String, url: String?, encoding: String.Encoding, option: ParseOption = kDefaultXmlParseOption) throws -> XMLDocument { + switch option { + case .xmlParseUseLibxml(let opt): + return try libxmlXMLDocument(xml: xml, url: url, encoding: encoding, option: opt.rawValue) + default: + throw ParseError.InvalidOptions + } +} + +public func XML(xml: String, encoding: String.Encoding, option: ParseOption = kDefaultXmlParseOption) throws -> XMLDocument { + return try XML(xml: xml, url: nil, encoding: encoding, option: option) +} + +// NSData +public func XML(xml: Data, url: String?, encoding: String.Encoding, option: ParseOption = kDefaultXmlParseOption) throws -> XMLDocument { + guard let xmlStr = String(data: xml, encoding: encoding) else { + throw ParseError.EncodingMismatch + } + return try XML(xml: xmlStr, url: url, encoding: encoding, option: option) +} + +public func XML(xml: Data, encoding: String.Encoding, option: ParseOption = kDefaultXmlParseOption) throws -> XMLDocument { + return try XML(xml: xml, url: nil, encoding: encoding, option: option) +} + +// NSURL +public func XML(url: URL, encoding: String.Encoding, option: ParseOption = kDefaultXmlParseOption) throws -> XMLDocument { + guard let data = try? Data(contentsOf: url) else { + throw ParseError.EncodingMismatch + } + return try XML(xml: data, url: url.absoluteString, encoding: encoding, option: option) +} + +/** +Parse HTML + +@param html an HTML string +@param url the base URL to use for the document +@param encoding the document encoding +@param options a ParserOption +*/ +public func HTML(html: String, url: String?, encoding: String.Encoding, option: ParseOption = kDefaultHtmlParseOption) throws -> HTMLDocument { + switch option { + case .htmlParseUseLibxml(let opt): + return try libxmlHTMLDocument(html: html, url: url, encoding: encoding, option: opt.rawValue) + default: + throw ParseError.InvalidOptions + } +} + +public func HTML(html: String, encoding: String.Encoding, option: ParseOption = kDefaultHtmlParseOption) throws -> HTMLDocument { + return try HTML(html: html, url: nil, encoding: encoding, option: option) +} + +// NSData +public func HTML(html: Data, url: String?, encoding: String.Encoding, option: ParseOption = kDefaultHtmlParseOption) throws -> HTMLDocument { + guard let htmlStr = String(data: html, encoding: encoding) else { + throw ParseError.EncodingMismatch + } + return try HTML(html: htmlStr, url: url, encoding: encoding, option: option) +} + +public func HTML(html: Data, encoding: String.Encoding, option: ParseOption = kDefaultHtmlParseOption) throws -> HTMLDocument { + return try HTML(html: html, url: nil, encoding: encoding, option: option) +} + +// NSURL +public func HTML(url: URL, encoding: String.Encoding, option: ParseOption = kDefaultHtmlParseOption) throws -> HTMLDocument { + guard let data = try? Data(contentsOf: url) else { + throw ParseError.EncodingMismatch + } + return try HTML(html: data, url: url.absoluteString, encoding: encoding, option: option) +} + +/** +Searchable +*/ +public protocol Searchable { + /** + Search for node from current node by XPath. + + @param xpath + */ + func xpath(_ xpath: String, namespaces: [String:String]?) -> XPathObject + func xpath(_ xpath: String) -> XPathObject + func at_xpath(_ xpath: String, namespaces: [String:String]?) -> XMLElement? + func at_xpath(_ xpath: String) -> XMLElement? + + /** + Search for node from current node by CSS selector. + + @param selector a CSS selector + */ + func css(_ selector: String, namespaces: [String:String]?) -> XPathObject + func css(_ selector: String) -> XPathObject + func at_css(_ selector: String, namespaces: [String:String]?) -> XMLElement? + func at_css(_ selector: String) -> XMLElement? +} + +/** +SearchableNode +*/ +public protocol SearchableNode: Searchable { + var text: String? { get } + var toHTML: String? { get } + var toXML: String? { get } + var innerHTML: String? { get } + var className: String? { get } + var tagName: String? { get set } + var content: String? { get set } +} + +/** +XMLElement +*/ +public protocol XMLElement: SearchableNode { + var parent: XMLElement? { get set } + subscript(attr: String) -> String? { get set } + + func addPrevSibling(_ node: XMLElement) + func addNextSibling(_ node: XMLElement) + func removeChild(_ node: XMLElement) + var nextSibling: XMLElement? { get } + var previousSibling: XMLElement? { get } +} + +/** +XMLDocument +*/ +public protocol XMLDocument: class, SearchableNode { +} + +/** +HTMLDocument +*/ +public protocol HTMLDocument: XMLDocument { + var title: String? { get } + var head: XMLElement? { get } + var body: XMLElement? { get } +} + +/** +XMLNodeSet +*/ +public final class XMLNodeSet { + fileprivate var nodes: [XMLElement] = [] + + public var toHTML: String? { + let html = nodes.reduce("") { + if let text = $1.toHTML { + return $0 + text + } + return $0 + } + return html.isEmpty == false ? html : nil + } + + public var innerHTML: String? { + let html = nodes.reduce("") { + if let text = $1.innerHTML { + return $0 + text + } + return $0 + } + return html.isEmpty == false ? html : nil + } + + public var text: String? { + let html = nodes.reduce("") { + if let text = $1.text { + return $0 + text + } + return $0 + } + return html + } + + public subscript(index: Int) -> XMLElement { + return nodes[index] + } + + public var count: Int { + return nodes.count + } + + internal init() { + } + + internal init(nodes: [XMLElement]) { + self.nodes = nodes + } + + public func at(_ index: Int) -> XMLElement? { + return count > index ? nodes[index] : nil + } + + public var first: XMLElement? { + return at(0) + } + + public var last: XMLElement? { + return at(count-1) + } +} + +extension XMLNodeSet: Sequence { + public typealias Iterator = AnyIterator + public func makeIterator() -> Iterator { + var index = 0 + return AnyIterator { + if index < self.nodes.count { + let n = self.nodes[index] + index += 1 + return n + } + return nil + } + } +} + +/** +XPathObject +*/ + +public enum XPathObject { + case none + case NodeSet(nodeset: XMLNodeSet) + case Bool(bool: Swift.Bool) + case Number(num: Double) + case String(text: Swift.String) +} + +extension XPathObject { + internal init(document: XMLDocument?, docPtr: xmlDocPtr, object: xmlXPathObject) { + switch object.type { + case XPATH_NODESET: + let nodeSet = object.nodesetval + if nodeSet == nil || nodeSet?.pointee.nodeNr == 0 || nodeSet?.pointee.nodeTab == nil { + self = .none + return + } + + var nodes : [XMLElement] = [] + let size = Int((nodeSet?.pointee.nodeNr)!) + for i in 0 ..< size { + let node: xmlNodePtr = nodeSet!.pointee.nodeTab[i]! + let htmlNode = libxmlHTMLNode(document: document, docPtr: docPtr, node: node) + nodes.append(htmlNode) + } + self = .NodeSet(nodeset: XMLNodeSet(nodes: nodes)) + return + case XPATH_BOOLEAN: + self = .Bool(bool: object.boolval != 0) + return + case XPATH_NUMBER: + self = .Number(num: object.floatval) + case XPATH_STRING: + guard let str = UnsafeRawPointer(object.stringval)?.assumingMemoryBound(to: CChar.self) else { + self = .String(text: "") + return + } + self = .String(text: Swift.String(cString: str)) + return + default: + self = .none + return + } + } + + public subscript(index: Int) -> XMLElement { + return nodeSet![index] + } + + public var first: XMLElement? { + return nodeSet?.first + } + + public var count: Int { + guard let nodeset = nodeSet else { + return 0 + } + return nodeset.count + } + + var nodeSet: XMLNodeSet? { + if case let .NodeSet(nodeset) = self { + return nodeset + } + return nil + } + + var bool: Swift.Bool? { + if case let .Bool(value) = self { + return value + } + return nil + } + + var number: Double? { + if case let .Number(value) = self { + return value + } + return nil + } + + var string: Swift.String? { + if case let .String(value) = self { + return value + } + return nil + } + + var nodeSetValue: XMLNodeSet { + return nodeSet ?? XMLNodeSet() + } + + var boolValue: Swift.Bool { + return bool ?? false + } + + var numberValue: Double { + return number ?? 0.0 + } + + var stringValue: Swift.String { + return string ?? "" + } +} + +extension XPathObject: Sequence { + public typealias Iterator = AnyIterator + public func makeIterator() -> Iterator { + var index = 0 + return AnyIterator { + if index < self.nodeSetValue.count { + let obj = self.nodeSetValue[index] + index += 1 + return obj + } + return nil + } + } +} diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/libxmlHTMLDocument.swift b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/libxmlHTMLDocument.swift new file mode 100755 index 0000000..a5c7691 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/libxmlHTMLDocument.swift @@ -0,0 +1,346 @@ +/**@file libxmlHTMLDocument.swift + +Kanna + +Copyright (c) 2015 Atsushi Kiwaki (@_tid_) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +import Foundation +import CoreFoundation + +#if SWIFT_PACKAGE +import SwiftClibxml2 +#else +import libxmlKanna +#endif + +extension String.Encoding { + var IANACharSetName: String? { + #if os(Linux) + switch self { + case .ascii: + return "us-ascii" + case .iso2022JP: + return "iso-2022-jp" + case .isoLatin1: + return "iso-8859-1" + case .isoLatin2: + return "iso-8859-2" + case .japaneseEUC: + return "euc-jp" + case .macOSRoman: + return "macintosh" + case .nextstep: + return "x-nextstep" + case .nonLossyASCII: + return nil + case .shiftJIS: + return "cp932" + case .symbol: + return "x-mac-symbol" + case .unicode: + return "utf-16" + case .utf16: + return "utf-16" + case .utf16BigEndian: + return "utf-16be" + case .utf32: + return "utf-32" + case .utf32BigEndian: + return "utf-32be" + case .utf32LittleEndian: + return "utf-32le" + case .utf8: + return "utf-8" + case .windowsCP1250: + return "windows-1250" + case .windowsCP1251: + return "windows-1251" + case .windowsCP1252: + return "windows-1252" + case .windowsCP1253: + return "windows-1253" + case .windowsCP1254: + return "windows-1254" + default: + return nil + } + #else + let cfenc = CFStringConvertNSStringEncodingToEncoding(self.rawValue) + guard let cfencstr = CFStringConvertEncodingToIANACharSetName(cfenc) else { + return nil + } + return String(describing: cfencstr) + #endif + } +} + +/* +libxmlHTMLDocument +*/ +internal final class libxmlHTMLDocument: HTMLDocument { + fileprivate var docPtr: htmlDocPtr? = nil + fileprivate var rootNode: XMLElement? + fileprivate var html: String + fileprivate var url: String? + fileprivate var encoding: String.Encoding + + var text: String? { + return rootNode?.text + } + + var toHTML: String? { + let buf = xmlBufferCreate() + defer { + xmlBufferFree(buf) + } + + let outputBuf = xmlOutputBufferCreateBuffer(buf, nil) + htmlDocContentDumpOutput(outputBuf, docPtr, nil) + let html = String(cString: UnsafePointer(xmlOutputBufferGetContent(outputBuf))) + return html + } + + var toXML: String? { + var buf: UnsafeMutablePointer? = nil + let size: UnsafeMutablePointer? = nil + defer { + xmlFree(buf) + } + + xmlDocDumpMemory(docPtr, &buf, size) + let html = String(cString: UnsafePointer(buf!)) + return html + } + + var innerHTML: String? { + return rootNode?.innerHTML + } + + var className: String? { + return nil + } + + var tagName: String? { + get { + return nil + } + + set { + + } + } + + var content: String? { + get { + return text + } + + set { + rootNode?.content = newValue + } + } + + init(html: String, url: String?, encoding: String.Encoding, option: UInt) throws { + self.html = html + self.url = url + self.encoding = encoding + + guard html.lengthOfBytes(using: encoding) > 0 else { + throw ParseError.Empty + } + + guard let charsetName = encoding.IANACharSetName, + let cur = html.cString(using: encoding) else { + throw ParseError.EncodingMismatch + } + + let url : String = "" + docPtr = htmlReadDoc(UnsafeRawPointer(cur).assumingMemoryBound(to: xmlChar.self), url, charsetName, CInt(option)) + + guard let docPtr = docPtr else { + throw ParseError.EncodingMismatch + } + + rootNode = libxmlHTMLNode(document: self, docPtr: docPtr) + } + + deinit { + xmlFreeDoc(self.docPtr) + } + + var title: String? { return at_xpath("//title")?.text } + var head: XMLElement? { return at_xpath("//head") } + var body: XMLElement? { return at_xpath("//body") } + + func xpath(_ xpath: String, namespaces: [String:String]?) -> XPathObject { + return rootNode?.xpath(xpath, namespaces: namespaces) ?? XPathObject.none + } + + func xpath(_ xpath: String) -> XPathObject { + return self.xpath(xpath, namespaces: nil) + } + + func at_xpath(_ xpath: String, namespaces: [String:String]?) -> XMLElement? { + return rootNode?.at_xpath(xpath, namespaces: namespaces) + } + + func at_xpath(_ xpath: String) -> XMLElement? { + return self.at_xpath(xpath, namespaces: nil) + } + + func css(_ selector: String, namespaces: [String:String]?) -> XPathObject { + return rootNode?.css(selector, namespaces: namespaces) ?? XPathObject.none + } + + func css(_ selector: String) -> XPathObject { + return self.css(selector, namespaces: nil) + } + + func at_css(_ selector: String, namespaces: [String:String]?) -> XMLElement? { + return rootNode?.at_css(selector, namespaces: namespaces) + } + + func at_css(_ selector: String) -> XMLElement? { + return self.at_css(selector, namespaces: nil) + } +} + +/* +libxmlXMLDocument +*/ +internal final class libxmlXMLDocument: XMLDocument { + fileprivate var docPtr: xmlDocPtr? = nil + fileprivate var rootNode: XMLElement? + fileprivate var xml: String + fileprivate var url: String? + fileprivate var encoding: String.Encoding + + var text: String? { + return rootNode?.text + } + + var toHTML: String? { + let buf = xmlBufferCreate() + defer { + xmlBufferFree(buf) + } + + let outputBuf = xmlOutputBufferCreateBuffer(buf, nil) + htmlDocContentDumpOutput(outputBuf, docPtr, nil) + let html = String(cString: UnsafePointer(xmlOutputBufferGetContent(outputBuf))) + return html + } + + var toXML: String? { + var buf: UnsafeMutablePointer? = nil + let size: UnsafeMutablePointer? = nil + defer { + xmlFree(buf) + } + + xmlDocDumpMemory(docPtr, &buf, size) + let html = String(cString: UnsafePointer(buf!)) + return html + } + + var innerHTML: String? { + return rootNode?.innerHTML + } + + var className: String? { + return nil + } + + var tagName: String? { + get { + return nil + } + + set { + + } + } + + var content: String? { + get { + return text + } + + set { + rootNode?.content = newValue + } + } + + init(xml: String, url: String?, encoding: String.Encoding, option: UInt) throws { + self.xml = xml + self.url = url + self.encoding = encoding + + if xml.isEmpty { + throw ParseError.Empty + } + + + guard let charsetName = encoding.IANACharSetName, + let cur = xml.cString(using: encoding) else { + throw ParseError.EncodingMismatch + } + let url : String = "" + docPtr = xmlReadDoc(UnsafeRawPointer(cur).assumingMemoryBound(to: xmlChar.self), url, charsetName, CInt(option)) + rootNode = libxmlHTMLNode(document: self, docPtr: docPtr!) + } + + deinit { + xmlFreeDoc(self.docPtr) + } + + func xpath(_ xpath: String, namespaces: [String:String]?) -> XPathObject { + return rootNode?.xpath(xpath, namespaces: namespaces) ?? XPathObject.none + } + + func xpath(_ xpath: String) -> XPathObject { + return self.xpath(xpath, namespaces: nil) + } + + func at_xpath(_ xpath: String, namespaces: [String:String]?) -> XMLElement? { + return rootNode?.at_xpath(xpath, namespaces: namespaces) + } + + func at_xpath(_ xpath: String) -> XMLElement? { + return self.at_xpath(xpath, namespaces: nil) + } + + func css(_ selector: String, namespaces: [String:String]?) -> XPathObject { + return rootNode?.css(selector, namespaces: namespaces) ?? XPathObject.none + } + + func css(_ selector: String) -> XPathObject { + return self.css(selector, namespaces: nil) + } + + func at_css(_ selector: String, namespaces: [String:String]?) -> XMLElement? { + return rootNode?.at_css(selector, namespaces: namespaces) + } + + func at_css(_ selector: String) -> XMLElement? { + return self.at_css(selector, namespaces: nil) + } +} diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/libxmlHTMLNode.swift b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/libxmlHTMLNode.swift new file mode 100755 index 0000000..9fc334d --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/libxmlHTMLNode.swift @@ -0,0 +1,299 @@ +/**@file libxmlHTMLNode.swift + +Kanna + +Copyright (c) 2015 Atsushi Kiwaki (@_tid_) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +import Foundation + +#if SWIFT_PACKAGE +import SwiftClibxml2 +#else +import libxmlKanna +#endif + +/** +libxmlHTMLNode +*/ +internal final class libxmlHTMLNode: XMLElement { + var text: String? { + if nodePtr != nil { + return libxmlGetNodeContent(nodePtr!) + } + return nil + } + + var toHTML: String? { + let buf = xmlBufferCreate() + htmlNodeDump(buf, docPtr, nodePtr) + let html = String(cString: UnsafePointer((buf?.pointee.content)!)) + xmlBufferFree(buf) + return html + } + + var toXML: String? { + let buf = xmlBufferCreate() + xmlNodeDump(buf, docPtr, nodePtr, 0, 0) + let html = String(cString: UnsafePointer((buf?.pointee.content)!)) + xmlBufferFree(buf) + return html + } + + var innerHTML: String? { + if let html = self.toHTML { + let inner = html.replacingOccurrences(of: "]*>$", with: "", options: .regularExpression, range: nil) + .replacingOccurrences(of: "^<[^>]*>", with: "", options: .regularExpression, range: nil) + return inner + } + return nil + } + + var className: String? { + return self["class"] + } + + var tagName: String? { + get { + if nodePtr != nil { + return String(cString: UnsafePointer((nodePtr?.pointee.name)!)) + } + return nil + } + + set { + if let newValue = newValue { + xmlNodeSetName(nodePtr, newValue) + } + } + } + + var content: String? { + get { + return text + } + + set { + if let newValue = newValue { + let v = escape(newValue) + xmlNodeSetContent(nodePtr, v) + } + } + } + + var parent: XMLElement? { + get { + return libxmlHTMLNode(document: doc, docPtr: docPtr!, node: (nodePtr?.pointee.parent)!) + } + + set { + if let node = newValue as? libxmlHTMLNode { + node.addChild(self) + } + } + } + + var nextSibling: XMLElement? { + let val = xmlNextElementSibling(self.nodePtr) + return self.node(from: val) + } + + var previousSibling: XMLElement? { + let val = xmlPreviousElementSibling(self.nodePtr) + return self.node(from: val) + } + + fileprivate weak var weakDocument: XMLDocument? + fileprivate var document: XMLDocument? + fileprivate var docPtr: htmlDocPtr? = nil + fileprivate var nodePtr: xmlNodePtr? = nil + fileprivate var isRoot: Bool = false + fileprivate var doc: XMLDocument? { + return weakDocument ?? document + } + + subscript(attributeName: String) -> String? + { + get { + var attr = nodePtr?.pointee.properties + while attr != nil { + let mem = attr?.pointee + if let tagName = String(validatingUTF8: UnsafeRawPointer((mem?.name)!).assumingMemoryBound(to: CChar.self)) { + if attributeName == tagName { + if let children = mem?.children { + return libxmlGetNodeContent(children) + } else { + return "" + } + } + } + attr = attr?.pointee.next + } + return nil + } + + set(newValue) { + if let newValue = newValue { + xmlSetProp(nodePtr, attributeName, newValue) + } else { + xmlUnsetProp(nodePtr, attributeName) + } + } + } + + init(document: XMLDocument?, docPtr: xmlDocPtr) { + self.weakDocument = document + self.docPtr = docPtr + self.nodePtr = xmlDocGetRootElement(docPtr) + self.isRoot = true + } + + init(document: XMLDocument?, docPtr: xmlDocPtr, node: xmlNodePtr) { + self.document = document + self.docPtr = docPtr + self.nodePtr = node + } + + // MARK: Searchable + func xpath(_ xpath: String, namespaces: [String:String]?) -> XPathObject { + let ctxt = xmlXPathNewContext(docPtr) + if ctxt == nil { + return XPathObject.none + } + ctxt?.pointee.node = nodePtr + + if let nsDictionary = namespaces { + for (ns, name) in nsDictionary { + xmlXPathRegisterNs(ctxt, ns, name) + } + } + + let result = xmlXPathEvalExpression(xpath, ctxt) + defer { + xmlXPathFreeObject(result) + } + xmlXPathFreeContext(ctxt) + if result == nil { + return XPathObject.none + } + + return XPathObject(document: doc, docPtr: docPtr!, object: result!.pointee) + } + + func xpath(_ xpath: String) -> XPathObject { + return self.xpath(xpath, namespaces: nil) + } + + func at_xpath(_ xpath: String, namespaces: [String:String]?) -> XMLElement? { + return self.xpath(xpath, namespaces: namespaces).nodeSetValue.first + } + + func at_xpath(_ xpath: String) -> XMLElement? { + return self.at_xpath(xpath, namespaces: nil) + } + + func css(_ selector: String, namespaces: [String:String]?) -> XPathObject { + if let xpath = try? CSS.toXPath(selector) { + if isRoot { + return self.xpath(xpath, namespaces: namespaces) + } else { + return self.xpath("." + xpath, namespaces: namespaces) + } + } + return XPathObject.none + } + + func css(_ selector: String) -> XPathObject { + return self.css(selector, namespaces: nil) + } + + func at_css(_ selector: String, namespaces: [String:String]?) -> XMLElement? { + return self.css(selector, namespaces: namespaces).nodeSetValue.first + } + + func at_css(_ selector: String) -> XMLElement? { + return self.css(selector, namespaces: nil).nodeSetValue.first + } + + func addPrevSibling(_ node: XMLElement) { + guard let node = node as? libxmlHTMLNode else { + return + } + xmlAddPrevSibling(nodePtr, node.nodePtr) + } + + func addNextSibling(_ node: XMLElement) { + guard let node = node as? libxmlHTMLNode else { + return + } + xmlAddNextSibling(nodePtr, node.nodePtr) + } + + func addChild(_ node: XMLElement) { + guard let node = node as? libxmlHTMLNode else { + return + } + xmlUnlinkNode(node.nodePtr) + xmlAddChild(nodePtr, node.nodePtr) + } + + func removeChild(_ node: XMLElement) { + + guard let node = node as? libxmlHTMLNode else { + return + } + xmlUnlinkNode(node.nodePtr) + xmlFree(node.nodePtr) + } + + private func node(from ptr: xmlNodePtr?) -> XMLElement? { + guard let doc = self.doc, let docPtr = self.docPtr, let nodePtr = ptr else { + return nil + } + + let element = libxmlHTMLNode(document: doc, docPtr: docPtr, node: nodePtr) + return element + } +} + +private func libxmlGetNodeContent(_ nodePtr: xmlNodePtr) -> String? { + let content = xmlNodeGetContent(nodePtr) + if let result = String(validatingUTF8: UnsafeRawPointer(content!).assumingMemoryBound(to: CChar.self)) { + content?.deallocate(capacity: 1) + return result + } + content?.deallocate(capacity: 1) + return nil +} + +let entities = [ + "&": "&", + "<" : "<", + ">" : ">", +] + +private func escape(_ str: String) -> String { + var newStr = str + for (unesc, esc) in entities { + newStr = newStr.replacingOccurrences(of: unesc, with: esc, options: .regularExpression, range: nil) + } + return newStr +} + diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/libxmlParserOption.swift b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/libxmlParserOption.swift new file mode 100755 index 0000000..bc6fca2 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Sources/Kanna/libxmlParserOption.swift @@ -0,0 +1,98 @@ +/**@file libxmlParserOption.swift + +Kanna + +Copyright (c) 2015 Atsushi Kiwaki (@_tid_) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +import Foundation + +#if SWIFT_PACKAGE +import SwiftClibxml2 +#else +import libxmlKanna +#endif + +/* +Libxml2HTMLParserOptions +*/ +public struct Libxml2HTMLParserOptions : OptionSet { + public typealias RawValue = UInt + private var value: UInt = 0 + init(_ value: UInt) { self.value = value } + private init(_ opt: htmlParserOption) { self.value = UInt(opt.rawValue) } + public init(rawValue value: UInt) { self.value = value } + public init(nilLiteral: ()) { self.value = 0 } + public static var allZeros: Libxml2HTMLParserOptions { return .init(0) } + static func fromMask(raw: UInt) -> Libxml2HTMLParserOptions { return .init(raw) } + public var rawValue: UInt { return self.value } + + public static let STRICT = Libxml2HTMLParserOptions(0) + public static let RECOVER = Libxml2HTMLParserOptions(HTML_PARSE_RECOVER) + public static let NODEFDTD = Libxml2HTMLParserOptions(HTML_PARSE_NODEFDTD) + public static let NOERROR = Libxml2HTMLParserOptions(HTML_PARSE_NOERROR) + public static let NOWARNING = Libxml2HTMLParserOptions(HTML_PARSE_NOWARNING) + public static let PEDANTIC = Libxml2HTMLParserOptions(HTML_PARSE_PEDANTIC) + public static let NOBLANKS = Libxml2HTMLParserOptions(HTML_PARSE_NOBLANKS) + public static let NONET = Libxml2HTMLParserOptions(HTML_PARSE_NONET) + public static let NOIMPLIED = Libxml2HTMLParserOptions(HTML_PARSE_NOIMPLIED) + public static let COMPACT = Libxml2HTMLParserOptions(HTML_PARSE_COMPACT) + public static let IGNORE_ENC = Libxml2HTMLParserOptions(HTML_PARSE_IGNORE_ENC) +} + +/* +Libxml2XMLParserOptions +*/ +public struct Libxml2XMLParserOptions: OptionSet { + public typealias RawValue = UInt + private var value: UInt = 0 + init(_ value: UInt) { self.value = value } + private init(_ opt: xmlParserOption) { self.value = UInt(opt.rawValue) } + public init(rawValue value: UInt) { self.value = value } + public init(nilLiteral: ()) { self.value = 0 } + public static var allZeros: Libxml2XMLParserOptions { return .init(0) } + static func fromMask(raw: UInt) -> Libxml2XMLParserOptions { return .init(raw) } + public var rawValue: UInt { return self.value } + + public static let STRICT = Libxml2XMLParserOptions(0) + public static let RECOVER = Libxml2XMLParserOptions(XML_PARSE_RECOVER) + public static let NOENT = Libxml2XMLParserOptions(XML_PARSE_NOENT) + public static let DTDLOAD = Libxml2XMLParserOptions(XML_PARSE_DTDLOAD) + public static let DTDATTR = Libxml2XMLParserOptions(XML_PARSE_DTDATTR) + public static let DTDVALID = Libxml2XMLParserOptions(XML_PARSE_DTDVALID) + public static let NOERROR = Libxml2XMLParserOptions(XML_PARSE_NOERROR) + public static let NOWARNING = Libxml2XMLParserOptions(XML_PARSE_NOWARNING) + public static let PEDANTIC = Libxml2XMLParserOptions(XML_PARSE_PEDANTIC) + public static let NOBLANKS = Libxml2XMLParserOptions(XML_PARSE_NOBLANKS) + public static let SAX1 = Libxml2XMLParserOptions(XML_PARSE_SAX1) + public static let XINCLUDE = Libxml2XMLParserOptions(XML_PARSE_XINCLUDE) + public static let NONET = Libxml2XMLParserOptions(XML_PARSE_NONET) + public static let NODICT = Libxml2XMLParserOptions(XML_PARSE_NODICT) + public static let NSCLEAN = Libxml2XMLParserOptions(XML_PARSE_NSCLEAN) + public static let NOCDATA = Libxml2XMLParserOptions(XML_PARSE_NOCDATA) + public static let NOXINCNODE = Libxml2XMLParserOptions(XML_PARSE_NOXINCNODE) + public static let COMPACT = Libxml2XMLParserOptions(XML_PARSE_COMPACT) + public static let OLD10 = Libxml2XMLParserOptions(XML_PARSE_OLD10) + public static let NOBASEFIX = Libxml2XMLParserOptions(XML_PARSE_NOBASEFIX) + public static let HUGE = Libxml2XMLParserOptions(XML_PARSE_HUGE) + public static let OLDSAX = Libxml2XMLParserOptions(XML_PARSE_OLDSAX) + public static let IGNORE_ENC = Libxml2XMLParserOptions(XML_PARSE_IGNORE_ENC) + public static let BIG_LINES = Libxml2XMLParserOptions(XML_PARSE_BIG_LINES) +} diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/libraries.xml b/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/libraries.xml new file mode 100644 index 0000000..4cf6bc0 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/libraries.xml @@ -0,0 +1,9 @@ + + + Kanna + Alamofire + + + Hoge + + diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/sample.html b/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/sample.html new file mode 100644 index 0000000..ebab088 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/sample.html @@ -0,0 +1,4 @@ + +

Three's Company

+
A love triangle.
+ diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/test_HTML4.html b/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/test_HTML4.html new file mode 100644 index 0000000..dcaefde --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/test_HTML4.html @@ -0,0 +1,73 @@ + + + + + + + + + + Test HTML4 + + +

Header1

+

Hello world! +

Hello p

+

Header2

+ +

header2

+ + + + + + + + + + + +
a0b0c0
a1b1c1
a2b2c2
a3b3c3
a4b4c4
a5b5c5
a6b6c6
a7b7c7
a8b8c8
a9b9c9
+

header2

+ + + + + + + + + + + +
NameStars
All star223
Kanna123
Swift-HTML-Parser100
+ +
+ abc
def
hijklmnopq +
+
asd
+ + diff --git a/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/test_XML_ExcelWorkbook.xml b/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/test_XML_ExcelWorkbook.xml new file mode 100644 index 0000000..e1ac689 --- /dev/null +++ b/GPXTracker/Carthage/Checkouts/Kanna/Tests/KannaTests/Data/test_XML_ExcelWorkbook.xml @@ -0,0 +1,118 @@ + + + + _tid_ + _tid_ + 2015-07-26T06:00:00Z + 2015-07-26T06:05:00Z + 14.0 + + + + + + 15260 + 25600 + 0 + 0 + False + False + + + + + + + + a1 + b1 + c1 + d1 + + + a2 + b2 + c2 + d2 + + + a3 + b3 + c3 + d3 + + + a4 + b4 + c4 + d4 + + + a5 + b5 + c5 + d5 + + + a6 + b6 + c6 + d6 + + + a7 + b7 + c7 + d7 + + + a8 + b8 + c8 + d8 + + + a9 + b9 + c9 + d9 + + + a10 + b10 + c10 + d10 + +
+ + +
+