Objective c NSXMLParser只读取一半的属性

Objective c NSXMLParser只读取一半的属性,objective-c,cocoa,nsxmlparser,Objective C,Cocoa,Nsxmlparser,我只得到前五个值,其余值返回为null 以下是XML: <?xml version="1.0"?> <ResourceManifest> <Resources id="princessanimation"> <SetDefaults path="images" imageprefix="card_"> <Atlas id="1">

我只得到前五个值,其余值返回为null

以下是XML:

<?xml version="1.0"?>
       <ResourceManifest>
           <Resources id="princessanimation">
               <SetDefaults path="images" imageprefix="card_">
                    <Atlas id="1">
                        <?xml version="1.0"?>
                            <ResourceManifest>
                                <Resources id="cardlist">
                                    <SetDefaults path="images" imageprefix="card_">
                                    <Atlas id="1">
                                        <AtlasEntry id="card1" x="0" y="950.0" w="180" h="250", a="2", d="3", name="Teresa Voldheart", team="horde" />
                                        <AtlasEntry id="card2" x="185.0" y="950.0" w="180" h="250", a="3", d="3", name="Nurgle Tinkfrost", team="alliance"/>
                                        <AtlasEntry id="card3" x="368.0" y="950.0" w="180" h="250", a="3", d="6", name="Nethermaven Donna Chastain", team="alliance"/>
                                        <AtlasEntry id="card4" x="550.0" y="950.0" w="180" h="250", a="2", d="3", name="Vindicator Bellan", team="alliance" />
                                        <AtlasEntry id="card5" x="735.0" y="950.0" w="180" h="250", a="3", d="2", name="Blizzaz", team="alliance"/>
                                        <AtlasEntry id="card6" x="917.0" y="950.0" w="180" h="250", a="3", d="3", name="'Fungus Face' McGuillicutty", team="horde" />
                                        <AtlasEntry id="card7" x="1097.0" y="950.0" w="180" h="250", a="2", d="1", name="Magister Ashi", team="horde" />
                                        <AtlasEntry id="card8" x="1277.0" y="950.0" w="180" h="250", a="2", d="3", name="Vesperia Silversong", team="alliance" />
                                        <AtlasEntry id="card9" x="1470.0" y="950.0" w="180" h="250", a="5", d="5", name="Conqueror Yun'zon", team="horde" />
                                        <AtlasEntry id="card10" x="0.0" y="694.0" w="180" h="250", a="2", d="1", name="Scaramanga", team="alliance" />
                                        <AtlasEntry id="card11" x="185.0" y="694.0" w="180" h="250", a="2", d="5", name="Commander Falstaav", team="alliance" />
                                        <AtlasEntry id="card12" x="368.0" y="694.0" w="180" h="250", a="3", d="6", name="Lilnas the Calm", team="alliance" />
                                        <AtlasEntry id="card13" x="550.0" y="694.0" w="180" h="250", a="2", d="1", name="Routeen", team="alliance" />
                                        <AtlasEntry id="card14" x="735.0" y="694.0" w="180" h="250", a="1", d="1", name="Retainer Kedryn", team="alliance" />
                                        <AtlasEntry id="card15" x="917.0" y="694.0" w="180" h="250", a="1", d="4", name="Lady Courtney Noel", team="alliance" />
                                        <AtlasEntry id="card16" x="1097.0" y="694.0" w="180" h="250", a="5", d="5", name="Osha Shadowdrinker", team="horde" />
                                        <AtlasEntry id="card17" x="1277.0" y="694.0" w="180" h="250", a="6", d="5", name="Vanda Skydaughter", team="horde" />
                                        <AtlasEntry id="card16" x="1470.0" y="694.0" w="180" h="250", a="3", d="3", name="'Posion Tongue' McGillicutty", team="horde" />
                                    </Atlas>
                                </SetDefaults>
                            </Resources>
                        </ResourceManifest>
                    </Atlas>
                </SetDefaults>
            </Resources>
        </ResourceManifest>

我做错什么了吗

您的
AtlasEntry
项不是有效的XML。属性之间不能有逗号;这会导致一个解析错误,这就是为什么要返回null

比如说,

<AtlasEntry id="card16" x="1470.0" y="694.0" w="180" h="250", a="3", d="3", name="'Posion Tongue' McGillicutty", team="horde" />

应该是

<AtlasEntry id="card16" x="1470.0" y="694.0" w="180" h="250" a="3" d="3" name="'Posion Tongue' McGillicutty" team="horde" />


修复所有
AtlasEntry
项目的问题,您就可以开始了。

您的
AtlasEntry
项目不是有效的XML。属性之间不能有逗号;这会导致一个解析错误,这就是为什么要返回null

<AtlasEntry id="card1" x="0" y="950.0" w="180" h="250", a="2", d="3", name="Teresa Voldheart", team="horde" />
比如说,

<AtlasEntry id="card16" x="1470.0" y="694.0" w="180" h="250", a="3", d="3", name="'Posion Tongue' McGillicutty", team="horde" />

应该是

<AtlasEntry id="card16" x="1470.0" y="694.0" w="180" h="250" a="3" d="3" name="'Posion Tongue' McGillicutty" team="horde" />

为您的所有
AtlasEntry
项目修复该问题,您应该可以开始了。


<AtlasEntry id="card1" x="0" y="950.0" w="180" h="250", a="2", d="3", name="Teresa Voldheart", team="horde" />
这是无效的XML,属性之间不应该有逗号,请查看到达第一个逗号时解析器中的值是如何停止的。我很惊讶解析器没有将此报告为错误。



这是无效的XML,属性之间不应该有逗号,请查看到达第一个逗号时解析器中的值是如何停止的。我很惊讶解析器没有将此报告为错误。

duh。我不知道是我干的。你曾经看着某件事,只是出于某种原因认为它是对的,即使你知道得更好。谢谢。我不知道是我干的。你曾经看着某件事,只是出于某种原因认为它是对的,即使你知道得更好。谢谢