iOS发生故事板冲突后XML标签不匹配

时间:2018-10-02 19:44:01

标签: ios xml storyboard

  <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qxz-gx-8Ik">
                                                <rect key="frame" x="275" y="5" width="30" height="33"/>
                                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qxz-gx-8Ik">
                                                    <rect key="frame" x="282" y="2" width="30" height="33"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <state key="normal" title="Edit">
                                                        <color key="titleColor" red="1" green="0.59999999999999998" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                                                    </state>
                                                    <connections>
                                                        <action selector="updateAction:" destination="akK-dA-Jb1" eventType="touchUpInside" id="UBU-1j-Tmg"/>
                                                    </connections>
                                                </button>
                                            </subviews>

我发生了情节提要合并冲突,并且选择保留远程分支的设置后,一些gitmerge文本被放入了我的情节提要的XML内容中,例如

头<<<<<<<< / p>

==========

和>>>>>>>

我删除了这些行,然后出现一条错误消息:

"Opening and ending tag mismatch : button line 1251 and subviews"

第1251行是我在此处发布的第一行,该行以button hidden =“ YES”开头

当我将XML放入诸如https://www.freeformatter.com/xml-formatter.html之类的格式化程序中时,它就是说:`

"Unable to parse any XML input. Error on line 13: The element type "button" must be terminated by the matching end-tag "</button>"." 

如何解决此错误?

1 个答案:

答案 0 :(得分:1)

您有“两个”按钮,那就是冲突。您需要删除前两行或删除下两行(第3和4行)。

<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qxz-gx-8Ik">
                                                    <rect key="frame" x="282" y="2" width="30" height="33"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <state key="normal" title="Edit">
                                                        <color key="titleColor" red="1" green="0.59999999999999998" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                                                    </state>
                                                    <connections>
                                                        <action selector="updateAction:" destination="akK-dA-Jb1" eventType="touchUpInside" id="UBU-1j-Tmg"/>
                                                    </connections>
                                                </button>
                                            </subviews> 

或:

<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qxz-gx-8Ik">
                                                <rect key="frame" x="275" y="5" width="30" height="33"/>
                                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <state key="normal" title="Edit">
                                                        <color key="titleColor" red="1" green="0.59999999999999998" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                                                    </state>
                                                    <connections>
                                                        <action selector="updateAction:" destination="akK-dA-Jb1" eventType="touchUpInside" id="UBU-1j-Tmg"/>
                                                    </connections>
                                                </button>
                                            </subviews>