├── .gitmodules ├── Icon.png ├── framework ├── xmls │ ├── libxml-bridging-header.header │ ├── nameChanges.xml │ └── datatypes.xml ├── objects │ ├── XSDexplicitGroup.h │ ├── XSDAnnotation.h │ ├── XSDenumeration.h │ ├── XSSchemaNode.h │ ├── XSDattribute.h │ ├── XSDenumeration.m │ ├── XSDcomplexType.h │ ├── XSDelement.h │ ├── XSDAnnotation.m │ ├── XSSimpleType.h │ ├── XSSchemaNode.m │ ├── XSDexplicitGroup.m │ └── XSDattribute.m ├── vendor │ ├── MGTemplateEngine │ │ ├── DeepMutableCopy.h │ │ ├── NSArray_DeepMutableCopy.h │ │ ├── MGTemplateStandardFilters.h │ │ ├── NSDictionary_DeepMutableCopy.h │ │ ├── MGTemplateFilter.h │ │ ├── MGTemplateStandardMarkers.h │ │ ├── NSArray_DeepMutableCopy.m │ │ ├── ICUTemplateMatcher.h │ │ ├── NSDictionary_DeepMutableCopy.m │ │ ├── MGTemplateMarker.h │ │ └── MGTemplateStandardFilters.m │ ├── DDSimpleFormatter │ │ ├── NSString+PrefixSuffixFrom.h │ │ ├── DDSimpleFormatter.h │ │ ├── NSString+PrefixSuffixFrom.m │ │ └── DDSimpleFormatter.m │ ├── DDRunTask │ │ └── DDRunTask.h │ └── DDXMLValidator │ │ └── DDXMLValidator.h ├── XSType.h ├── XSDConverterCore.h ├── Info.plist ├── XSDschema+XPaths.h ├── XMLUtils.h ├── XSDschema.h └── XSDschema+XPaths.m ├── app ├── AppIcon.icns ├── main.m ├── XSDConverter.entitlements ├── Info.plist └── AppDelegate.h ├── README-files ├── 1.png ├── 2.png └── 3.png ├── tests ├── XSDTestCaseObjC.h ├── XSDTestCaseSwift.h ├── vendor │ ├── NSObject+DDDump │ │ └── NSObject+DDDump.h │ └── DDReflectionHelpersCOMPILED │ │ └── DDReflectionHelpers.template ├── xmls │ ├── SampleLanguageData.xml │ ├── address_UnitInfo.xsd │ ├── MyPantry.xml │ ├── configFeatures.xml │ ├── address_StreetInfo.xsd │ ├── address.xml │ ├── SampleLanguageData.xsd │ ├── weblinks_test.xsd │ ├── weblinks.xml │ ├── MyPantry.xsd │ ├── weblinks_groups.xsd │ ├── weblinks.xsd │ ├── address.xsd │ ├── configFeatures.xsd │ └── configFeaturesNamespaced.xsd ├── Info.plist ├── XSDTestCase.h ├── XSDTestCaseObjC.m ├── MyPantryTestsSwift.m ├── XSDTestCaseSwift.m ├── MyPantryTestsObjC.m ├── WeblinksTests.m ├── SampleLanguageDataTestsSwift.m └── SampleLanguageDataTestsObjC.m ├── demos ├── MyPantry-demo │ ├── MyPantry.xcodeproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── MyPantry-osx │ │ ├── AppDelegate.h │ │ ├── main.m │ │ ├── generated │ │ │ └── !!!use as output folder.xml │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── AppDelegate.m │ ├── MyPantry.xml │ ├── MyPantry-ios │ │ ├── ViewController.swift │ │ ├── generated │ │ │ └── !!!use as output folder.xml │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── AppDelegate.swift │ │ └── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.xib │ └── MyPantry.xsd ├── SampleLanguageData │ ├── SampleLanguageData.xcodeproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── SampleLanguageData-osx │ │ ├── AppDelegate.h │ │ ├── main.m │ │ ├── generated │ │ │ └── !!!use as output folder.xml │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── AppDelegate.m │ ├── SampleLanguageData.xml │ ├── SampleLanguageData-ios │ │ ├── ViewController.swift │ │ ├── generated │ │ │ └── !!!use as output folder.xml │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── AppDelegate.swift │ │ └── Base.lproj │ │ │ └── Main.storyboard │ └── SampleLanguageData.xsd ├── weblinks-demo │ ├── weblinks.xcodeproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── weblinks-osx │ │ ├── AppDelegate.h │ │ ├── main.m │ │ ├── generated │ │ │ └── !!!use as output folder.xml │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── AppDelegate.m │ ├── weblinks-ios │ │ ├── ViewController.swift │ │ ├── generated │ │ │ └── !!!use as output folder.xml │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── AppDelegate.swift │ │ └── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.xib │ ├── weblinks.xml │ └── weblinks.xsd ├── address-demo │ ├── addressTest.xcodeproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── UnitInfo.xsd │ ├── StreetInfo.xsd │ ├── addressTest_ios │ │ ├── ViewController.swift │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Generated │ │ │ └── !!!use as output folder.xml │ │ ├── Info.plist │ │ ├── AppDelegate.swift │ │ └── Base.lproj │ │ │ └── Main.storyboard │ ├── Address.xml │ ├── addressTest_osx │ │ ├── Generated │ │ │ └── !!!use as output folder.xml │ │ └── main.m │ └── Address.xsd ├── simpletypes-demo │ ├── simpletypes.xcodeproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── simpletypes_ios │ │ ├── ViewController.swift │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Generated │ │ │ └── !!!use as output folder.xml │ │ ├── Info.plist │ │ ├── AppDelegate.swift │ │ └── Base.lproj │ │ │ └── Main.storyboard │ └── simpletypes_osx │ │ ├── Generated │ │ └── !!!use as output folder.xml │ │ └── main.m └── configFeatures-demo │ ├── configFeatures.xcodeproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── configFeatures.xml │ ├── configFeatures_ios │ ├── ViewController.swift │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Generated │ │ └── !!!use as output folder.xml │ ├── Info.plist │ ├── AppDelegate.swift │ └── Base.lproj │ │ └── Main.storyboard │ ├── configFeatures_osx │ ├── Generated │ │ └── !!!use as output folder.xml │ └── main.m │ └── configFeatures.xsd ├── XSDConverter.xcodeproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── XSDConverter.xcscmblueprint └── .gitignore /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/xsd2cocoa/HEAD/Icon.png -------------------------------------------------------------------------------- /framework/xmls/libxml-bridging-header.header: -------------------------------------------------------------------------------- 1 | #import 2 | -------------------------------------------------------------------------------- /app/AppIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/xsd2cocoa/HEAD/app/AppIcon.icns -------------------------------------------------------------------------------- /README-files/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/xsd2cocoa/HEAD/README-files/1.png -------------------------------------------------------------------------------- /README-files/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/xsd2cocoa/HEAD/README-files/2.png -------------------------------------------------------------------------------- /README-files/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Daij-Djan/xsd2cocoa/HEAD/README-files/3.png -------------------------------------------------------------------------------- /tests/XSDTestCaseObjC.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSDTest.h 3 | // XSDConverter 4 | // 5 | // Created by Dominik Pich on 24/12/14. 6 | // 7 | // 8 | 9 | #import "XSDTestCase.h" 10 | 11 | @interface XSDTestCaseObjC : XSDTestCase 12 | @end 13 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /XSDConverter.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/main.m: -------------------------------------------------------------------------------- 1 | 2 | // main.m 3 | // xsd2cocoa 4 | // 5 | // Created by Dominik Pich on 11/12/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) 12 | { 13 | return NSApplicationMain(argc, argv); 14 | } 15 | -------------------------------------------------------------------------------- /demos/address-demo/addressTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demos/simpletypes-demo/simpletypes.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /framework/objects/XSDexplicitGroup.h: -------------------------------------------------------------------------------- 1 | #import "XSSchemaNode.h" 2 | 3 | @interface XSDexplicitGroup : XSSchemaNode 4 | 5 | @property (readonly, nonatomic) NSString* name; 6 | @property (readonly, nonatomic) NSString* ref; 7 | @property (readonly, nonatomic) NSArray* elements; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/DeepMutableCopy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DeepMutableCopy.h 3 | * 4 | * Created by Matt Gemmell on 02/05/2008. 5 | * Copyright 2008 Instinctive Code. All rights reserved. 6 | * 7 | */ 8 | 9 | #import "NSArray_DeepMutableCopy.h" 10 | #import "NSDictionary_DeepMutableCopy.h" 11 | -------------------------------------------------------------------------------- /framework/xmls/nameChanges.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/XSDTestCaseSwift.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSDTest.h 3 | // XSDConverter 4 | // 5 | // Created by Dominik Pich on 24/12/14. 6 | // 7 | // 8 | 9 | #import "XSDTestCase.h" 10 | 11 | @interface XSDTestCaseSwift : XSDTestCase 12 | - (NSNumber*)reflect:(id)obj numberForKey:(NSString*)propertyName; 13 | @end 14 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-osx/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // weblinks-osx 4 | // 5 | // Created by Dominik Pich on 05/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | @end 13 | 14 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-osx/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // weblinks-osx 4 | // 5 | // Created by Dominik Pich on 05/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | @end 13 | 14 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-osx/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // weblinks-osx 4 | // 5 | // Created by Dominik Pich on 05/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-osx/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // weblinks-osx 4 | // 5 | // Created by Dominik Pich on 05/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-osx/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // weblinks-osx 4 | // 5 | // Created by Dominik Pich on 05/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | @end 13 | 14 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-osx/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // weblinks-osx 4 | // 5 | // Created by Dominik Pich on 05/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/NSArray_DeepMutableCopy.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray_DeepMutableCopy.h 3 | // 4 | // Created by Matt Gemmell on 02/05/2008. 5 | // Copyright 2008 Instinctive Code. All rights reserved. 6 | // 7 | #import 8 | 9 | @interface NSArray (DeepMutableCopy) 10 | 11 | - (NSMutableArray *)deepMutableCopy; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /app/XSDConverter.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-write 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/MGTemplateStandardFilters.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGTemplateStandardFilters.h 3 | // 4 | // Created by Matt Gemmell on 13/05/2008. 5 | // Copyright 2008 Instinctive Code. All rights reserved. 6 | // 7 | 8 | #import "MGTemplateFilter.h" 9 | 10 | 11 | @interface MGTemplateStandardFilters : NSObject { 12 | 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/NSDictionary_DeepMutableCopy.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary_DeepMutableCopy.h 3 | // 4 | // Created by Matt Gemmell on 02/05/2008. 5 | // Copyright 2008 Instinctive Code. All rights reserved. 6 | // 7 | #import 8 | 9 | @interface NSDictionary (DeepMutableCopy) 10 | 11 | - (NSMutableDictionary *)deepMutableCopy; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /framework/vendor/DDSimpleFormatter/NSString+PrefixSuffixFrom.h: -------------------------------------------------------------------------------- 1 | // 2 | // String+PrefixSuffixFrom.swift 3 | // simpleFormatter 4 | // 5 | // Created by Dominik Pich on 09/07/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | #import 9 | 10 | @interface NSString (PrefixSuffixFrom) 11 | - (BOOL)hasPrefixFrom:(NSArray*)prefixes; 12 | - (BOOL)hasSuffixFrom:(NSArray*)suffixes; 13 | @end -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/MGTemplateFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MGTemplateFilter.h 3 | * 4 | * Created by Matt Gemmell on 12/05/2008. 5 | * Copyright 2008 Instinctive Code. All rights reserved. 6 | * 7 | */ 8 | #import 9 | 10 | @protocol MGTemplateFilter 11 | 12 | - (NSArray *)filters; 13 | - (id)filterInvoked:(NSString *)filter withArguments:(NSArray *)args onValue:(NSObject *)value; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /framework/objects/XSDAnnotation.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSDAnnotation.h 3 | // XSDConverter 4 | // 5 | // Created by Dominik Pich on 26/12/14. 6 | // 7 | // 8 | 9 | #import "XSSchemaNode.h" 10 | #import "XMLUtils.h" 11 | 12 | @interface XSDAnnotation : XSSchemaNode 13 | 14 | @property(nonatomic, readonly) NSString *identifier; 15 | @property(nonatomic, readonly) NSString *appInfo; 16 | @property(nonatomic, readonly) NSString *documentation; 17 | 18 | - (NSString*)comment; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /tests/vendor/NSObject+DDDump/NSObject+DDDump.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+DDDump.h 3 | // OMMiniXcode 4 | // 5 | // Created by Dominik Pich on 9/17/12. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (DDDump) 12 | 13 | @property(readonly) NSString *dump; 14 | @property(readonly) NSDictionary *reflection; 15 | 16 | + (NSString *)dumpOfClass:(Class)cls; 17 | + (NSDictionary *)reflectionOfClass:(Class)cls; 18 | + (NSArray *)classDumps; //TODO add filter criteria 19 | 20 | @end -------------------------------------------------------------------------------- /tests/xmls/SampleLanguageData.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | Apple 9 | fruit 10 | $0.50 11 | 12 | 13 | 14 | 15 | Chocolate 16 | sweetFatOil 17 | $0.50 18 | 19 | 20 | -------------------------------------------------------------------------------- /framework/vendor/DDSimpleFormatter/DDSimpleFormatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleFormatter.swift 3 | // simpleFormatter 4 | // 5 | // Created by Dominik Pich on 10/07/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DDSimpleFormatter: NSObject 12 | 13 | + (instancetype)sharedInstance; 14 | 15 | - (NSString*)formatString:(NSString*)string; 16 | 17 | - (BOOL)formatFile:(NSString *)file error:(NSError *__autoreleasing *)error; 18 | - (NSArray *)formatFiles:(NSArray *)files error:(NSError *__autoreleasing *)error; 19 | 20 | @end -------------------------------------------------------------------------------- /framework/objects/XSDenumeration.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSDenumeration.h 3 | // XSDConverter 4 | // 5 | // Created by Alex Smith on 3/25/15. 6 | // 7 | // 8 | 9 | #import "XSSchemaNode.h" 10 | 11 | @interface XSDenumeration : XSSchemaNode 12 | 13 | /* This is for the values of the enumeration */ 14 | @property (readonly, nonatomic) NSString* value; 15 | /* This is used for the baseType */ 16 | @property (readonly, nonatomic) NSString* type; 17 | 18 | /* This is used for storing the code that is in our template for the base type */ 19 | @property (readonly, nonatomic) NSString* readCodeForAttribute; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /framework/objects/XSSchemaNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // XmlAccess.h 3 | // xsd2cocoa 4 | // 5 | // Created by Stefan Winter on 5/22/11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class XSDschema; 12 | 13 | @interface XSSchemaNode : NSObject 14 | 15 | @property (readonly, nonatomic) NSXMLElement* node; 16 | @property (readonly, weak, nonatomic) XSDschema* schema; 17 | 18 | - (id) initWithNode:(NSXMLElement*)node schema:(XSDschema*)schema; 19 | 20 | - (BOOL)hasAnnotations; 21 | - (NSArray*)annotations; 22 | - (NSString*)comment; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /tests/xmls/address_UnitInfo.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | UnitInfo.xsd 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/MGTemplateStandardMarkers.h: -------------------------------------------------------------------------------- 1 | // 2 | // MGTemplateStandardMarkers.h 3 | // 4 | // Created by Matt Gemmell on 13/05/2008. 5 | // Copyright 2008 Instinctive Code. All rights reserved. 6 | // 7 | 8 | #import "MGTemplateEngine.h" 9 | #import "MGTemplateMarker.h" 10 | 11 | @interface MGTemplateStandardMarkers : NSObject 12 | 13 | - (BOOL)currentBlock:(NSDictionary *)blockInfo matchesTopOfStack:(NSMutableArray *)stack; 14 | - (BOOL)argIsNumeric:(NSString *)arg integerValue:(NSInteger *)val checkVariables:(BOOL)checkVars; 15 | - (BOOL)argIsTrue:(NSString *)arg; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /demos/address-demo/UnitInfo.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | UnitInfo.xsd 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/xmls/MyPantry.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | Apple 9 | fruit 10 | 11 | $0.50 12 | 13 | 14 | 15 | 16 | Chocolate 17 | sweetFatOil 18 | $0.50 19 | 20 | 21 | -------------------------------------------------------------------------------- /framework/objects/XSDattribute.h: -------------------------------------------------------------------------------- 1 | #import "XSSchemaNode.h" 2 | 3 | @interface XSDattribute : XSSchemaNode 4 | 5 | @property (readonly, nonatomic) NSString* name; 6 | @property (readonly, nonatomic) NSString* simpleType; 7 | @property (readonly, nonatomic) NSString* type; 8 | @property (readonly, nonatomic) id use; 9 | @property (readonly, nonatomic) NSString* defaultValue; 10 | @property (readonly, nonatomic) NSString* fixed; 11 | @property (readonly, nonatomic) NSString* form; 12 | 13 | @property (readonly, nonatomic) NSString* readCodeForAttribute; 14 | 15 | - (NSString*) variableName; //name in generated code 16 | - (BOOL) hasEnumeration; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /framework/XSType.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSType.h 3 | // xsd2cocoa 4 | // 5 | // Created by Stefan Winter on 15.08.11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class XSDattribute; 12 | @class XSDelement; 13 | 14 | @protocol XSType 15 | 16 | - (NSString*) name; 17 | - (NSString*) baseType; 18 | - (NSArray*) attributes; 19 | 20 | //parsing 21 | 22 | - (NSString*) arrayType; 23 | - (NSString*) targetClassName; 24 | - (NSString*) targetClassFileName; 25 | 26 | - (NSString*) readCodeForAttribute: (XSDattribute*) attribute; 27 | - (NSString*) readCodeForElement: (XSDelement*) element; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /framework/XSDConverterCore.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSDConverterCore.h 3 | // XSDConverterCore 4 | // 5 | // Created by Dominik Pich on 22/12/14. 6 | // 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for XSDConverterCore. 12 | FOUNDATION_EXPORT double XSDConverterCoreVersionNumber; 13 | 14 | //! Project version string for XSDConverterCore. 15 | FOUNDATION_EXPORT const unsigned char XSDConverterCoreVersionString[]; 16 | 17 | // public headers 18 | #import "XMLUtils.h" 19 | #import "XSDschema.h" 20 | #import "XSType.h" 21 | #import "XSDattribute.h" 22 | #import "XSDcomplexType.h" 23 | #import "XSDelement.h" 24 | #import "XSDexplicitGroup.h" 25 | #import "XSSchemaNode.h" 26 | #import "XSSimpleType.h" 27 | #import "XSDannotation.h" -------------------------------------------------------------------------------- /tests/xmls/configFeatures.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | User 14 | 1 15 | 16 | -------------------------------------------------------------------------------- /framework/vendor/DDRunTask/DDRunTask.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDRunTask.c 3 | // cocoa-interpreter 4 | // 5 | // Created by Dominik Pich on 7/15/12. 6 | // Copyright (c) 2012 info.pich. All rights reserved. 7 | // 8 | #import 9 | 10 | //the ARGUMENTS can be: 11 | // - NSString objects 12 | // - Anything that responds to the method 'path' (e.g. urls) 13 | // - anything else that translates to string ;) 14 | // - NSArray objects that contain args 15 | NSString *DDRunTask(NSString *command, ...); 16 | 17 | //if you really care about the working dir AND/or environment variables AND/or the exit status. 18 | //The arguments work the same as with runTask 19 | int DDRunTaskExt(NSString *cwd, NSDictionary *env, NSString **output, NSString *command, ...); -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | User 14 | level1 15 | 16 | -------------------------------------------------------------------------------- /demos/address-demo/StreetInfo.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | StreetInfo.xsd 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/xmls/address_StreetInfo.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | StreetInfo.xsd 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-ios/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | @IBOutlet weak var textView: UITextView! 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | let url = NSBundle.mainBundle().URLForResource("weblinks", withExtension: "xml") 18 | if(url != nil) { 19 | let addr = WLFG.FGFromURL(url!) 20 | if(addr != nil) { 21 | textView.text = addr!.dictionary.description 22 | } 23 | } 24 | } 25 | 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /framework/vendor/DDSimpleFormatter/NSString+PrefixSuffixFrom.m: -------------------------------------------------------------------------------- 1 | // 2 | // String+PrefixSuffixFrom.swift 3 | // simpleFormatter 4 | // 5 | // Created by Dominik Pich on 09/07/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | #import "NSString+PrefixSuffixFrom.h" 9 | 10 | @implementation NSString (PrefixSuffixFrom) 11 | 12 | - (BOOL)hasPrefixFrom:(NSArray*)prefixes { 13 | for(id prefix in prefixes) { 14 | if([self hasPrefix:prefix]) { 15 | return true; 16 | } 17 | } 18 | return false; 19 | } 20 | 21 | - (BOOL)hasSuffixFrom:(NSArray*)suffixes { 22 | for(id suffix in suffixes) { 23 | if([self hasSuffix:suffix]) { 24 | return true; 25 | } 26 | } 27 | return false; 28 | } 29 | 30 | @end -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-ios/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | @IBOutlet weak var textView: UITextView! 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | let url = NSBundle.mainBundle().URLForResource("MyPantry", withExtension: "xml") 18 | if(url != nil) { 19 | let addr = PPantryType.PantryTypeFromURL(url!) 20 | if(addr != nil) { 21 | textView.text = addr!.dictionary.description 22 | } 23 | } 24 | } 25 | 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /demos/address-demo/addressTest_ios/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | @IBOutlet weak var textView: UITextView! 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | let url = NSBundle.mainBundle().URLForResource("Address", withExtension: "xml") 18 | if(url != nil) { 19 | let addr = MYCOMPANYAddress.AddressFromURL(url!) 20 | if(addr != nil) { 21 | textView.text = addr!.dictionary.description 22 | } 23 | } 24 | } 25 | 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures_ios/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | @IBOutlet weak var textView: UITextView! 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | let url = NSBundle.mainBundle().URLForResource("Address", withExtension: "xml") 18 | if(url != nil) { 19 | let addr = MYCOMPANYAddress.AddressFromURL(url!) 20 | if(addr != nil) { 21 | textView.text = addr!.dictionary.description 22 | } 23 | } 24 | } 25 | 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /demos/simpletypes-demo/simpletypes_ios/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | @IBOutlet weak var textView: UITextView! 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | let url = NSBundle.mainBundle().URLForResource("simpleTypes", withExtension: "xml") 18 | if(url != nil) { 19 | let addr = STSimpleTypesType.SimpleTypesTypeFromURL(url!) 20 | if(addr != nil) { 21 | textView.text = addr!.dictionary.description 22 | } 23 | } 24 | } 25 | 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-ios/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | @IBOutlet weak var textView: UITextView! 13 | 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | 17 | let url = NSBundle.mainBundle().URLForResource("SampleLanguageData", withExtension: "xml") 18 | if(url != nil) { 19 | let addr = LangDefType.LangDefTypeFromURL(url!) 20 | if(addr != nil) { 21 | textView.text = addr!.dictionary.description 22 | } 23 | } 24 | } 25 | 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /demos/address-demo/addressTest_ios/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /demos/simpletypes-demo/simpletypes_ios/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures_ios/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | -------------------------------------------------------------------------------- /tests/xmls/address.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | adasdLine1 5 | tempLine2 6 | true 7 | megacity 8 | lalacountry 9 | leleleoffice 10 | lelelestate 11 | 12 | SouthBySouthWest 13 | homeStreet 14 | 10b 15 | stringforDirect 16 | 17 | sname 18 | 19 | 0123123123 20 | typeT 21 | 22 | 123-va-123 23 | -------------------------------------------------------------------------------- /demos/address-demo/Address.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | adasdLine1 5 | tempLine2 6 | true 7 | megacity 8 | lalacountry 9 | leleleoffice 10 | lelelestate 11 | 12 | SouthBySouthWest 13 | homeStreet 14 | 10b 15 | stringforDirect 16 | 17 | sname 18 | 19 | 0123123123 20 | typeT 21 | 22 | 123-va-123 23 | -------------------------------------------------------------------------------- /framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.5 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /framework/vendor/DDXMLValidator/DDXMLValidator.h: -------------------------------------------------------------------------------- 1 | // 2 | // DDXMLValidator.h 3 | // 4 | // Created by Dominik Pich on 11.09.13. 5 | // based mainly on code by Todd Ditchendorfer 6 | // 7 | 8 | #import 9 | 10 | static NSString *const KeySchemaType = @"schemaType"; 11 | 12 | typedef enum { 13 | DDXMLValidatorSchemaTypeDTD = 0, 14 | DDXMLValidatorSchemaTypeXSD, 15 | DDXMLValidatorSchemaTypeRNG 16 | } DDXMLValidatorSchemaType; 17 | 18 | @interface DDXMLValidator : NSObject 19 | 20 | + (instancetype)sharedInstace; 21 | 22 | - (BOOL)validateXMLData:(NSData *)data 23 | withSchema:(DDXMLValidatorSchemaType)schema 24 | schemaFile:(NSURL *)schemaURL 25 | error:(NSError **)error; 26 | 27 | - (BOOL)validateXMLFile:(NSURL *)xmlURL 28 | withSchema:(DDXMLValidatorSchemaType)schema 29 | schemaFile:(NSURL *)schemaURL 30 | error:(NSError **)error; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /framework/objects/XSDenumeration.m: -------------------------------------------------------------------------------- 1 | // 2 | // XSDenumeration.m 3 | // XSDConverter 4 | // 5 | // Created by Alex Smith on 3/25/15. 6 | // 7 | // 8 | 9 | #import "XSDenumeration.h" 10 | #import "XSDschema.h" 11 | #import "XSType.h" 12 | #import "XMLUtils.h" 13 | 14 | @interface XSDenumeration () 15 | 16 | @property (strong, nonatomic) NSString* value; 17 | @property (strong, nonatomic) NSString* type; 18 | 19 | @end 20 | 21 | @implementation XSDenumeration 22 | 23 | - (id) init 24 | { 25 | if(self = [super init]) { 26 | self.value = nil; 27 | } 28 | return self; 29 | } 30 | 31 | 32 | - (id) initWithNode: (NSXMLElement*) node schema: (XSDschema*) schema{ 33 | if(self = [super initWithNode:node schema:schema]) { 34 | self.value = [XMLUtils node:node stringAttribute:@"value"]; 35 | } 36 | return self; 37 | } 38 | 39 | 40 | - (NSString*) objcType { 41 | return [[self.schema typeForName: self.type] targetClassName]; 42 | } 43 | @end 44 | -------------------------------------------------------------------------------- /app/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | AppIcon 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.5 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-ios/generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-osx/generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-ios/generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-osx/generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/address-demo/addressTest_ios/Generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/address-demo/addressTest_osx/Generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks.xsd: -------------------------------------------------------------------------------- 1 | 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 | -------------------------------------------------------------------------------- /framework/XSDschema+XPaths.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSDschema+XPaths.h 3 | // XSDConverter 4 | // 5 | // Created by Dominik Pich on 29/06/15. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface XSDschema (XPaths) 12 | 13 | - (NSString*)XPathForSchemaSimpleTypes; 14 | 15 | - (NSString*)XPathForSchemaComplexTypes; 16 | 17 | - (NSString*)XPathForSchemaGlobalElements; 18 | 19 | - (NSString*)XPathForSchemaIncludes; 20 | 21 | - (NSString*)XPathForSchemaImports; 22 | 23 | - (NSString*)XPathForTemplateAdditionalFiles; 24 | 25 | - (NSString*)XPathForTemplateFormatStyles; 26 | 27 | - (NSString*)XPathForTemplateFirstEnumeration; 28 | 29 | - (NSString*)XPathForTemplateReads; 30 | 31 | - (NSString*)XPathForTemplateFirstImplementationHeaders; 32 | 33 | - (NSString*)XPathForTemplateFirstImplementationClasses; 34 | 35 | - (NSString*)XPathForTemplateFirstReaderHeaders; 36 | 37 | - (NSString*)XPathForTemplateFirstReaderClasses; 38 | 39 | - (NSString*)XPathForTemplateFirstComplexType; 40 | 41 | - (NSString*)XPathForTemplateSimpleTypes; 42 | 43 | - (NSString*)XPathForTemplateFirstElementRead; 44 | 45 | + (NSString*)XPathForNamechanges; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /demos/simpletypes-demo/simpletypes_ios/Generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/simpletypes-demo/simpletypes_osx/Generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-ios/generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-osx/generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures_ios/Generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures_osx/Generated/!!!use as output folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | 12 | 13 | 14 | BBC World News 15 | Evening Standard on London 16 | 17 | 18 | British Airways 19 | Barcelona City Guide 20 | Last Minute Travel Deals 21 | 22 | -------------------------------------------------------------------------------- /framework/objects/XSDcomplexType.h: -------------------------------------------------------------------------------- 1 | /* 2 | XSDcomplexType.h 3 | The interface definition of properties and methods for the XSDcomplexType object. 4 | Generated by SudzC.com 5 | */ 6 | 7 | 8 | #import "XSSchemaNode.h" 9 | #import "XSType.h" 10 | 11 | @class XSDexplicitGroup; 12 | 13 | @interface XSDcomplexType : XSSchemaNode < XSType > 14 | 15 | @property (readonly, nonatomic) NSString* name; 16 | @property (readonly, nonatomic) NSNumber* mixed; 17 | @property (readonly, nonatomic) NSString* baseType; 18 | @property (readonly, nonatomic) XSDexplicitGroup* sequenceOrChoice; 19 | @property (readonly, nonatomic) NSArray* attributes; 20 | @property (readonly, nonatomic) NSArray* globalElements; 21 | 22 | - (NSDictionary*) substitutionDict; 23 | - (NSArray*) elements; 24 | - (NSArray*) simpleTypesInUse; 25 | - (NSArray*) complexTypesInUse; 26 | - (NSArray*) enumTypesInUse; 27 | - (NSString*) readSimpleContent; 28 | - (BOOL) hasSimpleBaseClass; 29 | - (BOOL) hasComplexBaseClass; 30 | - (BOOL) hasComplexChildren; 31 | 32 | - (id) baseClass; 33 | 34 | - (NSString*)combinedReadPrefixCode; //for templating this merges the prefix codes of all simpleTypes 35 | @end 36 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/NSArray_DeepMutableCopy.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray_DeepMutableCopy.m 3 | // 4 | // Created by Matt Gemmell on 02/05/2008. 5 | // Copyright 2008 Instinctive Code. All rights reserved. 6 | // 7 | 8 | #import "NSArray_DeepMutableCopy.h" 9 | 10 | 11 | @implementation NSArray (DeepMutableCopy) 12 | 13 | - (NSMutableArray *)deepMutableCopy 14 | { 15 | NSMutableArray *newArray; 16 | NSUInteger index, count; 17 | 18 | count = [self count]; 19 | newArray = [[NSMutableArray alloc] initWithCapacity:count]; 20 | for (index = 0; index < count; index++) { 21 | id anObject; 22 | 23 | anObject = [self objectAtIndex:index]; 24 | if ([anObject respondsToSelector:@selector(deepMutableCopy)]) { 25 | anObject = [anObject deepMutableCopy]; 26 | [newArray addObject:anObject]; 27 | } else if ([anObject respondsToSelector:@selector(mutableCopyWithZone:)]) { 28 | anObject = [anObject mutableCopyWithZone:nil]; 29 | [newArray addObject:anObject]; 30 | } else { 31 | [newArray addObject:anObject]; 32 | } 33 | } 34 | 35 | return newArray; 36 | } 37 | 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /framework/XMLUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Soap.h 3 | Provides method for serializing and deserializing values to and from the web service. 4 | Authors: Jason Kichline, andCulture - Harrisburg, Pennsylvania USA 5 | Karl Schulenburg, UMAI Development - Shoreditch, London UK 6 | */ 7 | 8 | #import 9 | 10 | @interface XMLUtils : NSObject { 11 | 12 | } 13 | 14 | // Gets the node from another node by local name / name 15 | + (NSXMLNode*) getNode: (NSXMLNode*) node withName: (NSString*) localName; 16 | 17 | // gets the root node's name of a given document 18 | + (NSString*)rootNodeNameFromURL:(NSURL*)url; 19 | 20 | //additional helpers 21 | 22 | + (NSNumber*) node: (NSXMLElement*) node boolAttribute: (NSString*) attribute; 23 | + (NSString*) node: (NSXMLElement*) node stringAttribute: (NSString*) attribute; 24 | + (NSNumber*) node: (NSXMLElement*) node intAttribute: (NSString*) attribute; 25 | + (NSXMLElement*) node: (NSXMLElement*) element childWithName: (NSString*) name; 26 | 27 | + (NSArray*) node: (NSXMLElement*) element childrenWithName: (NSString*) name; 28 | + (NSArray*) node: (NSXMLElement*) element descendantsWithName: (NSString*) name; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /tests/xmls/SampleLanguageData.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SampleLanguageData.xsd defines a format for translations ( from linguist tool ) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | this type defines a collection of translation items 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | a translation entry (key and value) 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-osx/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 | } -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-osx/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 | } -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SampleLanguageData.xsd defines a format for translations ( from linguist tool ) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | this type defines a collection of translation items 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | a translation entry (key and value) 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-osx/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 | } -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-osx/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 Dominik Pich. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-osx/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 Dominik Pich. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/xmls/weblinks_test.xsd: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | weblinks_test.xsd extends a format for saving links defined by weblinks.xsd by adding support for descriptions of groups (mainly to test import) 9 | 10 | 11 | 12 | 13 | 14 | 15 | this type defines an annotation 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | this attribute is required and stores an user-defined identifier for this note 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-osx/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 Dominik Pich. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /framework/objects/XSDelement.h: -------------------------------------------------------------------------------- 1 | /* 2 | XSDelement.h 3 | The interface definition of properties and methods for the XSDelement object. 4 | Generated by SudzC.com 5 | */ 6 | 7 | 8 | #import "XSSchemaNode.h" 9 | 10 | @class XSDcomplexType; 11 | @protocol XSType; 12 | 13 | @interface XSDelement : XSSchemaNode 14 | 15 | @property (readonly, nonatomic) id localType; 16 | @property (readonly, nonatomic) NSString* name; 17 | @property (readonly, nonatomic) NSString* type; 18 | @property (readonly, nonatomic) NSString* substitutionGroup; 19 | @property (readonly, nonatomic) NSString* defaultValue; 20 | @property (readonly, nonatomic) NSString* fixed; 21 | @property (readonly, nonatomic) NSString* nillable; 22 | @property (readonly, nonatomic) NSString* abstractValue; 23 | @property (readonly, nonatomic) NSString* final; 24 | @property (readonly, nonatomic) NSString* block; 25 | @property (readonly, nonatomic) NSString* form; 26 | @property (readonly, nonatomic) NSNumber* minOccurs; 27 | @property (readonly, nonatomic) NSNumber* maxOccurs; 28 | 29 | - (NSString*) readCodeForContent; 30 | - (NSString*) variableName; //in generated code 31 | 32 | - (BOOL) isSingleValue; 33 | 34 | - (id) schemaType; 35 | - (BOOL) hasEnumeration; 36 | - (NSString*) codeType; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /tests/xmls/weblinks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Web Continuum 4 | 5 | Microsoft Developer Network 6 | Macromedia 7 | Netscape Development Edge 8 | 9 | Offical Mircrosoft ASP.Net site 10 | Portal for ASP Sites 11 | Group description 12 | 13 | Group description 14 | 15 | 16 | BBC World News 17 | Evening Standard on London 18 | Group description 19 | 20 | 21 | British Airways 22 | Barcelona City Guide 23 | Last Minute Travel Deals 24 | Group description 25 | 26 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-osx/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // weblinks-osx 4 | // 5 | // Created by Dominik Pich on 05/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "weblinks.h" 11 | #import 12 | 13 | void myGenericErrorFunc(id null, const char *msg, ...); 14 | void myGenericErrorFunc(id null, const char *msg, ...) 15 | { 16 | va_list vargs; 17 | va_start(vargs, msg); 18 | 19 | NSString *format = [NSString stringWithUTF8String:msg]; 20 | NSMutableString *str = [[NSMutableString alloc] initWithFormat:format arguments:vargs]; 21 | 22 | NSLog(@"%@", str); 23 | 24 | va_end(vargs); 25 | } 26 | 27 | @interface AppDelegate () 28 | @property (weak) IBOutlet NSWindow *window; 29 | @end 30 | 31 | @implementation AppDelegate 32 | 33 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 34 | NSScrollView *scrollView = [self.window.contentView subviews][0]; 35 | NSTextView *textView = scrollView.documentView; 36 | 37 | @autoreleasepool { 38 | NSString *path = [[NSBundle mainBundle] pathForResource:@"weblinks" ofType:@"xml"]; 39 | WLFG *fg = [WLFG FGFromFile:path]; 40 | if(fg) 41 | textView.string = fg.dictionary.description; 42 | } 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures_osx/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // test 4 | // 5 | // Created by Dominik Pich on 14/12/13. 6 | // Copyright (c) 2013 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CONFIGConfig+File.h" 11 | #import 12 | 13 | void myGenericErrorFunc(id null, const char *msg, ...); 14 | void myGenericErrorFunc(id null, const char *msg, ...) 15 | { 16 | va_list vargs; 17 | va_start(vargs, msg); 18 | 19 | NSString *format = [NSString stringWithUTF8String:msg]; 20 | NSMutableString *str = [[NSMutableString alloc] initWithFormat:format arguments:vargs]; 21 | 22 | NSLog(@"%@", str); 23 | 24 | va_end(vargs); 25 | } 26 | 27 | int main(int argc, const char * argv[]) 28 | { 29 | if(argc<2) { 30 | NSLog(@"No xsdtest.xml files specified"); 31 | return -1; 32 | } 33 | 34 | xmlSetGenericErrorFunc(NULL, (xmlGenericErrorFunc)myGenericErrorFunc); 35 | 36 | for (int i = 1; i 10 | #import "MYCOMPANYAddress+File.h" 11 | #import 12 | 13 | void myGenericErrorFunc(id null, const char *msg, ...); 14 | void myGenericErrorFunc(id null, const char *msg, ...) 15 | { 16 | va_list vargs; 17 | va_start(vargs, msg); 18 | 19 | NSString *format = [NSString stringWithUTF8String:msg]; 20 | NSMutableString *str = [[NSMutableString alloc] initWithFormat:format arguments:vargs]; 21 | 22 | NSLog(@"%@", str); 23 | 24 | va_end(vargs); 25 | } 26 | 27 | int main(int argc, const char * argv[]) 28 | { 29 | if(argc<2) { 30 | NSLog(@"No xsdtest.xml files specified"); 31 | return -1; 32 | } 33 | 34 | xmlSetGenericErrorFunc(NULL, (xmlGenericErrorFunc)myGenericErrorFunc); 35 | 36 | for (int i = 1; i 12 | 13 | void myGenericErrorFunc(id null, const char *msg, ...); 14 | void myGenericErrorFunc(id null, const char *msg, ...) 15 | { 16 | va_list vargs; 17 | va_start(vargs, msg); 18 | 19 | NSString *format = [NSString stringWithUTF8String:msg]; 20 | NSMutableString *str = [[NSMutableString alloc] initWithFormat:format arguments:vargs]; 21 | 22 | NSLog(@"%@", str); 23 | 24 | va_end(vargs); 25 | } 26 | 27 | @interface AppDelegate () 28 | @property (weak) IBOutlet NSWindow *window; 29 | @end 30 | 31 | @implementation AppDelegate 32 | 33 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 34 | NSScrollView *scrollView = [self.window.contentView subviews][0]; 35 | NSTextView *textView = scrollView.documentView; 36 | 37 | @autoreleasepool { 38 | NSString *path = [[NSBundle mainBundle] pathForResource:@"MyPantry" ofType:@"xml"]; 39 | PPantryType *fg = [PPantryType PantryTypeFromFile:path]; 40 | if(fg) 41 | textView.string = fg.dictionary.description; 42 | } 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /demos/simpletypes-demo/simpletypes_osx/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // test 4 | // 5 | // Created by Dominik Pich on 14/12/13. 6 | // Copyright (c) 2013 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "STSimpleTypesType+File.h" 11 | #import 12 | 13 | void myGenericErrorFunc(id null, const char *msg, ...); 14 | void myGenericErrorFunc(id null, const char *msg, ...) 15 | { 16 | va_list vargs; 17 | va_start(vargs, msg); 18 | 19 | NSString *format = [NSString stringWithUTF8String:msg]; 20 | NSMutableString *str = [[NSMutableString alloc] initWithFormat:format arguments:vargs]; 21 | 22 | NSLog(@"%@", str); 23 | 24 | va_end(vargs); 25 | } 26 | 27 | int main(int argc, const char * argv[]) 28 | { 29 | if(argc<2) { 30 | NSLog(@"No xsdtest.xml files specified"); 31 | return -1; 32 | } 33 | 34 | xmlSetGenericErrorFunc(NULL, (xmlGenericErrorFunc)myGenericErrorFunc); 35 | 36 | for (int i = 1; i 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /demos/simpletypes-demo/simpletypes_ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/ICUTemplateMatcher.h: -------------------------------------------------------------------------------- 1 | // 2 | // ICUTemplateMatcher.h 3 | // 4 | // Created by Matt Gemmell on 19/05/2008. 5 | // Copyright 2008 Instinctive Code. All rights reserved. 6 | // 7 | 8 | #import "MGTemplateEngine.h" 9 | 10 | /* 11 | This is an example Matcher for MGTemplateEngine, implemented using libicucore on Leopard, 12 | via the RegexKitLite library: http://regexkit.sourceforge.net/#RegexKitLite 13 | 14 | This project includes everything you need, as long as you're building on Mac OS X 10.5 or later. 15 | 16 | Other matchers can easily be implemented using the MGTemplateEngineMatcher protocol, 17 | if you prefer to use another regex framework, or use another matching method entirely. 18 | */ 19 | 20 | @interface ICUTemplateMatcher : NSObject 21 | 22 | @property(atomic,assign) MGTemplateEngine *engine; // weak ref 23 | @property(atomic,retain) NSString *markerStart; 24 | @property(atomic,retain) NSString *markerEnd; 25 | @property(atomic,retain) NSString *exprStart; 26 | @property(atomic,retain) NSString *exprEnd; 27 | @property(atomic,retain) NSString *filterDelimiter; 28 | @property(atomic,retain) NSString *templateString; 29 | @property(atomic,retain) NSString *regex; 30 | 31 | + (ICUTemplateMatcher *)matcherWithTemplateEngine:(MGTemplateEngine *)theEngine; 32 | 33 | - (NSArray *)argumentsFromString:(NSString *)argString; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-osx/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // weblinks-osx 4 | // 5 | // Created by Dominik Pich on 05/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "SampleLanguageData.h" 11 | #import 12 | 13 | void myGenericErrorFunc(id null, const char *msg, ...); 14 | void myGenericErrorFunc(id null, const char *msg, ...) 15 | { 16 | va_list vargs; 17 | va_start(vargs, msg); 18 | 19 | NSString *format = [NSString stringWithUTF8String:msg]; 20 | NSMutableString *str = [[NSMutableString alloc] initWithFormat:format arguments:vargs]; 21 | 22 | NSLog(@"%@", str); 23 | 24 | va_end(vargs); 25 | } 26 | 27 | @interface AppDelegate () 28 | @property (weak) IBOutlet NSWindow *window; 29 | @end 30 | 31 | @implementation AppDelegate 32 | 33 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 34 | NSScrollView *scrollView = [self.window.contentView subviews][0]; 35 | NSTextView *textView = scrollView.documentView; 36 | 37 | @autoreleasepool { 38 | NSString *path = [[NSBundle mainBundle] pathForResource:@"SampleLanguageData" ofType:@"xml"]; 39 | LangDefType *fg = [LangDefType LangDefTypeFromFile:path]; 40 | if(fg) 41 | textView.string = fg.dictionary.description; 42 | } 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /demos/address-demo/Address.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Address.xsd 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 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/NSDictionary_DeepMutableCopy.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary_DeepMutableCopy.m 3 | // 4 | // Created by Matt Gemmell on 02/05/2008. 5 | // Copyright 2008 Instinctive Code. All rights reserved. 6 | // 7 | 8 | #import "NSDictionary_DeepMutableCopy.h" 9 | 10 | @implementation NSDictionary (DeepMutableCopy) 11 | 12 | - (NSMutableDictionary *)deepMutableCopy 13 | { 14 | NSMutableDictionary *newDictionary; 15 | NSEnumerator *keyEnumerator; 16 | id anObject; 17 | id aKey; 18 | 19 | newDictionary = [self mutableCopy]; 20 | // Run through the new dictionary and replace any objects that respond to -deepMutableCopy or -mutableCopy with copies. 21 | keyEnumerator = [[newDictionary allKeys] objectEnumerator]; 22 | while ((aKey = [keyEnumerator nextObject])) { 23 | anObject = [newDictionary objectForKey:aKey]; 24 | if ([anObject respondsToSelector:@selector(deepMutableCopy)]) { 25 | anObject = [anObject deepMutableCopy]; 26 | [newDictionary setObject:anObject forKey:aKey]; 27 | } else if ([anObject respondsToSelector:@selector(mutableCopyWithZone:)]) { 28 | anObject = [anObject mutableCopyWithZone:nil]; 29 | [newDictionary setObject:anObject forKey:aKey]; 30 | } else { 31 | [newDictionary setObject:anObject forKey:aKey]; 32 | } 33 | } 34 | 35 | return newDictionary; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures_ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | info.pich.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /tests/XSDTestCase.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSDTest.h 3 | // XSDConverter 4 | // 5 | // Created by Dominik Pich on 24/12/14. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @class XSDschema; 12 | 13 | @interface XSDTestCase : XCTestCase 14 | 15 | //set all before inoking setUp 16 | @property NSString *schemaName; 17 | @property NSString *xmlFileName; 18 | @property NSArray *expectedFiles; 19 | @property NSString *rootClassName; 20 | @property NSString *parseMethodName; 21 | 22 | @property (readonly) NSURL *schemaUrl; 23 | @property (readonly) NSURL *templateUrl; 24 | @property (readonly) NSURL *xmlFileUrl; 25 | + (NSURL*)tmpFolderUrl; 26 | 27 | //optional 28 | @property NSString *prefixOverride; 29 | 30 | - (void)assertSchema:(XSDschema*)schema; 31 | - (void)assertParsedXML:(id)rootNode; 32 | 33 | //all help underway 34 | + (void)helpSetUp; 35 | - (void)helpSetUp; 36 | - (void)helpTearDown; 37 | + (void)helpTearDown; 38 | 39 | - (void)compileParser:(NSString*)output from:(NSArray*)input; 40 | - (NSString*)compiledParserPath; 41 | - (void*)loadedLibHandle; 42 | 43 | #pragma mark correctness tests 44 | 45 | - (void)helpTestCorrectnessParsingSchema; 46 | - (void)helpTestCorrectnessGeneratingParser; 47 | 48 | #pragma mark performance tests 49 | 50 | - (void)helpTestPerformanceParsingSchema; 51 | - (void)helpTestPerformanceLoadingTemplate; 52 | - (void)helpTestPerformanceGeneratingParser; 53 | - (void)helpTestPerformanceParsingXML; 54 | @end 55 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry.xsd: -------------------------------------------------------------------------------- 1 | 2 | 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 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-ios/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-ios/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-ios/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /app/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // xsd2cocoa 4 | // 5 | // Created by Dominik Pich on 11/12/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (weak) IBOutlet NSWindow *window; 14 | @property (weak) IBOutlet NSButton *writeButton; 15 | 16 | @property (weak) IBOutlet NSTextField *xsdFilePathTextfield; 17 | @property (weak) IBOutlet NSTextField *outputFolderPathTextfield; 18 | @property (weak) IBOutlet NSButton *advancedOptionsButton; 19 | @property (strong) IBOutlet NSBox *advancedOptionsBox; 20 | 21 | @property (weak) IBOutlet NSMatrix *templateStyleMatrix; 22 | @property (weak) IBOutlet NSTextField *templatePathTextfield; 23 | //@property (weak) IBOutlet NSTextField *additionalTypes; 24 | @property (weak) IBOutlet NSTextField *customPrefix; 25 | 26 | //@property (weak) IBOutlet NSButton *productTypeDynamicFramework; 27 | //@property (weak) IBOutlet NSButton *productTypeStaticFramework; 28 | @property (weak) IBOutlet NSButton *productTypeSourceCode; 29 | 30 | - (IBAction)toggleAdvancedOptions:(id)sender; 31 | 32 | - (IBAction)openDocument:(id)sender; 33 | - (IBAction)templateChosen:(id)sender; 34 | - (IBAction)textfieldEdited:(id)sender; 35 | - (IBAction)writeCode:(id)sender; 36 | 37 | - (IBAction)showXSDHelp:(id)sender; 38 | //- (IBAction)showAdditionalTypesHelp:(id)sender; 39 | - (IBAction)showCustomTemplateHelp:(id)sender; 40 | - (IBAction)showPrefixHelp:(id)sender; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /tests/xmls/MyPantry.xsd: -------------------------------------------------------------------------------- 1 | 2 | 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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | */build/* 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | .idea/ 17 | *.hmap 18 | *.xccheckout 19 | #CocoaPods 20 | Pods 21 | demo/xsdtest/WLFavdef.h 22 | demo/xsdtest/WLFavdef.m 23 | demo/xsdtest/WLFG.h 24 | demo/xsdtest/WLFG.m 25 | demo/xsdtest/WLFG+File.h 26 | demo/xsdtest/WLFG+File.m 27 | demo/xsdtest/WLGroupdef.h 28 | demo/xsdtest/WLGroupdef.m 29 | demo/xsdtest/xsdtest.h 30 | demo2/Address/Address.h 31 | demo2/Address/MYCOMPANYAddress.h 32 | demo2/Address/MYCOMPANYAddress.m 33 | demo2/Address/MYCOMPANYAddress+File.h 34 | demo2/Address/MYCOMPANYAddress+File.m 35 | demo2/Address/MYCOMPANYStreetInfo.h 36 | demo2/Address/MYCOMPANYStreetInfo.m 37 | demo2/Address/MYCOMPANYUnitInfo.h 38 | demo2/Address/MYCOMPANYUnitInfo.m 39 | demos/weblinks-demo/weblinks-ios/generated/Sources 40 | demos/weblinks-demo/weblinks-osx/generated/Sources 41 | demos/simpletypes-demo/simpletypes_ios/Generated/Sources 42 | demos/simpletypes-demo/simpletypes_osx/Generated/Sources 43 | demos/address-demo/addressTest_ios/Generated/Sources 44 | demos/address-demo/addressTest_osx/Generated/Sources 45 | demos/MyPantry-demo/MyPantry-ios/generated/Sources 46 | demos/MyPantry-demo/MyPantry-osx/generated/Sources 47 | demos/SampleLanguageData/SampleLanguageData-ios/generated/Sources 48 | demos/SampleLanguageData/SampleLanguageData-osx/generated/Sources 49 | -------------------------------------------------------------------------------- /tests/XSDTestCaseObjC.m: -------------------------------------------------------------------------------- 1 | // 2 | // XSDTest.m 3 | // XSDConverter 4 | // 5 | // Created by Dominik Pich on 24/12/14. 6 | // 7 | // 8 | 9 | #import "XSDTestCaseObjC.h" 10 | #import "XSDschema.h" 11 | #import "DDRunTask.h" 12 | 13 | @interface XSDTestCase (private) 14 | @property NSURL *templateUrl; 15 | @end 16 | 17 | @implementation XSDTestCaseObjC 18 | 19 | - (void)helpSetUp { 20 | NSURL *templateUrl = [[NSBundle bundleForClass:[XSDschema class]] URLForResource:@"template-objc" withExtension:@"xml"]; 21 | assert(templateUrl); 22 | self.templateUrl = templateUrl; 23 | 24 | [super helpSetUp]; 25 | } 26 | 27 | - (void)compileParser:(NSString *)output from:(NSArray *)input { 28 | id tmp = [self.class tmpFolderUrl].path; 29 | 30 | //get sdk paths 31 | NSString *toolPath = DDRunTask(@"/usr/bin/xcrun", @"-f", @"--sdk", @"macosx", @"clang", nil); 32 | NSString *sdkPath = DDRunTask(@"/usr/bin/xcrun", @"--show-sdk-path", @"--sdk", @"macosx", nil); 33 | toolPath = [toolPath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 34 | sdkPath = [sdkPath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 35 | 36 | id env = @{@"SDKROOT": sdkPath}; 37 | 38 | DDRunTaskExt(tmp, env, nil, toolPath, @"-fobjc-arc", @"-ObjC", @"-dynamiclib", @"-arch", @"x86_64", @"-framework", @"foundation", @"-lxml2", [NSString stringWithFormat:@"-I%@/usr/include/libxml2", sdkPath], @"-o", output, input, nil); 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /tests/xmls/weblinks_groups.xsd: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | weblinks_groups.xsd extends a format for saving links defined by weblinks.xsd by adding support for groups 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | this type defines a group of links - a group has a name and can have subgroups 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | these elements is a description 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | this attribute is required and stores the display name of the group 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /framework/objects/XSDAnnotation.m: -------------------------------------------------------------------------------- 1 | // 2 | // XSDAnnotation.m 3 | // XSDConverter 4 | // 5 | // Created by Dominik Pich on 26/12/14. 6 | // 7 | // 8 | 9 | #import "XSDAnnotation.h" 10 | 11 | 12 | @interface XSDAnnotation () 13 | 14 | @property(nonatomic, strong) NSString *identifier; 15 | @property(nonatomic, strong) NSString *appInfo; 16 | @property(nonatomic, strong) NSString *documentation; 17 | 18 | @end 19 | 20 | @implementation XSDAnnotation 21 | 22 | - (id) initWithNode:(NSXMLElement*)node schema:(XSDschema*)schema { 23 | self = [super initWithNode:node schema:schema]; 24 | if(self) { 25 | self.identifier = [[XMLUtils node:node stringAttribute:@"id"] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 26 | self.appInfo = [[XMLUtils node:node childWithName:@"appinfo"].stringValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 27 | self.documentation = [[XMLUtils node:node childWithName:@"documentation"].stringValue stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 28 | 29 | if(_identifier.length || _appInfo.length || _documentation.length) { 30 | return self; 31 | } 32 | } 33 | 34 | return nil; 35 | } 36 | 37 | - (NSString*)comment { 38 | NSMutableArray *text = [NSMutableArray arrayWithCapacity:3]; 39 | if(_identifier) { 40 | [text addObject:[NSString stringWithFormat:@"id: %@", _identifier]]; 41 | } 42 | if(_appInfo) { 43 | [text addObject:[NSString stringWithFormat:@"appInfo: %@", _appInfo]]; 44 | } 45 | if(_documentation) { 46 | [text addObject:_documentation]; 47 | } 48 | return [text componentsJoinedByString:@"\n"]; 49 | } 50 | @end 51 | -------------------------------------------------------------------------------- /XSDConverter.xcodeproj/project.xcworkspace/xcshareddata/XSDConverter.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "D67AB753B03769A3C70319DAE504A0BE94489E41", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "69597A54A55EE7A148A1654F998635C337579421" : 0, 8 | "D67AB753B03769A3C70319DAE504A0BE94489E41" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "7B2F8FB6-F642-4A4E-95E9-0820E77241CA", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "69597A54A55EE7A148A1654F998635C337579421" : "xsd2cocoa\/framework\/vendor\/MGTemplateEngine\/", 13 | "D67AB753B03769A3C70319DAE504A0BE94489E41" : "xsd2cocoa\/" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "XSDConverter", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "XSDConverter.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/mattgemmell\/MGTemplateEngine", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "69597A54A55EE7A148A1654F998635C337579421" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:Daij-Djan\/xsd2cocoa.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "D67AB753B03769A3C70319DAE504A0BE94489E41" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /framework/objects/XSSimpleType.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSSimpleTypeTemplate.h 3 | // xsd2cocoa 4 | // 5 | // Created by Stefan Winter on 11.08.11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "XSSchemaNode.h" 10 | #import "XSType.h" 11 | 12 | @interface XSSimpleType : XSSchemaNode < XSType > 13 | 14 | @property (readonly, nonatomic) NSString* name; 15 | @property (readonly, nonatomic) NSString* baseType; 16 | @property (readonly, nonatomic) NSArray* attributes; 17 | //@property (readonly, nonatomic) NSArray* globalElements; 18 | @property (readonly, nonatomic) NSString* targetClassName; 19 | @property (readonly, nonatomic) NSString* arrayType; 20 | //@property (readonly, nonatomic) NSString* readEnumerationTemplate; 21 | @property (readonly, nonatomic) NSString* readAttributeTemplate; 22 | @property (readonly, nonatomic) NSString* readElementTemplate; 23 | @property (readonly, nonatomic) NSString* readValueCode; 24 | @property (readonly, nonatomic) NSString* readPrefixCode; 25 | @property (readonly, nonatomic) NSArray* includes; 26 | @property (strong, nonatomic) NSArray* enumerations; 27 | 28 | - (BOOL)supplyTemplates:(NSXMLElement *)element enumTypeNode:(NSXMLNode*)enumTypeNode error:(NSError *__autoreleasing *)error; 29 | - (NSDictionary*) substitutionDict; 30 | 31 | - (id) initWithNode: (NSXMLElement*) node schema: (XSDschema*) schema; 32 | - (id) initWithName: (NSString*) name baseType: (NSString*)baseType schema: (XSDschema*) schema; 33 | 34 | //enum support 35 | - (BOOL) hasEnumeration; 36 | - (NSArray *) enumerationValues; 37 | - (NSString *) enumerationName; 38 | - (NSString *) enumerationFileName; 39 | - (NSString *) swiftIntEnum; 40 | 41 | @end 42 | 43 | @interface XSSimpleType () 44 | 45 | + (NSArray *)knownSimpleTypesForSchema:(XSDschema*)schema; 46 | 47 | @end 48 | 49 | extern BOOL gUnitTestingSwiftCode; //swift 2 workaround -------------------------------------------------------------------------------- /framework/XSDschema.h: -------------------------------------------------------------------------------- 1 | // 2 | // XSDschema.h 3 | // xsd2cocoa 4 | // 5 | // Created by Stefan Winter on 5/22/11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | #import "XSSchemaNode.h" 9 | 10 | @protocol XSType; 11 | @protocol FileFormatter; 12 | @class XSDcomplexType; 13 | 14 | typedef enum : NSUInteger { 15 | XSDschemaGeneratorOptionSourceCode=8, 16 | } XSDschemaGeneratorOptions; 17 | 18 | @interface XSDschema : XSSchemaNode 19 | 20 | @property (readonly, nonatomic) NSURL* schemaUrl; 21 | @property (readonly, nonatomic) NSString* targetNamespace; 22 | @property (readonly, nonatomic) NSArray* allNamespaces; 23 | @property (readonly, nonatomic) NSArray* complexTypes; 24 | @property (readonly, nonatomic) NSArray* includedSchemas;//included and imported both. except for namespacing, we dont care 25 | @property (readonly, nonatomic) NSArray* simpleTypes; 26 | @property (readonly, nonatomic) NSString *xmlSchemaNamespace; 27 | - (NSString*)nameSpacedSchemaNodeNameForNodeName:(NSString*)nodeName; 28 | 29 | @property (readonly, weak, nonatomic) XSDschema* parentSchema; 30 | 31 | //create the scheme, loading all types and includes 32 | - (id) initWithUrl: (NSURL*) schemaUrl targetNamespacePrefix: (NSString*) prefix error: (NSError**) error; 33 | 34 | //element may add local types (Complex or simple) 35 | - (void) addType: (id)type; 36 | 37 | - (BOOL) loadTemplate: (NSURL*) templateUrl error: (NSError**) error; 38 | - (id) typeForName: (NSString*) qname; //this will only return proper type info when called during generation 39 | - (NSString*)classPrefixForType:(id)type; 40 | + (NSString*) variableNameFromName:(NSString*)vName multiple:(BOOL)multiple; 41 | 42 | #pragma mark - 43 | 44 | //generate code using loaded template 45 | - (BOOL) generateInto: (NSURL*) destinationFolder 46 | products: (XSDschemaGeneratorOptions)options 47 | error: (NSError**) error; 48 | 49 | @end -------------------------------------------------------------------------------- /framework/objects/XSSchemaNode.m: -------------------------------------------------------------------------------- 1 | // 2 | // XmlAccess.m 3 | // xsd2cocoa 4 | // 5 | // Created by Stefan Winter on 5/22/11. 6 | // Copyright 2011 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "XSSchemaNode.h" 10 | #import "XSDschema.h" 11 | #import "XMLUtils.h" 12 | #import "XSDAnnotation.h" 13 | 14 | @interface XSSchemaNode () 15 | 16 | @property (nonatomic, strong) NSXMLElement* node; 17 | @property (nonatomic, weak) XSDschema* schema; 18 | 19 | @end 20 | 21 | @implementation XSSchemaNode { 22 | NSMutableArray *_annotations; 23 | } 24 | 25 | - (id) initWithNode:(NSXMLElement*)node schema:(XSDschema*)schema { 26 | self = [self init]; 27 | if(self) { 28 | self.node = node; 29 | self.schema = schema; 30 | 31 | if(!schema && [self isKindOfClass:[XSDschema class]]) { 32 | self.schema = (XSDschema*)self; 33 | } 34 | } 35 | return self; 36 | } 37 | 38 | - (NSArray *)annotations { 39 | if(!_annotations) { 40 | NSArray * elems = [XMLUtils node:self.node childrenWithName:@"annotation"]; 41 | _annotations = [NSMutableArray arrayWithCapacity:elems.count]; 42 | 43 | for (NSXMLElement *elem in elems) { 44 | XSDAnnotation *annotation = [[XSDAnnotation alloc] initWithNode:elem schema:self.schema]; 45 | if(annotation) { 46 | [_annotations addObject:annotation]; 47 | } 48 | } 49 | } 50 | return _annotations; 51 | } 52 | 53 | - (BOOL)hasAnnotations { 54 | return (self.annotations.count != 0); 55 | } 56 | 57 | - (NSString*)comment { 58 | NSMutableString *allComments = [NSMutableString string]; 59 | for (XSDAnnotation *ann in self.annotations) { 60 | NSString *annComment = ann.comment; 61 | if(annComment.length) { 62 | if(allComments.length) { 63 | [allComments appendString:@"\n"]; 64 | } 65 | [allComments appendString:annComment]; 66 | } 67 | } 68 | return allComments; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /framework/xmls/datatypes.xml: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /tests/xmls/weblinks.xsd: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | weblinks.xsd defines a format for saving links to your favourite websites - it uses a recursive include 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | this root element contains links or groups of links 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | this type defines a mixed collection of link items and/or groups of links 26 | 27 | 28 | 29 | 30 | 31 | 32 | these elements represent link items 33 | 34 | 35 | 36 | 37 | 38 | 39 | these elements represent groups of links 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | this type defines how a link is represented. It has textual content (name) and a link attribute 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | this attribute is required and stores the absolute url of the link 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-ios/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /demos/address-demo/addressTest_ios/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-ios/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /demos/simpletypes-demo/simpletypes_ios/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures_ios/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-ios/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // addressTest_ios 4 | // 5 | // Created by Dominik Pich on 10/01/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /framework/objects/XSDexplicitGroup.m: -------------------------------------------------------------------------------- 1 | /* 2 | XSDexplicitGroup.h 3 | The implementation of properties and methods for the XSDexplicitGroup object. 4 | Generated by SudzC.com 5 | */ 6 | #import "XSDexplicitGroup.h" 7 | #import "XSDSchema.h" 8 | #import "XSDelement.h" 9 | #import "XMLUtils.h" 10 | 11 | @interface XSDexplicitGroup () 12 | 13 | @property (strong, nonatomic) NSString* name; 14 | @property (strong, nonatomic) NSString* ref; 15 | @property (strong, nonatomic) NSArray* elements; 16 | 17 | @end 18 | 19 | @implementation XSDexplicitGroup 20 | 21 | /** 22 | * Name: initWithNode (NSXMLElement *) (XSDschema *) 23 | * Parameters: (NSXMLElement *) - the current parent xml element (sequence or choice) containing the elements 24 | * (XSDschema *) - the current schema that this item is contain within 25 | * Returns: The object that is generated that contains the child elements 26 | * Description: Will define 27 | */ 28 | - (id) initWithNode:(NSXMLElement *)node schema:(XSDschema *)schema { 29 | /* Generate the schema node for the current item */ 30 | self = [super initWithNode:node schema: schema]; 31 | 32 | /* Continue to extend the class by adding the specific explicitGroup elements */ 33 | if(self) { 34 | /* For the containing object, grab the name and the reference */ 35 | self.name = [XMLUtils node:node stringAttribute:@"name"]; 36 | self.ref = [XMLUtils node:node stringAttribute:@"ref"]; 37 | 38 | /* If no name is defined, do a standard name */ 39 | if(!self.name) 40 | self.name = @"XS"; 41 | 42 | /* Grab the elements that are contained within this object and append them to the current object's element list */ 43 | NSMutableArray* newElements = [NSMutableArray array]; 44 | NSArray* elementTags = [XMLUtils node:node descendantsWithName: @"element"]; 45 | for(NSXMLElement* anElement in elementTags) { 46 | /* Create a standard element type and append it to the list of elements */ 47 | [newElements addObject:[[XSDelement alloc] initWithNode:anElement schema:schema]]; 48 | } 49 | /* Assign the new list to the object's list */ 50 | self.elements = newElements; 51 | } 52 | 53 | /* Return the created object */ 54 | return self; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /tests/xmls/address.xsd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | weblinks.xsd defines a format for saving links to your favourite websites - it uses a includes and local types 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 | Test Documentation 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/MGTemplateMarker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MGTemplateMarker.h 3 | * 4 | * Created by Matt Gemmell on 12/05/2008. 5 | * Copyright 2008 Instinctive Code. All rights reserved. 6 | * 7 | */ 8 | 9 | #import "MGTemplateEngine.h" 10 | 11 | @protocol MGTemplateMarker 12 | @required 13 | - (id)initWithTemplateEngine:(MGTemplateEngine *)engine; // to avoid retain cycles, use a weak reference for engine. 14 | - (NSArray *)markers; // array of markers (each unique across all markers) this object handles. 15 | - (NSArray *)endMarkersForMarker:(NSString *)marker; // returns the possible corresponding end-markers for a marker which has just started a block. 16 | - (NSObject *)markerEncountered:(NSString *)marker withArguments:(NSArray *)args inRange:(NSRange)markerRange 17 | blockStarted:(BOOL *)blockStarted blockEnded:(BOOL *)blockEnded 18 | outputEnabled:(BOOL *)outputEnabled nextRange:(NSRange *)nextRange 19 | currentBlockInfo:(NSDictionary *)blockInfo newVariables:(NSDictionary **)newVariables; 20 | /* Notes for -markerEncountered:... method 21 | Arguments: 22 | marker: marker encountered by the template engine 23 | args: arguments to the marker, in order 24 | markerRange: the range of the marker encountered in the engine's templateString 25 | blockStarted: pointer to BOOL. Set it to YES if the marker just started a block. 26 | blockEnded: pointer to BOOL. Set it to YES if the marker just ended a block. 27 | Note: you should never set both blockStarted and blockEnded in the same call. 28 | outputEnabled: pointer to BOOL, indicating whether the engine is currently outputting. Can be changed to switch output on/off. 29 | nextRange: the next range in the engine's templateString which will be searched. Can be modified if necessary. 30 | currentBlockInfo: information about the current block, if the block was started by this handler; otherwise nil. 31 | Note: if supplied, will include a dictionary of variables set for the current block. 32 | newVariables: variables to set in the template context. If blockStarted is YES, these will be scoped only within the new block. 33 | Note: if currentBlockInfo was specified, variables set in the return dictionary will override/update any variables of 34 | the same name in currentBlockInfo's variables. This is for ease of updating loop-counters or such. 35 | Returns: 36 | A return value to insert into the template output, or nil if nothing should be inserted. 37 | */ 38 | 39 | - (void)engineFinishedProcessingTemplate; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /tests/vendor/DDReflectionHelpersCOMPILED/DDReflectionHelpers.template: -------------------------------------------------------------------------------- 1 | // 2 | // ReflectionHelpers.swift 3 | // 4 | // Created by Dominik Pich on 11/14/15. 5 | // Copyright © 2015 Dominik Pich. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | 10 | public protocol EVRawInt { 11 | var rawValue: Int { get } 12 | } 13 | 14 | @objc 15 | class ReflectionHelpers : NSObject { 16 | class func getNSNumberForProperty(cls: AnyObject!, name: String!) -> NSNumber! { 17 | let m = Mirror(reflecting: cls) 18 | let child1 = m.descendant(name) 19 | 20 | if(child1 != nil) { 21 | //bool 22 | if let b = child1 as? Bool { 23 | return NSNumber(bool: b) 24 | } 25 | if let any = child1, let maybeB = Mirror(reflecting: any).descendant("Some") as? Bool { 26 | if let b = (maybeB as Bool?) { 27 | return NSNumber(bool: b) 28 | } 29 | } 30 | 31 | //Int 32 | if let b = child1 as? Int { 33 | return NSNumber(integer: b) 34 | } 35 | if let any = child1, let maybeB = Mirror(reflecting: any).descendant("Some") as? Int { 36 | if let b = (maybeB as Int?) { 37 | return NSNumber(integer: b) 38 | } 39 | } 40 | 41 | //Float 42 | if let b = child1 as? Float { 43 | return NSNumber(float: b) 44 | } 45 | if let any = child1, let maybeB = Mirror(reflecting: any).descendant("Some") as? Float { 46 | if let b = (maybeB as Float?) { 47 | return NSNumber(float: b) 48 | } 49 | } 50 | 51 | //Double 52 | if let b = child1 as? Double { 53 | return NSNumber(double: b) 54 | } 55 | if let any = child1, let maybeB = Mirror(reflecting: any).descendant("Some") as? Double { 56 | if let b = (maybeB as Double?) { 57 | return NSNumber(double: b) 58 | } 59 | } 60 | 61 | //EVRawInt 62 | if let b = child1 as? EVRawInt { 63 | return NSNumber(integer: b.rawValue) 64 | } 65 | if let any = child1, let maybeB = Mirror(reflecting: any).descendant("Some") as? EVRawInt { 66 | if let b = (maybeB as EVRawInt?) { 67 | return NSNumber(integer: b.rawValue) 68 | } 69 | } 70 | } 71 | 72 | return nil 73 | } 74 | } -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-ios/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-ios/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /demos/SampleLanguageData/SampleLanguageData-ios/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /tests/MyPantryTestsSwift.m: -------------------------------------------------------------------------------- 1 | // 2 | // ASDATests.m 3 | // ASDATests 4 | // 5 | // Created by Dominik Pich on 22/12/14. 6 | // 7 | // 8 | 9 | #import 10 | #import "XSDTestCaseSwift.h" 11 | #import "XSDConverterCore.h" 12 | 13 | @interface MyPantryTestsSwift : XSDTestCaseSwift 14 | @end 15 | 16 | @implementation MyPantryTestsSwift 17 | 18 | + (void)setUp { 19 | [self helpSetUp]; 20 | } 21 | 22 | - (void)setUp { 23 | self.schemaName = @"MyPantry"; 24 | self.xmlFileName = @"MyPantry"; 25 | self.expectedFiles = @[@"libxml-bridging-header.h", 26 | @"PFoodGroupTypeEnum.swift", 27 | @"PFoodItemType.swift", 28 | @"PPantryType.swift", 29 | @"PPantryType+File.swift", 30 | @"PShelfType.swift"]; 31 | self.rootClassName = @"parser.PPantryType"; 32 | self.parseMethodName = @"PantryTypeFromURL:"; 33 | 34 | [self helpSetUp]; 35 | [super setUp]; 36 | } 37 | 38 | - (void)tearDown { 39 | [self helpTearDown]; 40 | [super tearDown]; 41 | } 42 | 43 | + (void)tearDown { 44 | [self helpTearDown]; 45 | } 46 | 47 | - (void)assertSchema:(id)schema { 48 | XSDcomplexType *ct = [schema typeForName:@"PantryType"]; 49 | XCTAssert(ct); 50 | XCTAssert([[ct.globalElements valueForKeyPath:@"name"] containsObject:@"Pantry"]); 51 | XCTAssert([[ct.sequenceOrChoice.elements valueForKeyPath:@"name"] containsObject:@"Shelf"]); 52 | } 53 | 54 | - (void)assertParsedXML:(id)rootNode { 55 | NSArray *Shelfs = [rootNode valueForKey:@"Shelfs"]; 56 | XCTAssertEqual(Shelfs.count, 2); 57 | NSArray *foods1 = [Shelfs[0] valueForKeyPath:@"Foods"]; 58 | NSArray *foods2 = [Shelfs[1] valueForKeyPath:@"Foods"]; 59 | XCTAssertEqual(foods1.count, 1); 60 | XCTAssertEqual(foods2.count, 1); 61 | 62 | id n1 = [foods1[0] valueForKey:@"Name"]; 63 | id n2 = [foods2[0] valueForKey:@"Name"]; 64 | XCTAssertEqualObjects(n1, @"Apple"); 65 | XCTAssertEqualObjects(n2, @"Chocolate"); 66 | } 67 | 68 | #pragma mark - 69 | 70 | - (void)testCorrectnessParsingSchema { 71 | [self helpTestCorrectnessParsingSchema]; 72 | } 73 | 74 | - (void)testCorrectnessGeneratingParser { 75 | [self helpTestCorrectnessGeneratingParser]; 76 | } 77 | 78 | #pragma mark performance tests 79 | 80 | - (void)testPerformanceParsingSchema { 81 | [self helpTestPerformanceParsingSchema]; 82 | } 83 | 84 | - (void)testPerformanceLoadingTemplate { 85 | [self helpTestPerformanceLoadingTemplate]; 86 | } 87 | 88 | - (void)testPerformanceGeneratingParser { 89 | [self helpTestPerformanceGeneratingParser]; 90 | } 91 | 92 | - (void)testPerformanceParsingXML { 93 | [self helpTestPerformanceParsingXML]; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /framework/XSDschema+XPaths.m: -------------------------------------------------------------------------------- 1 | // 2 | // XSDschema+XPaths.m 3 | // XSDConverter 4 | // 5 | // Created by Dominik Pich on 29/06/15. 6 | // 7 | // 8 | 9 | #import "XSDschema+XPaths.h" 10 | 11 | @implementation XSDschema (XPaths) 12 | 13 | - (NSString*)XPathForSchemaSimpleTypes { 14 | id path = [NSString stringWithFormat:@"/%@/%@", 15 | [self nameSpacedSchemaNodeNameForNodeName:@"schema"], 16 | [self nameSpacedSchemaNodeNameForNodeName:@"simpleType"]]; 17 | return path; 18 | } 19 | 20 | - (NSString*)XPathForSchemaComplexTypes { 21 | id path = [NSString stringWithFormat:@"/%@/%@", 22 | [self nameSpacedSchemaNodeNameForNodeName:@"schema"], 23 | [self nameSpacedSchemaNodeNameForNodeName:@"complexType"]]; 24 | return path; 25 | } 26 | 27 | - (NSString*)XPathForSchemaGlobalElements { 28 | id path = [NSString stringWithFormat:@"/%@/%@", 29 | [self nameSpacedSchemaNodeNameForNodeName:@"schema"], 30 | [self nameSpacedSchemaNodeNameForNodeName:@"element"]]; 31 | return path; 32 | } 33 | 34 | - (NSString*)XPathForSchemaIncludes { 35 | id path = [NSString stringWithFormat:@"/%@/%@", 36 | [self nameSpacedSchemaNodeNameForNodeName:@"schema"], 37 | [self nameSpacedSchemaNodeNameForNodeName:@"include"]]; 38 | return path; 39 | } 40 | 41 | - (NSString*)XPathForSchemaImports { 42 | id path = [NSString stringWithFormat:@"/%@/%@", 43 | [self nameSpacedSchemaNodeNameForNodeName:@"schema"], 44 | [self nameSpacedSchemaNodeNameForNodeName:@"import"]]; 45 | return path; 46 | } 47 | 48 | - (NSString*)XPathForTemplateAdditionalFiles { 49 | return @"/template[1]/additional_file"; 50 | } 51 | 52 | - (NSString*)XPathForTemplateFormatStyles { 53 | return @"/template[1]/format_style"; 54 | } 55 | 56 | - (NSString*)XPathForTemplateFirstEnumeration { 57 | return @"/template[1]/enumeration[1]"; 58 | } 59 | 60 | - (NSString*)XPathForTemplateReads { 61 | return @"read"; 62 | } 63 | 64 | - (NSString*)XPathForTemplateFirstImplementationHeaders { 65 | return @"implementation[1]/header"; 66 | } 67 | 68 | - (NSString*)XPathForTemplateFirstImplementationClasses { 69 | return @"implementation[1]/class"; 70 | } 71 | 72 | - (NSString*)XPathForTemplateFirstReaderHeaders { 73 | return @"reader[1]/header"; 74 | } 75 | 76 | - (NSString*)XPathForTemplateFirstReaderClasses { 77 | return @"reader[1]/class"; 78 | } 79 | 80 | - (NSString*)XPathForTemplateFirstComplexType { 81 | return @"/template[1]/complextype[1]"; 82 | } 83 | 84 | - (NSString*)XPathForTemplateSimpleTypes { 85 | return @"/template[1]/simpletype"; 86 | } 87 | 88 | - (NSString*)XPathForTemplateFirstElementRead { 89 | return @"read[1]/element[1]"; 90 | } 91 | 92 | + (NSString*)XPathForNamechanges { 93 | return @"/nameChanges/nameChange"; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /tests/xmls/configFeatures.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | configFeatures.xsd defines a format for testing enumeration support 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 | -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | configFeatures.xsd defines a format for testing enumeration support 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 | -------------------------------------------------------------------------------- /tests/XSDTestCaseSwift.m: -------------------------------------------------------------------------------- 1 | // 2 | // XSDTest.m 3 | // XSDConverter 4 | // 5 | // Created by Dominik Pich on 24/12/14. 6 | // 7 | // 8 | 9 | #import "XSDTestCaseSwift.h" 10 | #import "XSDschema.h" 11 | #import "DDRunTask.h" 12 | #import 13 | #import "XSSimpleType.h" 14 | 15 | @interface XSDTestCase (private) 16 | @property NSURL *templateUrl; 17 | @end 18 | 19 | //make selector known 20 | @interface NSObject (add) 21 | + (NSNumber*)getNSNumberForProperty:(id)obj name:(NSString*)propertyName; 22 | @end 23 | 24 | @implementation XSDTestCaseSwift 25 | 26 | - (void)helpSetUp { 27 | gUnitTestingSwiftCode = YES; 28 | 29 | NSURL *templateUrl = [[NSBundle bundleForClass:[XSDschema class]] URLForResource:@"template-swift" withExtension:@"xml"]; 30 | assert(templateUrl); 31 | self.templateUrl = templateUrl; 32 | 33 | [super helpSetUp]; 34 | } 35 | 36 | - (void)compileParser:(NSString *)output from:(NSArray *)input { 37 | id tmp = [self.class tmpFolderUrl].path; 38 | NSArray *headerFiles = [input filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"lastPathComponent ENDSWITH \".h\""]]; 39 | NSArray *swiftFiles = [input filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"lastPathComponent ENDSWITH \".swift\""]]; 40 | 41 | NSURL *extraSwiftFileUrl = [[NSBundle bundleForClass:[XSDTestCaseSwift class]] URLForResource:@"DDReflectionHelpers" withExtension:@"template"]; 42 | assert(extraSwiftFileUrl); 43 | 44 | NSURL *extraSwiftFileTargetUrl = [[self.class tmpFolderUrl] URLByAppendingPathComponent:@"ReflectionHelpers.swift"]; 45 | [[NSFileManager defaultManager] copyItemAtURL:extraSwiftFileUrl toURL:extraSwiftFileTargetUrl error:nil]; 46 | NSMutableArray *allFiles = [@[extraSwiftFileTargetUrl] mutableCopy]; 47 | if(swiftFiles) { 48 | [allFiles addObjectsFromArray:swiftFiles]; 49 | } 50 | 51 | //get sdk paths 52 | NSString *toolPath = DDRunTask(@"/usr/bin/xcrun", @"-f", @"--sdk", @"macosx", @"swiftc", nil); 53 | NSString *sdkPath = DDRunTask(@"/usr/bin/xcrun", @"--show-sdk-path", @"--sdk", @"macosx", nil); 54 | toolPath = [toolPath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 55 | sdkPath = [sdkPath stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 56 | 57 | id env = @{@"SDKROOT": sdkPath}; 58 | 59 | DDRunTaskExt(tmp, env, nil, toolPath, @"-target-cpu", @"x86-64", @"-module-name", @"parser", @"-O", @"-sdk", sdkPath, @"-import-objc-header", headerFiles.firstObject, [NSString stringWithFormat:@"-I%@/usr/include/libxml2", sdkPath], @"-lxml2", @"-emit-library", @"-o", output, allFiles, nil); 60 | } 61 | 62 | - (NSNumber*)reflect:(id)obj numberForKey:(NSString*)propertyName { 63 | // NSLog(@"%@", [NSObject classDumps]); 64 | Class wlfg_class = objc_getClass("parser.ReflectionHelpers"); 65 | XCTAssert(wlfg_class); 66 | 67 | id n = [wlfg_class getNSNumberForProperty:obj name:propertyName]; 68 | 69 | return n; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /tests/MyPantryTestsObjC.m: -------------------------------------------------------------------------------- 1 | // 2 | // ASDATests.m 3 | // ASDATests 4 | // 5 | // Created by Dominik Pich on 22/12/14. 6 | // 7 | // 8 | 9 | #import 10 | #import "XSDTestCaseObjC.h" 11 | #import "XSDConverterCore.h" 12 | 13 | @interface MyPantryTestsObjC : XSDTestCaseObjC 14 | @end 15 | 16 | @implementation MyPantryTestsObjC 17 | 18 | + (void)setUp { 19 | [self helpSetUp]; 20 | } 21 | 22 | - (void)setUp { 23 | self.schemaName = @"MyPantry"; 24 | self.xmlFileName = @"MyPantry"; 25 | self.expectedFiles = @[@"MyPantry.h", 26 | @"PFoodGroupTypeEnum.h", 27 | @"PFoodGroupTypeEnum.m", 28 | @"PFoodItemType.h", 29 | @"PFoodItemType.m", 30 | @"PPantryType.h", 31 | @"PPantryType.m", 32 | @"PPantryType+File.h", 33 | @"PPantryType+File.m", 34 | @"PShelfType.h", 35 | @"PShelfType.m"]; 36 | self.rootClassName = @"PPantryType"; 37 | self.parseMethodName = @"PantryTypeFromURL:"; 38 | 39 | [self helpSetUp]; 40 | [super setUp]; 41 | } 42 | 43 | - (void)tearDown { 44 | [self helpTearDown]; 45 | [super tearDown]; 46 | } 47 | 48 | + (void)tearDown { 49 | [self helpTearDown]; 50 | } 51 | 52 | - (void)assertSchema:(id)schema { 53 | XSDcomplexType *ct = [schema typeForName:@"PantryType"]; 54 | XCTAssert(ct); 55 | XCTAssert([[ct.globalElements valueForKeyPath:@"name"] containsObject:@"Pantry"]); 56 | XCTAssert([[ct.sequenceOrChoice.elements valueForKeyPath:@"name"] containsObject:@"Shelf"]); 57 | } 58 | 59 | - (void)assertParsedXML:(id)rootNode { 60 | NSArray *Shelfs = [rootNode valueForKey:@"Shelfs"]; 61 | XCTAssertEqual(Shelfs.count, 2); 62 | NSArray *foods1 = [Shelfs[0] valueForKeyPath:@"Foods"]; 63 | NSArray *foods2 = [Shelfs[1] valueForKeyPath:@"Foods"]; 64 | XCTAssertEqual(foods1.count, 1); 65 | XCTAssertEqual(foods2.count, 1); 66 | 67 | id n1 = [foods1[0] valueForKey:@"Name"]; 68 | id n2 = [foods2[0] valueForKey:@"Name"]; 69 | XCTAssertEqualObjects(n1, @"Apple"); 70 | XCTAssertEqualObjects(n2, @"Chocolate"); 71 | } 72 | 73 | #pragma mark - 74 | 75 | - (void)testCorrectnessParsingSchema { 76 | [self helpTestCorrectnessParsingSchema]; 77 | } 78 | 79 | - (void)testCorrectnessGeneratingParser { 80 | [self helpTestCorrectnessGeneratingParser]; 81 | } 82 | 83 | #pragma mark performance tests 84 | 85 | - (void)testPerformanceParsingSchema { 86 | [self helpTestPerformanceParsingSchema]; 87 | } 88 | 89 | - (void)testPerformanceLoadingTemplate { 90 | [self helpTestPerformanceLoadingTemplate]; 91 | } 92 | 93 | - (void)testPerformanceGeneratingParser { 94 | [self helpTestPerformanceGeneratingParser]; 95 | } 96 | 97 | - (void)testPerformanceParsingXML { 98 | [self helpTestPerformanceParsingXML]; 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /tests/xmls/configFeaturesNamespaced.xsd: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | configFeatures.xsd defines a format for testing enumeration support 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 | -------------------------------------------------------------------------------- /demos/address-demo/addressTest_ios/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/simpletypes-demo/simpletypes_ios/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /demos/configFeatures-demo/configFeatures_ios/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/WeblinksTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ASDATests.m 3 | // ASDATests 4 | // 5 | // Created by Dominik Pich on 22/12/14. 6 | // 7 | // 8 | 9 | #import 10 | #import "XSDTestCase.h" 11 | #import "XSDConverterCore.h" 12 | 13 | @interface WeblinksTests : XSDTestCase 14 | @end 15 | 16 | @implementation WeblinksTests 17 | 18 | - (void)setUp { 19 | self.schemaName = @"weblinks"; 20 | self.xmlFileName = @"weblinks"; 21 | self.expectedFiles = @[@"WLFavdef.h", 22 | @"WLFavdef.m", 23 | @"WLFG.h", 24 | @"WLFG.m", 25 | @"WLFG+File.h", 26 | @"WLFG+File.m", 27 | @"WLGroupdef.h", 28 | @"WLGroupdef.m", 29 | @"WLDescription.m", 30 | @"WLDescription.h", 31 | @"weblinks.h"]; 32 | self.rootClassName = @"WLFG"; 33 | self.parseMethodName = @"FGFromURL:"; 34 | 35 | [self helpSetUp]; 36 | [super setUp]; 37 | } 38 | 39 | - (void)tearDown { 40 | [self helpTearDown]; 41 | [super tearDown]; 42 | } 43 | - (void)assertSchema:(id)schema { 44 | XSDcomplexType *ct = [schema typeForName:@"FG"]; 45 | XCTAssert(ct); 46 | XCTAssert([[ct.globalElements valueForKeyPath:@"name"] containsObject:@"favourites"]); 47 | XCTAssert([[ct.sequenceOrChoice.elements valueForKeyPath:@"name"] containsObject:@"favitem"]); 48 | XCTAssert([[ct.sequenceOrChoice.elements valueForKeyPath:@"name"] containsObject:@"group"]); 49 | XCTAssert(ct.hasAnnotations); 50 | 51 | ct = [schema typeForName:@"favdef"]; 52 | XCTAssert(ct); 53 | XCTAssert([[ct.attributes valueForKeyPath:@"name"] containsObject:@"link"]); 54 | XCTAssert(ct.hasAnnotations); 55 | 56 | ct = [schema typeForName:@"groupdef"]; 57 | XCTAssert(ct); 58 | XCTAssert([[schema typeForName:ct.baseType].name isEqualTo:@"FG"]); 59 | XCTAssert([[ct.attributes valueForKeyPath:@"name"] containsObject:@"name"]); 60 | XCTAssert([[ct.sequenceOrChoice.elements valueForKeyPath:@"name"] containsObject:@"description"]); 61 | XCTAssert(ct.hasAnnotations); 62 | 63 | ct = [schema typeForName:@"description"]; 64 | XCTAssert(ct); 65 | XCTAssert([[ct.attributes valueForKeyPath:@"name"] containsObject:@"id"]); 66 | XCTAssert(ct.hasAnnotations); 67 | } 68 | 69 | - (void)assertParsedXML:(id)rootNode { 70 | //TODO test 71 | NSLog(@"%@", [rootNode performSelector:@selector(dictionary)]); 72 | } 73 | 74 | #pragma mark - 75 | 76 | - (void)testCorrectnessParsingSchema { 77 | [self helpTestCorrectnessParsingSchema]; 78 | } 79 | 80 | - (void)testCorrectnessGeneratingParserObjC { 81 | [self helpTestCorrectnessGeneratingParserObjC]; 82 | } 83 | 84 | #pragma mark performance tests 85 | 86 | - (void)testPerformanceParsingSchema { 87 | [self helpTestPerformanceParsingSchema]; 88 | } 89 | 90 | - (void)testPerformanceLoadingTemplateObjC { 91 | [self helpTestPerformanceLoadingTemplateObjC]; 92 | } 93 | 94 | - (void)testPerformanceGeneratingParserObjC { 95 | [self helpTestPerformanceGeneratingParserObjC]; 96 | } 97 | 98 | - (void)testPerformanceParsingXMLObjC { 99 | [self helpTestPerformanceParsingXMLObjC]; 100 | } 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /framework/objects/XSDattribute.m: -------------------------------------------------------------------------------- 1 | /* 2 | XSDattribute.h 3 | The implementation of properties and methods for the XSDattribute object. 4 | Generated by SudzC.com 5 | */ 6 | #import "XSDattribute.h" 7 | #import "XSSchemaNode.h" 8 | #import "XSDschema.h" 9 | #import "XSType.h" 10 | #import "XMLUtils.h" 11 | #import "XSSimpleType.h" 12 | 13 | @interface XSDattribute () 14 | 15 | @property (strong, nonatomic) NSString* name; 16 | @property (strong, nonatomic) NSString* simpleType; 17 | @property (strong, nonatomic) NSString* type; 18 | @property (strong, nonatomic) id use; 19 | @property (strong, nonatomic) NSString* defaultValue; 20 | @property (strong, nonatomic) NSString* fixed; 21 | @property (strong, nonatomic) NSString* form; 22 | 23 | @end 24 | 25 | @implementation XSDattribute 26 | 27 | - (id) init 28 | { 29 | if(self = [super init]) { 30 | self.name = nil; 31 | self.simpleType = nil; 32 | self.type = nil; 33 | self.defaultValue = nil; 34 | self.fixed = nil; 35 | self.form = nil; 36 | 37 | } 38 | return self; 39 | } 40 | 41 | 42 | - (id) initWithNode: (NSXMLElement*) node schema: (XSDschema*) schema{ 43 | if(self = [super initWithNode:node schema:schema]) { 44 | self.name = [XMLUtils node:node stringAttribute:@"name"]; 45 | self.simpleType = [XMLUtils node:node stringAttribute:@"simpleType"]; 46 | self.type = [XMLUtils node:node stringAttribute:@"type"]; 47 | self.use = [XMLUtils node:node stringAttribute:@"use"]; 48 | self.defaultValue = [XMLUtils node:node stringAttribute:@"default"]; 49 | self.fixed = [XMLUtils node:node stringAttribute:@"fixed"]; 50 | self.form = [XMLUtils node:node stringAttribute:@"form"]; 51 | 52 | //specify string as default value 53 | if(!self.type) { 54 | NSLog(@"assign default tye xs:string to attribute %@", self.name); 55 | self.type = @"xs:string"; 56 | } 57 | } 58 | return self; 59 | } 60 | 61 | 62 | - (NSString*) codeType { 63 | return [self.schemaType targetClassName]; 64 | } 65 | 66 | - (NSString*) readCodeForAttribute { 67 | return [self.schemaType readCodeForAttribute: self]; 68 | } 69 | 70 | - (NSString*) variableName { 71 | return [XSDschema variableNameFromName:self.name multiple:NO]; 72 | } 73 | 74 | - (id)schemaType { 75 | return [self.schema typeForName: self.type]; 76 | } 77 | 78 | /* 79 | * Name: hasEnumeration 80 | * Parameters: None 81 | * Returns: BOOL value that will equate to 82 | * 0 - NO - False. 83 | * 1 - YES - True 84 | * Description: Will check the current element to see if the element type is associated 85 | * with an enumeration values. 86 | */ 87 | - (BOOL) hasEnumeration{ 88 | BOOL isEnumeration = NO; 89 | 90 | /* Grab the type and check if it is of a simple type element */ 91 | XSSimpleType* type = self.schemaType; 92 | if([type isKindOfClass:[XSSimpleType class]]) { 93 | /* ask the type */ 94 | isEnumeration = [type hasEnumeration]; 95 | } 96 | 97 | /* Return BOOL if we have enumerations */ 98 | return isEnumeration; 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /tests/SampleLanguageDataTestsSwift.m: -------------------------------------------------------------------------------- 1 | // 2 | // ASDATests.m 3 | // ASDATests 4 | // 5 | // Created by Dominik Pich on 22/12/14. 6 | // 7 | // 8 | 9 | #import 10 | #import "XSDTestCaseSwift.h" 11 | #import "XSDConverterCore.h" 12 | 13 | @interface SampleLanguageDataTestsSwift : XSDTestCaseSwift 14 | @end 15 | 16 | @implementation SampleLanguageDataTestsSwift 17 | 18 | + (void)setUp { 19 | [self helpSetUp]; 20 | } 21 | 22 | - (void)setUp { 23 | self.schemaName = @"SampleLanguageData"; 24 | self.xmlFileName = @"SampleLanguageData"; 25 | self.expectedFiles = @[@"libxml-bridging-header.h", 26 | @"LangDefType.swift", 27 | @"LangDefType+File.swift", 28 | @"LangIDType.swift"]; 29 | self.rootClassName = @"parser.LangDefType"; 30 | self.parseMethodName = @"LangDefTypeFromURL:"; 31 | 32 | [self helpSetUp]; 33 | [super setUp]; 34 | } 35 | 36 | - (void)tearDown { 37 | [self helpTearDown]; 38 | [super tearDown]; 39 | } 40 | 41 | + (void)tearDown { 42 | [self helpTearDown]; 43 | } 44 | 45 | - (void)assertSchema:(id)schema { 46 | XSDcomplexType *ct = [schema typeForName:@"LangDefType"]; 47 | XCTAssert(ct); 48 | XCTAssert([[ct.globalElements valueForKeyPath:@"name"] containsObject:@"LangDef"]); 49 | XCTAssert([[ct.sequenceOrChoice.elements valueForKeyPath:@"name"] containsObject:@"LangID"]); 50 | XCTAssert([[ct.attributes valueForKeyPath:@"name"] containsObject:@"langCode"]); 51 | XCTAssert(ct.hasAnnotations); 52 | 53 | ct = [schema typeForName:@"LangIDType"]; 54 | XCTAssert(ct); 55 | XCTAssert([[ct.attributes valueForKeyPath:@"name"] containsObject:@"ID"]); 56 | XCTAssert([[ct.attributes valueForKeyPath:@"name"] containsObject:@"Text"]); 57 | XCTAssert(ct.hasAnnotations); 58 | } 59 | 60 | - (void)assertParsedXML:(id)rootNode { 61 | NSString *langCode = [rootNode valueForKey:@"langCode"]; 62 | 63 | NSArray *LangIDs = [rootNode valueForKey:@"LangIDs"]; 64 | XCTAssertEqual(LangIDs.count, 7); 65 | NSArray *IDs = [LangIDs valueForKeyPath:@"ID"]; 66 | NSArray *Texts = [LangIDs valueForKeyPath:@"Text"]; 67 | XCTAssertEqual(IDs.count, Texts.count); 68 | 69 | NSString *first_name = nil; 70 | NSString *lastentry = nil; 71 | for(int i = 0; i < IDs.count; i++) { 72 | if([IDs[i] isEqualToString:@"first_name"]) 73 | first_name = Texts[i]; 74 | if([IDs[i] isEqualToString:@"lastentry"]) 75 | lastentry = Texts[i]; 76 | } 77 | 78 | XCTAssertTrue([langCode isEqualToString:@"0407"]); 79 | XCTAssertTrue([first_name isEqualToString:@"dominik"]); 80 | XCTAssertTrue([lastentry isEqualToString:@"zz"]); 81 | } 82 | 83 | #pragma mark - 84 | 85 | - (void)testCorrectnessParsingSchema { 86 | [self helpTestCorrectnessParsingSchema]; 87 | } 88 | 89 | - (void)testCorrectnessGeneratingParser { 90 | [self helpTestCorrectnessGeneratingParser]; 91 | } 92 | 93 | #pragma mark performance tests 94 | 95 | - (void)testPerformanceParsingSchema { 96 | [self helpTestPerformanceParsingSchema]; 97 | } 98 | 99 | - (void)testPerformanceLoadingTemplate { 100 | [self helpTestPerformanceLoadingTemplate]; 101 | } 102 | 103 | - (void)testPerformanceGeneratingParser { 104 | [self helpTestPerformanceGeneratingParser]; 105 | } 106 | 107 | - (void)testPerformanceParsingXML { 108 | [self helpTestPerformanceParsingXML]; 109 | } 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /framework/vendor/DDSimpleFormatter/DDSimpleFormatter.m: -------------------------------------------------------------------------------- 1 | // 2 | // SimpleFormatter.swift 3 | // simpleFormatter 4 | // 5 | // Created by Dominik Pich on 10/07/15. 6 | // Copyright (c) 2015 Dominik Pich. All rights reserved. 7 | // 8 | #import "DDSimpleFormatter.h" 9 | #import "NSString+PrefixSuffixFrom.h" 10 | 11 | #define stringsToIndent @[@"{"] 12 | #define stringsToOutdent @[@"}"] 13 | #define stringsToIgnore @[@"{{", @"}}", @"{%", @"%}"] 14 | #define stringForIndentation @" " 15 | 16 | @implementation DDSimpleFormatter 17 | 18 | + (instancetype)sharedInstance { 19 | static id instance = nil; 20 | static dispatch_once_t onceToken; 21 | dispatch_once(&onceToken, ^{ 22 | instance = [[[self class] alloc] init]; 23 | }); 24 | return instance; 25 | } 26 | 27 | - (NSString *)formatString:(NSString *)string { 28 | id set = [NSCharacterSet newlineCharacterSet]; 29 | id set2 = [NSCharacterSet whitespaceCharacterSet]; 30 | 31 | //get lines 32 | id lines = [string componentsSeparatedByCharactersInSet:set]; 33 | 34 | //do indentation run 35 | NSMutableString *newLines = [NSMutableString string]; 36 | int indent = 0; 37 | BOOL lastLineWasEmpty = false; 38 | for(id line in lines) { 39 | //first we trim it 40 | id trimmed = [line stringByTrimmingCharactersInSet:set2]; 41 | //skip double blanks 42 | if(![trimmed length]) { 43 | if(lastLineWasEmpty) { 44 | continue; 45 | } 46 | lastLineWasEmpty = true; 47 | } 48 | else { 49 | lastLineWasEmpty = false; 50 | } 51 | 52 | //we check if we OUTDENT 53 | if([trimmed hasPrefixFrom:stringsToOutdent]) { 54 | if(![trimmed hasSuffixFrom:stringsToIgnore]) { 55 | indent--; 56 | if(indent < 0) { 57 | indent = 0; 58 | } 59 | } 60 | } 61 | 62 | //assemble line 63 | for(int i=0; i 10 | #import "XSDTestCaseObjC.h" 11 | #import "XSDConverterCore.h" 12 | 13 | @interface SampleLanguageDataTestsObjC : XSDTestCaseObjC 14 | @end 15 | 16 | @implementation SampleLanguageDataTestsObjC 17 | 18 | + (void)setUp { 19 | [self helpSetUp]; 20 | } 21 | 22 | - (void)setUp { 23 | self.schemaName = @"SampleLanguageData"; 24 | self.xmlFileName = @"SampleLanguageData"; 25 | self.expectedFiles = @[@"LangDefType.h", 26 | @"LangDefType.m", 27 | @"LangDefType+File.h", 28 | @"LangDefType+File.m", 29 | @"LangIDType.h", 30 | @"LangIDType.m", 31 | @"SampleLanguageData.h"]; 32 | self.rootClassName = @"LangDefType"; 33 | self.parseMethodName = @"LangDefTypeFromURL:"; 34 | 35 | [self helpSetUp]; 36 | [super setUp]; 37 | } 38 | 39 | - (void)tearDown { 40 | [self helpTearDown]; 41 | [super tearDown]; 42 | } 43 | 44 | + (void)tearDown { 45 | [self helpTearDown]; 46 | } 47 | 48 | - (void)assertSchema:(id)schema { 49 | XSDcomplexType *ct = [schema typeForName:@"LangDefType"]; 50 | XCTAssert(ct); 51 | XCTAssert([[ct.globalElements valueForKeyPath:@"name"] containsObject:@"LangDef"]); 52 | XCTAssert([[ct.sequenceOrChoice.elements valueForKeyPath:@"name"] containsObject:@"LangID"]); 53 | XCTAssert([[ct.attributes valueForKeyPath:@"name"] containsObject:@"langCode"]); 54 | XCTAssert(ct.hasAnnotations); 55 | 56 | ct = [schema typeForName:@"LangIDType"]; 57 | XCTAssert(ct); 58 | XCTAssert([[ct.attributes valueForKeyPath:@"name"] containsObject:@"ID"]); 59 | XCTAssert([[ct.attributes valueForKeyPath:@"name"] containsObject:@"Text"]); 60 | XCTAssert(ct.hasAnnotations); 61 | } 62 | 63 | - (void)assertParsedXML:(id)rootNode { 64 | NSString *langCode = [rootNode valueForKey:@"langCode"]; 65 | 66 | NSArray *LangIDs = [rootNode valueForKey:@"LangIDs"]; 67 | XCTAssertEqual(LangIDs.count, 7); 68 | NSArray *IDs = [LangIDs valueForKeyPath:@"ID"]; 69 | NSArray *Texts = [LangIDs valueForKeyPath:@"Text"]; 70 | XCTAssertEqual(IDs.count, Texts.count); 71 | 72 | NSString *first_name = nil; 73 | NSString *lastentry = nil; 74 | for(int i = 0; i < IDs.count; i++) { 75 | if([IDs[i] isEqualToString:@"first_name"]) 76 | first_name = Texts[i]; 77 | if([IDs[i] isEqualToString:@"lastentry"]) 78 | lastentry = Texts[i]; 79 | } 80 | 81 | XCTAssertTrue([langCode isEqualToString:@"0407"]); 82 | XCTAssertTrue([first_name isEqualToString:@"dominik"]); 83 | XCTAssertTrue([lastentry isEqualToString:@"zz"]); 84 | } 85 | 86 | #pragma mark - 87 | 88 | - (void)testCorrectnessParsingSchema { 89 | [self helpTestCorrectnessParsingSchema]; 90 | } 91 | 92 | - (void)testCorrectnessGeneratingParser { 93 | [self helpTestCorrectnessGeneratingParser]; 94 | } 95 | 96 | #pragma mark performance tests 97 | 98 | - (void)testPerformanceParsingSchema { 99 | [self helpTestPerformanceParsingSchema]; 100 | } 101 | 102 | - (void)testPerformanceLoadingTemplate { 103 | [self helpTestPerformanceLoadingTemplate]; 104 | } 105 | 106 | - (void)testPerformanceGeneratingParser { 107 | [self helpTestPerformanceGeneratingParser]; 108 | } 109 | 110 | - (void)testPerformanceParsingXML { 111 | [self helpTestPerformanceParsingXML]; 112 | } 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /framework/vendor/MGTemplateEngine/MGTemplateStandardFilters.m: -------------------------------------------------------------------------------- 1 | // 2 | // MGTemplateStandardFilters.m 3 | // 4 | // Created by Matt Gemmell on 13/05/2008. 5 | // Copyright 2008 Instinctive Code. All rights reserved. 6 | // 7 | #import 8 | 9 | #import "MGTemplateStandardFilters.h" 10 | 11 | 12 | #define UPPERCASE @"uppercase" 13 | #define LOWERCASE @"lowercase" 14 | #define CAPITALIZED @"capitalized" 15 | #define DATE_FORMAT @"date_format" 16 | #define COLOR_FORMAT @"color_format" 17 | 18 | 19 | @implementation MGTemplateStandardFilters 20 | 21 | 22 | - (NSArray *)filters 23 | { 24 | return [NSArray arrayWithObjects: 25 | UPPERCASE, LOWERCASE, CAPITALIZED, 26 | DATE_FORMAT, COLOR_FORMAT, 27 | nil]; 28 | } 29 | 30 | 31 | - (id)filterInvoked:(NSString *)filter withArguments:(NSArray *)args onValue:(id)value 32 | { 33 | if ([filter isEqualToString:UPPERCASE]) { 34 | return [[NSString stringWithFormat:@"%@", value] uppercaseString]; 35 | 36 | } else if ([filter isEqualToString:LOWERCASE]) { 37 | return [[NSString stringWithFormat:@"%@", value] lowercaseString]; 38 | 39 | } else if ([filter isEqualToString:CAPITALIZED]) { 40 | return [[NSString stringWithFormat:@"%@", value] capitalizedString]; 41 | 42 | } else if ([filter isEqualToString:DATE_FORMAT]) { 43 | // Formats NSDates according to Unicode syntax: 44 | // http://unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns 45 | // e.g. "dd MM yyyy" etc. 46 | if ([value isKindOfClass:[NSDate class]] && [args count] == 1) { 47 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; 48 | [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; 49 | NSString *format = [args objectAtIndex:0]; 50 | [dateFormatter setDateFormat:format]; 51 | return [dateFormatter stringFromDate:(NSDate *)value]; 52 | } 53 | 54 | } else if ([filter isEqualToString:COLOR_FORMAT]) { 55 | #if TARGET_OS_IPHONE 56 | if ([value isKindOfClass:[UIColor class]] && [args count] == 1) { 57 | #else 58 | if ([value isKindOfClass:[NSColor class]] && [args count] == 1) { 59 | #endif 60 | NSString *format = [[args objectAtIndex:0] lowercaseString]; 61 | if ([format isEqualToString:@"hex"]) { 62 | // Output color in hex format RRGGBB (without leading # character). 63 | #if TARGET_OS_IPHONE 64 | CGColorRef color = [(UIColor *)value CGColor]; 65 | CGColorSpaceRef colorSpace = CGColorGetColorSpace(color); 66 | CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace); 67 | 68 | if (colorSpaceModel != kCGColorSpaceModelRGB) 69 | return @"000000"; 70 | 71 | const CGFloat *components = CGColorGetComponents(color); 72 | NSString *colorHex = [NSString stringWithFormat:@"%02x%02x%02x", 73 | (unsigned int)(components[0] * 255), 74 | (unsigned int)(components[1] * 255), 75 | (unsigned int)(components[2] * 255)]; 76 | return colorHex; 77 | #else 78 | NSColor *color = [(NSColor *)value colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; 79 | if (!color) { // happens if the colorspace couldn't be converted 80 | return @"000000"; // black 81 | } else { 82 | NSString *colorHex = [NSString stringWithFormat:@"%02x%02x%02x", 83 | (unsigned int)([color redComponent] * 255), 84 | (unsigned int)([color greenComponent] * 255), 85 | (unsigned int)([color blueComponent] * 255)]; 86 | return colorHex; 87 | } 88 | #endif 89 | } 90 | } 91 | 92 | } 93 | 94 | return value; 95 | } 96 | 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /demos/MyPantry-demo/MyPantry-ios/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /demos/weblinks-demo/weblinks-ios/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | --------------------------------------------------------------------------------