Skip to content

Commit

Permalink
search ref in simple types (Daij-Djan#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
anivaros committed Dec 28, 2016
1 parent 4d2b5c6 commit cc8819a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 3 additions & 2 deletions framework/XSDschema.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ - (id) initWithNode:(NSXMLElement*)node targetNamespacePrefix:(NSString*)prefix
/* Add basic simple types known in the built-in types */
for(XSSimpleType *aSimpleType in [XSSimpleType knownSimpleTypesForSchema:self]) {
[_knownSimpleTypeDict setValue: aSimpleType forKey: aSimpleType.name];
[((NSMutableArray*)self.simpleTypes) addObject:aSimpleType];
}

/* Add custom simple types */
Expand Down Expand Up @@ -184,9 +185,9 @@ - (id) initWithNode:(NSXMLElement*)node targetNamespacePrefix:(NSString*)prefix
for (XSDelement* anElement in globalElements) {
id<XSType> aType = [anElement schemaType];
/* For the type check if it is in our found complex types */
if( [aType isMemberOfClass: [XSDcomplexType class]]) {
// if( [aType isMemberOfClass: [XSDcomplexType class]]) {
((XSDcomplexType*)aType).globalElements = [((XSDcomplexType*)aType).globalElements arrayByAddingObject: anElement];
}
// }
}
}

Expand Down
1 change: 1 addition & 0 deletions framework/XSType.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- (NSString*) name;
- (NSString*) baseType;
- (NSArray*) attributes;
- (NSArray*) globalElements;

//parsing

Expand Down
3 changes: 2 additions & 1 deletion framework/objects/XSSimpleType.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
@property (readonly, nonatomic) NSString* readPrefixCode;
@property (readonly, nonatomic) NSArray* includes;
@property (strong, nonatomic) NSArray* enumerations;
@property (readonly, nonatomic) NSArray* globalElements;

- (BOOL)supplyTemplates:(NSXMLElement *)element enumTypeNode:(NSXMLNode*)enumTypeNode error:(NSError *__autoreleasing *)error;
- (NSDictionary*) substitutionDict;
Expand All @@ -46,4 +47,4 @@

@end

extern BOOL gUnitTestingSwiftCode; //swift 2 workaround
extern BOOL gUnitTestingSwiftCode; //swift 2 workaround
12 changes: 11 additions & 1 deletion framework/objects/XSSimpleType.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,22 @@ @interface XSSimpleType ()
@property (strong, nonatomic) NSString* enumReadValueCode;
@property (strong, nonatomic) NSString* enumReadPrefixCode;

@property (strong, nonatomic) NSArray* globalElements;

@end

@implementation XSSimpleType {
MGTemplateEngine *engine;
}

- (instancetype)init {
self = [super init];
if (self) {
_globalElements = [NSMutableArray array];
}
return self;
}

- (id) initWithNode:(NSXMLElement*)node schema:(XSDschema*)schema {
self = [super initWithNode:node schema:schema];
/* Continute to add items to the extended XSSchemaNode class */
Expand Down Expand Up @@ -381,4 +391,4 @@ + (NSArray *)knownSimpleTypesForSchema:(XSDschema*)schema {

@end

BOOL gUnitTestingSwiftCode = NO; //swift 2 workaround
BOOL gUnitTestingSwiftCode = NO; //swift 2 workaround

0 comments on commit cc8819a

Please sign in to comment.