带有HTML标签的XML字符串

时间:2013-09-05 10:09:30

标签: iphone ios xml

我的问题很简单,就是如何解析包含id,br,code,href,Anchor等HTML标签的XML。现在我使用XMLReader获取dictonary,但由于tag而无法转换它。我确定,因为我用简单的XML测试它,没有html标签。

这里是示例XML

<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="http://www.accessdata.fda.gov/spl/stylesheet/spl.xsl" type="text/xsl"?>
<document xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hl7-org:v3 http://www.accessdata.fda.gov/spl/schema/spl.xsd">
  <id root="fdd1fa5e-9dbf-4951-a8e9-33d06e05bdba"/>
<code code="34391-3" codeSystem="2.16.840.1.113883.6.1" displayName="HUMAN PRESCRIPTION DRUG LABEL"/>
<title>WELLBUTRIN XL<sup>®</sup>
<br/>(bupropion hydrochloride extended-release tablets)</title>
<effectiveTime value="20101201"/>
<setId root="fdd1fa5e-9dbf-4951-a8e9-33d06e05bdba"/>
<versionNumber value="1"/>
<author>
  <time/>
  <assignedEntity>
     <representedOrganization>
        <id extension="118802834" root="1.3.6.1.4.1.519.1"/>
        <name>Rebel Distributors Corp</name>
        <assignedEntity>
           <assignedOrganization>
              <assignedEntity>
                 <assignedOrganization>
                    <id extension="118802834" root="1.3.6.1.4.1.519.1"/>
                    <name>Rebel Distributors Corp</name>
                 </assignedOrganization>
                 <performance>
                    <actDefinition>
                       <code code="C73607" codeSystem="2.16.840.1.113883.3.26.1.1" displayName="RELABEL"/>
                    </actDefinition>
                 </performance>
                 <performance>
                    <actDefinition>
                       <code code="C73606" codeSystem="2.16.840.1.113883.3.26.1.1" displayName="REPACK"/>
                    </actDefinition>
                 </performance>
              </assignedEntity>
           </assignedOrganization>
        </assignedEntity>
      </representedOrganization>
   </assignedEntity>
</author>
<component>


<section ID="i4i_pharmacokinetics_id_64f18136-4148-40b6-bdc1-5a836f89badf">
                 <id root="b72d6d1f-ba84-4360-b6d2-356e2659d444"/>
                 <code codeSystem="2.16.840.1.113883.6.1" code="43682-4" displayName="PHARMACOKINETICS SECTION"/>
                 <text>
                    <paragraph>
                       <content styleCode="bold">Pharmacokinetics: </content>Bupropion is a racemic mixture. The pharmacologic activity and pharmacokinetics of the individual enantiomers have not been studied. The mean elimination half-life (±SD) of bupropion after chronic dosing is 21 (±9) hours, and steady-state plasma concentrations of bupropion are reached within 8 days.</paragraph>
                    <paragraph>In a study comparing 14-day dosing with WELLBUTRIN XL 300 mg once daily to the immediate-release formulation of bupropion at 100 mg 3 times daily, equivalence was demonstrated for peak plasma concentration and area under the curve for bupropion and the 3 metabolites (hydroxybupropion, threohydrobupropion, and erythrohydrobupropion). Additionally, in a study comparing 14-day dosing with WELLBUTRIN XL 300 mg once daily to the sustained-release formulation of bupropion at 150 mg 2 times daily, equivalence was demonstrated for peak plasma concentration and area under the curve for bupropion and the 3 metabolites.</paragraph>
                 </text>
                 <effectiveTime value="20100602"/>
                 <component>
                    <section ID="i4i_section_id_6d40273a-9091-4892-8274-c5d63bfd5e3d">
                       <id root="49620c24-b19c-4e05-8d56-cf59a423a74a"/>
                       <code codeSystem="2.16.840.1.113883.6.1" code="42229-5" displayName="SPL UNCLASSIFIED SECTION"/>
                       <text>
                          <paragraph>
                             <content styleCode="bold">
                                <content styleCode="italics">Absorption: </content>
                             </content>Following oral administration of WELLBUTRIN XL to healthy volunteers, time to peak plasma concentrations for bupropion was approximately 5 hours and food did not affect the C<sub>max</sub> or AUC of bupropion. </paragraph>
                       </text>
                       <effectiveTime value="20100602"/>
                    </section>
                 </component>
                 <component>

请提前帮助我解决这个问题....

1 个答案:

答案 0 :(得分:1)

首先检查您的XML是否有效 http://www.xmlvalidation.com/index.php?id=1&L=0

然后可以使用此链接XML into JSON conversion in iOS

我认为这会对你有所帮助   它也可以帮助你...
 http://ioscoding.blogspot.in/2011/07/xml-parsing-using-tbxml.html