cleaned up some more things

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/nsxml_using_libxml2@34507 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2012-01-12 22:41:55 +00:00
parent 8772885b71
commit a9e3ce01aa
3 changed files with 42 additions and 10 deletions

View file

@ -59,7 +59,10 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
- (NSString*) characterEncoding
{
return [NSString stringWithUTF8String: (const char *)MY_DOC->encoding];
if (MY_DOC->encoding)
return [NSString stringWithUTF8String: (const char *)MY_DOC->encoding];
else
return nil;
}
- (NSXMLDocumentContentKind) documentContentKind
@ -108,7 +111,10 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
/* Create holder for internal instance variables so that we'll have
* all our ivars available rather than just those of the superclass.
*/
GS_CREATE_INTERNAL(NSXMLDocument)
xmlChar *version = (xmlChar *)"1.0";
GS_CREATE_INTERNAL(NSXMLDocument);
internal->node = xmlNewDoc(version);
MY_DOC->_private = (void *)self;
}
return [super initWithKind: kind options: theOptions];
}
@ -226,7 +232,7 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
{
if ([version isEqualToString: @"1.0"] || [version isEqualToString: @"1.1"])
{
MY_DOC->version = [version UTF8String];
MY_DOC->version = XMLStringCopy(version);
}
else
{
@ -237,7 +243,10 @@ GS_PRIVATE_INTERNAL(NSXMLDocument)
- (NSString*) version
{
return [NSString stringWithUTF8String: MY_DOC->version];
if (MY_DOC->version)
return StringFromXMLStringPtr(MY_DOC->version);
else
return @"1.0";
}
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index