Skip to content

Commit bdaad69

Browse files
author
Robert Thompson
committed
Address concerns from PR# 1052
Change names of CoreFoundation-level xml functions to better conform to CoreFoundation naming conventions, and eliminate thusly unnecessary CF_RETURNS_RETAINED macros.
1 parent 1361086 commit bdaad69

File tree

8 files changed

+73
-74
lines changed

8 files changed

+73
-74
lines changed

CoreFoundation/Parsing.subproj/CFXMLInterface.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ _CFXMLNodePtr _CFXMLNewProperty(_CFXMLNodePtr node, const unsigned char* name, c
362362
return xmlNewProp(node, name, value);
363363
}
364364

365-
CF_RETURNS_RETAINED CFStringRef _CFXMLNodeURI(_CFXMLNodePtr node) {
365+
CFStringRef _CFXMLNodeCopyURI(_CFXMLNodePtr node) {
366366
xmlNodePtr nodePtr = (xmlNodePtr)node;
367367
switch (nodePtr->type) {
368368
case XML_ATTRIBUTE_NODE:
@@ -469,7 +469,7 @@ static inline xmlChar* _getQName(xmlNodePtr node) {
469469
return xmlBuildQName(ncname, prefix, NULL, 0);
470470
}
471471

472-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNodeGetName(_CFXMLNodePtr node) {
472+
CFStringRef _Nullable _CFXMLNodeCopyName(_CFXMLNodePtr node) {
473473
xmlNodePtr xmlNode = (xmlNodePtr)node;
474474

475475
xmlChar* qName = _getQName(xmlNode);
@@ -489,7 +489,7 @@ void _CFXMLNodeSetName(_CFXMLNodePtr node, const char* name) {
489489
xmlNodeSetName(node, (const xmlChar*)name);
490490
}
491491

492-
CFStringRef _CFXMLNodeGetContent(_CFXMLNodePtr node) {
492+
CFStringRef _CFXMLNodeCopyContent(_CFXMLNodePtr node) {
493493
switch (((xmlNodePtr)node)->type) {
494494
case XML_ELEMENT_DECL:
495495
{
@@ -681,7 +681,7 @@ void _CFXMLDocSetRootElement(_CFXMLDocPtr doc, _CFXMLNodePtr node) {
681681
xmlDocSetRootElement(doc, node);
682682
}
683683

684-
CF_RETURNS_RETAINED CFStringRef _CFXMLDocCharacterEncoding(_CFXMLDocPtr doc) {
684+
CFStringRef _CFXMLDocCopyCharacterEncoding(_CFXMLDocPtr doc) {
685685
return CFStringCreateWithCString(NULL, (const char*)((xmlDocPtr)doc)->encoding, kCFStringEncodingUTF8);
686686
}
687687

@@ -695,7 +695,7 @@ void _CFXMLDocSetCharacterEncoding(_CFXMLDocPtr doc, const unsigned char* _Null
695695
docPtr->encoding = xmlStrdup(encoding);
696696
}
697697

698-
CF_RETURNS_RETAINED CFStringRef _CFXMLDocVersion(_CFXMLDocPtr doc) {
698+
CFStringRef _CFXMLDocCopyVersion(_CFXMLDocPtr doc) {
699699
return CFStringCreateWithCString(NULL, (const char*)((xmlDocPtr)doc)->version, kCFStringEncodingUTF8);
700700
}
701701

@@ -782,7 +782,7 @@ _CFXMLEntityPtr _CFXMLGetParameterEntity(_CFXMLDocPtr doc, const char* entity) {
782782
return xmlGetParameterEntity(doc, (const xmlChar*)entity);
783783
}
784784

785-
CFStringRef _CFXMLGetEntityContent(_CFXMLEntityPtr entity) {
785+
CFStringRef _CFXMLCopyEntityContent(_CFXMLEntityPtr entity) {
786786
const xmlChar* content = ((xmlEntityPtr)entity)->content;
787787
if (!content) {
788788
return NULL;
@@ -794,7 +794,7 @@ CFStringRef _CFXMLGetEntityContent(_CFXMLEntityPtr entity) {
794794
return result;
795795
}
796796

797-
CFStringRef _CFXMLStringWithOptions(_CFXMLNodePtr node, uint32_t options) {
797+
CFStringRef _CFXMLCopyStringWithOptions(_CFXMLNodePtr node, uint32_t options) {
798798
if (((xmlNodePtr)node)->type == XML_ENTITY_DECL &&
799799
((xmlEntityPtr)node)->etype == XML_INTERNAL_PREDEFINED_ENTITY) {
800800
// predefined entities need special handling, libxml2 just tosses an error and returns a NULL string
@@ -866,7 +866,7 @@ CFStringRef _CFXMLStringWithOptions(_CFXMLNodePtr node, uint32_t options) {
866866
return result;
867867
}
868868

869-
CF_RETURNS_RETAINED CFArrayRef _CFXMLNodesForXPath(_CFXMLNodePtr node, const unsigned char* xpath) {
869+
CFArrayRef _CFXMLNodesForXPath(_CFXMLNodePtr node, const unsigned char* xpath) {
870870

871871
if (((xmlNodePtr)node)->doc == NULL) {
872872
return NULL;
@@ -899,7 +899,7 @@ CF_RETURNS_RETAINED CFArrayRef _CFXMLNodesForXPath(_CFXMLNodePtr node, const uns
899899
return results;
900900
}
901901

902-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLPathForNode(_CFXMLNodePtr node) {
902+
CFStringRef _Nullable _CFXMLCopyPathForNode(_CFXMLNodePtr node) {
903903
xmlChar* path = xmlGetNodePath(node);
904904
CFStringRef result = CFStringCreateWithCString(NULL, (const char*)path, kCFStringEncodingUTF8);
905905
xmlFree(path);
@@ -933,7 +933,7 @@ _CFXMLDocPtr _CFXMLDocPtrFromDataWithOptions(CFDataRef data, int options) {
933933
return xmlReadMemory((const char*)CFDataGetBytePtr(data), CFDataGetLength(data), NULL, NULL, xmlOptions);
934934
}
935935

936-
CF_RETURNS_RETAINED CFStringRef _CFXMLNodeLocalName(_CFXMLNodePtr node) {
936+
CFStringRef _CFXMLNodeCopyLocalName(_CFXMLNodePtr node) {
937937
xmlChar* prefix = NULL;
938938
const xmlChar* result = xmlSplitQName2(_getQName((xmlNodePtr)node), &prefix);
939939
if (result == NULL) {
@@ -943,7 +943,7 @@ CF_RETURNS_RETAINED CFStringRef _CFXMLNodeLocalName(_CFXMLNodePtr node) {
943943
return CFStringCreateWithCString(NULL, (const char*)result, kCFStringEncodingUTF8);
944944
}
945945

946-
CF_RETURNS_RETAINED CFStringRef _CFXMLNodePrefix(_CFXMLNodePtr node) {
946+
CFStringRef _CFXMLNodeCopyPrefix(_CFXMLNodePtr node) {
947947
xmlChar* result = NULL;
948948
xmlChar* unused = xmlSplitQName2(_getQName((xmlNodePtr)node), &result);
949949

@@ -1040,7 +1040,7 @@ _CFXMLDTDPtr _Nullable _CFXMLParseDTDFromData(CFDataRef data, CFErrorRef _Nullab
10401040
return dtd;
10411041
}
10421042

1043-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDTDExternalID(_CFXMLDTDPtr dtd) {
1043+
CFStringRef _Nullable _CFXMLDTDCopyExternalID(_CFXMLDTDPtr dtd) {
10441044
const unsigned char* externalID = ((xmlDtdPtr)dtd)->ExternalID;
10451045
if (externalID) {
10461046
return CFStringCreateWithCString(NULL, (const char*)externalID, kCFStringEncodingUTF8);
@@ -1065,7 +1065,7 @@ void _CFXMLDTDSetExternalID(_CFXMLDTDPtr dtd, const unsigned char* externalID) {
10651065
dtdPtr->ExternalID = xmlStrdup(externalID);
10661066
}
10671067

1068-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDTDSystemID(_CFXMLDTDPtr dtd) {
1068+
CFStringRef _Nullable _CFXMLDTDCopySystemID(_CFXMLDTDPtr dtd) {
10691069
const unsigned char* systemID = ((xmlDtdPtr)dtd)->SystemID;
10701070
if (systemID) {
10711071
return CFStringCreateWithCString(NULL, (const char*)systemID, kCFStringEncodingUTF8);
@@ -1152,7 +1152,7 @@ CFIndex _CFXMLDTDAttributeNodeGetType(_CFXMLDTDNodePtr node) {
11521152
return ((xmlAttributePtr)node)->atype;
11531153
}
11541154

1155-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDTDNodeGetSystemID(_CFXMLDTDNodePtr node) {
1155+
CFStringRef _Nullable _CFXMLDTDNodeCopySystemID(_CFXMLDTDNodePtr node) {
11561156
switch (((xmlNodePtr)node)->type) {
11571157
case XML_ENTITY_DECL:
11581158
return CFStringCreateWithCString(NULL, (const char*)((xmlEntityPtr)node)->SystemID, kCFStringEncodingUTF8);
@@ -1194,7 +1194,7 @@ void _CFXMLDTDNodeSetSystemID(_CFXMLDTDNodePtr node, const unsigned char* system
11941194
}
11951195
}
11961196

1197-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDTDNodeGetPublicID(_CFXMLDTDNodePtr node) {
1197+
CFStringRef _Nullable _CFXMLDTDNodeCopyPublicID(_CFXMLDTDNodePtr node) {
11981198
switch (((xmlNodePtr)node)->type) {
11991199
case XML_ENTITY_DECL:
12001200
return CFStringCreateWithCString(NULL, (const char*)((xmlEntityPtr)node)->ExternalID, kCFStringEncodingUTF8);
@@ -1237,7 +1237,7 @@ void _CFXMLDTDNodeSetPublicID(_CFXMLDTDNodePtr node, const unsigned char* public
12371237
}
12381238

12391239
// Namespaces
1240-
CF_RETURNS_RETAINED _CFXMLNodePtr _Nonnull * _Nullable _CFXMLNamespaces(_CFXMLNodePtr node, CFIndex* count) {
1240+
_CFXMLNodePtr _Nonnull * _Nullable _CFXMLNamespaces(_CFXMLNodePtr node, CFIndex* count) {
12411241
*count = 0;
12421242
xmlNs* ns = ((xmlNode*)node)->ns;
12431243
while (ns != NULL) {
@@ -1282,7 +1282,7 @@ void _CFXMLSetNamespaces(_CFXMLNodePtr node, _CFXMLNodePtr* _Nullable nodes, CFI
12821282
}
12831283
}
12841284

1285-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNamespaceGetValue(_CFXMLNodePtr node) {
1285+
CFStringRef _Nullable _CFXMLNamespaceCopyValue(_CFXMLNodePtr node) {
12861286
xmlNsPtr ns = ((xmlNode*)node)->ns;
12871287

12881288
if (ns->href == NULL) {
@@ -1297,7 +1297,7 @@ void _CFXMLNamespaceSetValue(_CFXMLNodePtr node, const char* value, int64_t leng
12971297
ns->href = xmlStrndup((const xmlChar*)value, length);
12981298
}
12991299

1300-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNamespaceGetPrefix(_CFXMLNodePtr node) {
1300+
CFStringRef _Nullable _CFXMLNamespaceCopyPrefix(_CFXMLNodePtr node) {
13011301
xmlNsPtr ns = ((xmlNodePtr)node)->ns;
13021302

13031303
if (ns->prefix == NULL) {

CoreFoundation/Parsing.subproj/CFXMLInterface.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ _CFXMLNodePtr _CFXMLNewTextNode(const unsigned char* value);
146146
_CFXMLNodePtr _CFXMLNewComment(const unsigned char* value);
147147
_CFXMLNodePtr _CFXMLNewProperty(_CFXMLNodePtr _Nullable node, const unsigned char* name, const unsigned char* value);
148148

149-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNodeURI(_CFXMLNodePtr node);
149+
CFStringRef _Nullable _CFXMLNodeCopyURI(_CFXMLNodePtr node);
150150
void _CFXMLNodeSetURI(_CFXMLNodePtr node, const unsigned char* _Nullable URI);
151151

152152
void _CFXMLNodeSetPrivateData(_CFXMLNodePtr node, void* data);
153153
void* _Nullable _CFXMLNodeGetPrivateData(_CFXMLNodePtr node);
154154
_CFXMLNodePtr _Nullable _CFXMLNodeProperties(_CFXMLNodePtr node);
155155
CFIndex _CFXMLNodeGetType(_CFXMLNodePtr node);
156-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNodeGetName(_CFXMLNodePtr node);
156+
CFStringRef _Nullable _CFXMLNodeCopyName(_CFXMLNodePtr node);
157157
void _CFXMLNodeSetName(_CFXMLNodePtr node, const char* name);
158-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNodeGetContent(_CFXMLNodePtr node);
158+
CFStringRef _Nullable _CFXMLNodeCopyContent(_CFXMLNodePtr node);
159159
void _CFXMLNodeSetContent(_CFXMLNodePtr node, const unsigned char* _Nullable content);
160160
void _CFXMLUnlinkNode(_CFXMLNodePtr node);
161161

@@ -176,9 +176,9 @@ bool _CFXMLDocStandalone(_CFXMLDocPtr doc);
176176
void _CFXMLDocSetStandalone(_CFXMLDocPtr doc, bool standalone);
177177
_CFXMLNodePtr _Nullable _CFXMLDocRootElement(_CFXMLDocPtr doc);
178178
void _CFXMLDocSetRootElement(_CFXMLDocPtr doc, _CFXMLNodePtr node);
179-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDocCharacterEncoding(_CFXMLDocPtr doc);
179+
CFStringRef _Nullable _CFXMLDocCopyCharacterEncoding(_CFXMLDocPtr doc);
180180
void _CFXMLDocSetCharacterEncoding(_CFXMLDocPtr doc, const unsigned char* _Nullable encoding);
181-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDocVersion(_CFXMLDocPtr doc);
181+
CFStringRef _Nullable _CFXMLDocCopyVersion(_CFXMLDocPtr doc);
182182
void _CFXMLDocSetVersion(_CFXMLDocPtr doc, const unsigned char* _Nullable version);
183183
int _CFXMLDocProperties(_CFXMLDocPtr doc);
184184
void _CFXMLDocSetProperties(_CFXMLDocPtr doc, int newProperties);
@@ -190,29 +190,29 @@ _CFXMLEntityPtr _Nullable _CFXMLGetDocEntity(_CFXMLDocPtr doc, const char* entit
190190
_CFXMLEntityPtr _Nullable _CFXMLGetDTDEntity(_CFXMLDocPtr doc, const char* entity);
191191
_CFXMLEntityPtr _Nullable _CFXMLGetParameterEntity(_CFXMLDocPtr doc, const char* entity);
192192

193-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLGetEntityContent(_CFXMLEntityPtr entity);
193+
CFStringRef _Nullable _CFXMLCopyEntityContent(_CFXMLEntityPtr entity);
194194

195-
CF_RETURNS_RETAINED CFStringRef _CFXMLStringWithOptions(_CFXMLNodePtr node, uint32_t options);
195+
CFStringRef _CFXMLCopyStringWithOptions(_CFXMLNodePtr node, uint32_t options);
196196

197197
CF_RETURNS_RETAINED CFArrayRef _Nullable _CFXMLNodesForXPath(_CFXMLNodePtr node, const unsigned char* xpath);
198-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLPathForNode(_CFXMLNodePtr node);
198+
CFStringRef _Nullable _CFXMLCopyPathForNode(_CFXMLNodePtr node);
199199

200200
_CFXMLNodePtr _Nullable _CFXMLNodeHasProp(_CFXMLNodePtr node, const char* propertyName);
201201

202202
_CFXMLDocPtr _CFXMLDocPtrFromDataWithOptions(CFDataRef data, int options);
203203

204-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNodeLocalName(_CFXMLNodePtr node);
205-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNodePrefix(_CFXMLNodePtr node);
204+
CFStringRef _Nullable _CFXMLNodeCopyLocalName(_CFXMLNodePtr node);
205+
CFStringRef _Nullable _CFXMLNodeCopyPrefix(_CFXMLNodePtr node);
206206

207207
bool _CFXMLDocValidate(_CFXMLDocPtr doc, CFErrorRef _Nullable * error);
208208

209209
_CFXMLDTDPtr _CFXMLNewDTD(_CFXMLDocPtr _Nullable doc, const unsigned char* name, const unsigned char* publicID, const unsigned char* systemID);
210210
_CFXMLDTDNodePtr _Nullable _CFXMLParseDTDNode(const unsigned char* xmlString);
211211
_CFXMLDTDPtr _Nullable _CFXMLParseDTD(const unsigned char* URL);
212212
_CFXMLDTDPtr _Nullable _CFXMLParseDTDFromData(CFDataRef data, CFErrorRef _Nullable * error);
213-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDTDExternalID(_CFXMLDTDPtr dtd);
213+
CFStringRef _Nullable _CFXMLDTDCopyExternalID(_CFXMLDTDPtr dtd);
214214
void _CFXMLDTDSetExternalID(_CFXMLDTDPtr dtd, const unsigned char* _Nullable externalID);
215-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDTDSystemID(_CFXMLDTDPtr dtd);
215+
CFStringRef _Nullable _CFXMLDTDCopySystemID(_CFXMLDTDPtr dtd);
216216
void _CFXMLDTDSetSystemID(_CFXMLDTDPtr dtd, const unsigned char* _Nullable systemID);
217217

218218
_CFXMLDTDNodePtr _Nullable _CFXMLDTDGetElementDesc(_CFXMLDTDPtr dtd, const unsigned char* name);
@@ -228,17 +228,17 @@ CFIndex _CFXMLDTDElementNodeGetType(_CFXMLDTDNodePtr node);
228228
CFIndex _CFXMLDTDEntityNodeGetType(_CFXMLDTDNodePtr node);
229229
CFIndex _CFXMLDTDAttributeNodeGetType(_CFXMLDTDNodePtr node);
230230

231-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDTDNodeGetSystemID(_CFXMLDTDNodePtr node);
231+
CFStringRef _Nullable _CFXMLDTDNodeCopySystemID(_CFXMLDTDNodePtr node);
232232
void _CFXMLDTDNodeSetSystemID(_CFXMLDTDNodePtr node, const unsigned char* _Nullable systemID);
233-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLDTDNodeGetPublicID(_CFXMLDTDNodePtr node);
233+
CFStringRef _Nullable _CFXMLDTDNodeCopyPublicID(_CFXMLDTDNodePtr node);
234234
void _CFXMLDTDNodeSetPublicID(_CFXMLDTDNodePtr node, const unsigned char* _Nullable publicID);
235235

236236
// Namespaces
237237
CF_RETURNS_RETAINED _CFXMLNodePtr _Nonnull * _Nullable _CFXMLNamespaces(_CFXMLNodePtr node, CFIndex* count);
238238
void _CFXMLSetNamespaces(_CFXMLNodePtr node, _CFXMLNodePtr _Nonnull * _Nullable nodes, CFIndex count);
239-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNamespaceGetValue(_CFXMLNodePtr node);
239+
CFStringRef _Nullable _CFXMLNamespaceCopyValue(_CFXMLNodePtr node);
240240
void _CFXMLNamespaceSetValue(_CFXMLNodePtr node, const char* _Nullable value, int64_t length);
241-
CF_RETURNS_RETAINED CFStringRef _Nullable _CFXMLNamespaceGetPrefix(_CFXMLNodePtr node);
241+
CFStringRef _Nullable _CFXMLNamespaceCopyPrefix(_CFXMLNodePtr node);
242242
void _CFXMLNamespaceSetPrefix(_CFXMLNodePtr node, const char* _Nullable prefix, int64_t length);
243243
_CFXMLNodePtr _CFXMLNewNamespace(const char* name, const char* stringValue);
244244
void _CFXMLAddNamespace(_CFXMLNodePtr node, _CFXMLNodePtr nsNode);

Foundation.xcodeproj/xcshareddata/xcschemes/TestFoundation.xcscheme

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@
8585
</TestAction>
8686
<LaunchAction
8787
buildConfiguration = "Debug"
88-
selectedDebuggerIdentifier = ""
89-
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
88+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
89+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
9090
launchStyle = "0"
9191
useCustomWorkingDirectory = "NO"
9292
ignoresPersistentStateOnLaunch = "NO"

Foundation/NSXMLDTD.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ open class XMLDTD : XMLNode {
5252
*/
5353
open var publicID: String? {
5454
get {
55-
return _CFXMLDTDExternalID(_xmlDTD)?._swiftObject
55+
return _CFXMLDTDCopyExternalID(_xmlDTD)?._swiftObject
5656
}
5757

5858
set {
@@ -70,7 +70,7 @@ open class XMLDTD : XMLNode {
7070
*/
7171
open var systemID: String? {
7272
get {
73-
return _CFXMLDTDSystemID(_xmlDTD)?._swiftObject
73+
return _CFXMLDTDCopySystemID(_xmlDTD)?._swiftObject
7474
}
7575

7676
set {

Foundation/NSXMLDTDNode.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ open class XMLDTDNode: XMLNode {
200200
*/
201201
open var publicID: String? {
202202
get {
203-
return _CFXMLDTDNodeGetPublicID(_xmlNode)?._swiftObject
203+
return _CFXMLDTDNodeCopyPublicID(_xmlNode)?._swiftObject
204204
}
205205
set {
206206
if let value = newValue {
@@ -217,7 +217,7 @@ open class XMLDTDNode: XMLNode {
217217
*/
218218
open var systemID: String? {
219219
get {
220-
return _CFXMLDTDNodeGetSystemID(_xmlNode)?._swiftObject
220+
return _CFXMLDTDNodeCopySystemID(_xmlNode)?._swiftObject
221221
}
222222
set {
223223
if let value = newValue {
@@ -238,7 +238,7 @@ open class XMLDTDNode: XMLNode {
238238
return nil
239239
}
240240

241-
return _CFXMLGetEntityContent(_xmlNode)?._swiftObject
241+
return _CFXMLCopyEntityContent(_xmlNode)?._swiftObject
242242
}
243243
set {
244244
guard dtdKind == .unparsed else {

Foundation/NSXMLDocument.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ open class XMLDocument : XMLNode {
124124
*/
125125
open var characterEncoding: String? {
126126
get {
127-
return _CFXMLDocCharacterEncoding(_xmlDoc)?._swiftObject
127+
return _CFXMLDocCopyCharacterEncoding(_xmlDoc)?._swiftObject
128128
}
129129
set {
130130
if let value = newValue {
@@ -141,7 +141,7 @@ open class XMLDocument : XMLNode {
141141
*/
142142
open var version: String? {
143143
get {
144-
return _CFXMLDocVersion(_xmlDoc)?._swiftObject
144+
return _CFXMLDocCopyVersion(_xmlDoc)?._swiftObject
145145
}
146146
set {
147147
if let value = newValue {

Foundation/NSXMLElement.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ open class XMLElement: XMLNode {
5252
public convenience init(xmlString string: String) throws {
5353
// If we prepend the XML line to the string
5454
let docString = """
55-
<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\(string)
55+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>\(string)
5656
"""
5757
// we can use the document string parser to get the element
5858
let doc = try XMLDocument(xmlString: docString, options: [])
@@ -85,7 +85,7 @@ open class XMLElement: XMLNode {
8585
@abstract Adds an attribute. Attributes with duplicate names are not added.
8686
*/
8787
open func addAttribute(_ attribute: XMLNode) {
88-
guard let name = _CFXMLNodeGetName(attribute._xmlNode)?._swiftObject else {
88+
guard let name = _CFXMLNodeCopyName(attribute._xmlNode)?._swiftObject else {
8989
fatalError("Attributes must have a name!")
9090
}
9191

0 commit comments

Comments
 (0)