我知道如何解析一些XML結構,但我目前正試圖解析這個與我習慣的有點不同的特定xml結構。如何在ios中解析具有結構的Xml
但現在我正在使用一些像這樣的XML .. 你能幫我一把。
<?xml version="1.0" encoding="UTF-8"?>
<EssentialPhoneNumbers>
<Department>
<Name>Direct sales department</Name>
<Phone>03-6380000</Phone>
<Hours>Sunday - Thursday 20:00 to 8:30. Fridays and holiday eves: 8:00 to 12:00</Hours>
<Contacts>
<Contact>
<Name>Inquiries about purchasing life and health insurance</Name>
<Phone>03-6380390</Phone>
<Fax>NA</Fax>
<Hours>NA</Hours>
</Contact>
<Contact>
<Name>Inquiries about purchasing car insurance, apartment and office</Name>
<Phone>03-6380350</Phone>
<Fax>NA</Fax>
<Hours>NA</Hours>
</Contact>
<Contact>
<Name>Doctors - medical bug reports or claims (MCI Inc.)</Name>
<Phone>03-6380406</Phone>
<Fax>03-6380345</Fax>
<Hours>NA</Hours>
</Contact>
<Contact>
<Name>Focus option - all health insurance</Name>
<Phone>03-6380204</Phone>
<Fax>03-5244401</Fax>
<Hours>Sunday - Thursday 20:00 to 8:30</Hours>
</Contact>
<Contact>
<Name>General insurance claims department Avinoam Ike</Name>
<Phone>03-6380429</Phone>
<Fax>NA</Fax>
<Hours>NA</Hours>
</Contact>
</Contacts>
</Department>
<Department>
<Name>Service Department</Name>
<Phone>03-6380350</Phone>
<Hours>Sunday - Thursday 6:00 p.m. to 8:00 a.m. Fridays and holiday eves: 8:00 to 12:00</Hours>
<Contacts>
<Contact>
<Name>Center and emergency assistance services 24 hours a day</Name>
<Phone>1-800-280-555</Phone>
<Fax>NA</Fax>
<Hours>NA</Hours>
</Contact>
<Contact>
<Name>Advice on medico - wavy insured professional liability insurance - medical(MCI Inc.)</Name>
<Phone>03-6380346</Phone>
<Fax>03-6380345</Fax>
<Hours>NA</Hours>
</Contact>
<Contact>
<Name>Urgent questions on Medico - Records (other than the hours at the office)</Name>
<Phone>052-227633</Phone>
<Fax>NA</Fax>
<Hours>NA</Hours>
</Contact>
<Contact>
<Name>Inquiries about professional liability insurance - medical</Name>
<Phone>03-6380480</Phone>
<Fax>03-6380461</Fax>
<Hours>NA</Hours>
</Contact>
<Contact>
<Name>Team members focus</Name>
<Phone>1-700-700-251</Phone>
<Fax>NA</Fax>
<Hours>Sunday - Thursday 20:00 to 8:00</Hours>
</Contact>
<Contact>
<Name>Inquiries about Medical Risk Management(MRM)</Name>
<Phone>03-6380458</Phone>
<Fax>03-6380345</Fax>
<Hours>NA</Hours>
</Contact>
</Contacts>
</Department>
</EssentialPhoneNumbers>
這將是[解析XML(HTTP一個很好的教程如何解析這個XML: //www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml)。你的xml有一個很好的模式。您需要創建兩個模型對象部門和聯繫人。部門會有一對多的聯繫,並且會有一對一的關係。 – Anupdas
你的意思是「特定的XML結構」?這是正常的XML。 – CRDave
正好在xml結構之上 –