Created
January 29, 2012 03:06
-
-
Save GenjiApp/1696941 to your computer and use it in GitHub Desktop.
既存のものと同名のネームスペースを addNamespace すると、Snow Leopard 環境で Segmentation fault になる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Cocoa/Cocoa.h> | |
int main(void) | |
{ | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSURL *fileURL = [NSURL fileURLWithPath:@"test.html"]; | |
NSXMLDocument *xmlDoc = [[NSXMLDocument alloc] initWithContentsOfURL:fileURL | |
options:NSXMLDocumentTidyXML | |
error:nil]; | |
NSXMLNode *namespaceNode = [NSXMLNode namespaceWithName:@"epub" | |
stringValue:@"http://www.idpf.org/2007/opf"]; | |
NSXMLElement *rootElement = [xmlDoc rootElement]; | |
/* | |
* In Lion, this statement is done normally. | |
* In Snow Leopard, "Segmentation fault" occurs. | |
*/ | |
[rootElement addNamespace:namespaceNode]; | |
NSLog(@"%@", rootElement); | |
[xmlDoc release]; | |
[pool release]; | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html xmlns:epub="http://www.idpf.org/2007/opf" lang="ja"> | |
<head> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment