Skip to content

Commit

Permalink
* fix for ns missing prefix or uri
Browse files Browse the repository at this point in the history
* range for NSXML
  • Loading branch information
itod committed May 29, 2015
1 parent b809c7e commit a462302
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions nsxml/XPNSXMLNodeImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ - (NSString *)namespaceURI {
}


- (NSRange)range {
return NSMakeRange(0, [[self.node XMLString] length]);
}


- (id <XPNodeInfo>)parent {
XPAssert(self.node);

Expand Down
13 changes: 10 additions & 3 deletions src/XPStandaloneContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ - (BOOL)defineUserFunction:(XPUserFunction *)fn error:(NSError **)outErr {
XPAssert([fn.name length]);
XPAssert(_userFunctions);

_userFunctions[fn.name] = fn;
if (fn && fn.name) {
_userFunctions[fn.name] = fn;
}

return YES;
}
Expand Down Expand Up @@ -291,7 +293,9 @@ - (void)declareSystemFunction:(Class)cls forName:(NSString *)name {
XPAssert([name length]);
XPAssert(_functions);

_functions[name] = cls;
if (name && cls) {
_functions[name] = cls;
}
}


Expand All @@ -303,7 +307,10 @@ - (void)declareNamespaceURI:(NSString *)uri forPrefix:(NSString *)prefix {
NSParameterAssert(uri);
NSParameterAssert(prefix);
XPAssert(_namespaces);
_namespaces[prefix] = uri;

if (prefix && uri) {
_namespaces[prefix] = uri;
}
}


Expand Down

0 comments on commit a462302

Please sign in to comment.