<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Ok, after trying to get this building on Linux, I have discovered what you mean. I have gotten it building successfully on Linux, unfortunately this required changes to build settings in other modules, because /usr/include/libxml2 wasn’t being added to the search locations. And this then results in needing to add “-I/usr/include/libxml2” to the command line any time you want to build anything using Foundation! (including just typing “import Foundation” in the REPL, heh). Which is obviously less than ideal. There is already an implementation for all this stuff in CoreFoundation, but it’s marked as being deprecated as of OS X 10.6, with a note to use NSXMLDocument (or libxml2) instead! Not exactly a helpful recommendation when you’re implementing NSXMLDocument heh. Should I just add wrappers in CFXMLInterface for the libxml2 functions I need? That might be the easiest way to just get everything building with minimal changes to other modules.<div class=""><br class=""></div><div class=""><div class="">Thanks,</div><div class="">Robert Thompson</div><div class="">Software Engineer<br class="">WillowTree, Inc.®<br class=""><a href="http://willowtreeapps.com" class="">willowtreeapps.com</a><br class="">&nbsp;<img apple-inline="yes" id="04E7F687-DF28-42E5-8E55-550C920828C1" height="40" width="183" apple-width="yes" apple-height="yes" src="cid:04F0A8D2-F0EB-4FC5-9305-30B7966DFEA6@willowtree.lan" class=""></div></div><div class=""><p style="margin: 0px; font-size: 13px; line-height: normal; font-family: Arial; color: rgb(26, 26, 26); -webkit-text-stroke-color: rgb(26, 26, 26); -webkit-text-stroke-width: initial; min-height: 15px;" class=""><br class="webkit-block-placeholder"></p><div><blockquote type="cite" class=""><div class="">On Dec 18, 2015, at 8:05 PM, Philippe Hausler &lt;<a href="mailto:phausler@apple.com" class="">phausler@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Dealing with the cross platform part of the module map portion may be a bit tricky; I had to use some of libxml2 for CFXMLInterface it is effectively a simple wrapper around a few xml c calls that are a bit swift-friendlier. Perhaps that might make some of that integration easier. However if you do find a decent way of dealing with the module map differentials between linux and mac os x I would be interested to see if we could improve the state of affairs in that bridged portion.<div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 18, 2015, at 2:33 PM, Robert Stephen Thompson via swift-corelibs-dev &lt;<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Ok, sounds good to me. I have quite a bit done at this point, but it’s not “pretty enough” for a real PR yet. If people really want to look at the ugliness,&nbsp;</span><a href="https://github.com/rothomp3/swift-corelibs-foundation/tree/feature/NSXMLDocument" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://github.com/rothomp3/swift-corelibs-foundation/tree/feature/NSXMLDocument</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>is where it lives.</span><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Thanks,</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Robert<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 18, 2015, at 1:58 PM, Tony Parker &lt;<a href="mailto:anthony.parker@apple.com" class="">anthony.parker@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Robert,<div class=""><br class=""></div><div class="">There actually already is some discussion on the swift-evolution list about a language feature to enable factory methods, which would help us to implement these kinds of things. It is a common pattern in Foundation to return subclasses from initializers (NSNull, NSPredicate are in the same boat, among many others), so I’m hoping we can get that one moving along soon. If you can find that thread, go ahead and reply to it with additional justification if you want.</div><div class=""><br class=""></div><div class="">I think we should try to move forward on this as if we’ll eventually get that feature. It’s pretty clear that we need it. We may need to work on other parts of the implementation first until we get it.</div><div class=""><br class=""></div><div class="">- Tony</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Dec 18, 2015, at 9:21 AM, Robert Stephen Thompson via swift-corelibs-dev &lt;<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Since I recently did a small implementation of NSXMLNode and NSXMLDocument to use in an iOS project, I decided to tackle doing the full-featured one here. It’s not that hard, doing it as a wrapper on libxml2, except I’ve run into a bit of a snag with making the semantics exactly match Darwin Foundation: you can’t return a subclass from init! This really only matters in one place, but it matters quite a bit there. The de facto designated initializer for<span class="Apple-converted-space">&nbsp;</span><font face="Courier" class="">NSXMLNode</font><span class="Apple-converted-space">&nbsp;</span>is<span class="Apple-converted-space">&nbsp;</span><font face="Courier" class="">init(kind: NSXMLNodeKind, options: Int)</font>. In pure Swift, this<span class="Apple-converted-space">&nbsp;</span><i class="">always</i>&nbsp;returns an NSXMLNode, not the appropriate subclass! Which, of course, means<span class="Apple-converted-space">&nbsp;</span><font face="Courier" class="">as?</font><span class="Apple-converted-space">&nbsp;</span>returns nil,<span class="Apple-converted-space">&nbsp;</span><font face="Courier" class="">as!</font><span class="Apple-converted-space">&nbsp;</span>(and<span class="Apple-converted-space">&nbsp;</span><font face="Courier" class="">unsafeDowncast</font>) crash, etc, when you end up trying to retrieve one and treat it as the subclass it’s “supposed” to be. I’m completely stumped as to any way around this. It might be that it’s just impossible to match Darwin Foundation semantics without a new language feature for this, which obviously would have to go through swift-evolution and then actually be implemented. Am I correct, or is there something I’m missing? Also, should I go ahead and implement the rest of this without the exactly matching semantics because something is better than nothing?<div class=""><br class=""></div><div class="">Thanks,</div><div class="">Robert Thompson</div><div class="">Software Engineer<br class="">WillowTree, Inc.®<br class=""><a href="http://willowtreeapps.com/" class="">willowtreeapps.com</a><br class="">&nbsp;<span id="cid:04F0A8D2-F0EB-4FC5-9305-30B7966DFEA6@willowtree.lan" class="">&lt;PastedGraphic-1.png&gt;</span></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=U7z7oSqRMSwdl2rYt9JJ4zIFaeg4R-2FxExg9xndDuCbwG4yAqzPkDteiTViT6V-2BTvZAbNDMfSbBWsfmp00iZPNbJyObQ6Dr59KOzIugJYcT1mRYsdyLWOSldDG-2Fl7vQDNBvOdWuKSZ-2BV-2Bp9SkLYYCLtYU0SH-2BqIsp6Ld3Vc1r1-2FF5roHk-2F7WYdBmiEwZEsYhMdHi6enMAEuC3HOtLXBCPdJWMOY0DiiwpwBEOWB4BtMU-3D" alt="" width="1" height="1" border="0" class="" style="height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;"></div>_______________________________________________<br class="">swift-corelibs-dev mailing list<br class=""><a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-corelibs-dev" class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=0mkChau6XnFV-2FCNUik62L9ZaldD0W0ziOwj-2F3jLx36-2FfL-2FEBv-2F4P38anBy554j153HCrdTeNc1hjQFpsNtuhrLXKuSci0raaQUPxsA1ytwfK4CDYubqYbnUsTjgWhN04y0pTaB1PCF7HhW-2Fvq-2F-2BxT9MyICU0-2BM4UBokcMklNahHz7xRLOdPhTOleOIe4B3exE5-2FrI6J-2FwkcEcy1L8SekvWEm-2Bb60sOf5euQlKZvth9k-3D" alt="" width="1" height="1" border="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span></span><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-corelibs-dev mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-corelibs-dev@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-corelibs-dev@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-corelibs-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev</a></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></body></html>