document description returns <(null)/> #14

Closed
bejmax opened this Issue Feb 5, 2013 · 2 comments

Comments

Projects
None yet
2 participants

bejmax commented Feb 5, 2013

I apologize in advance, don't have much experience with parsing XML. If I parse with NSXMLParser it will parse the XML (validated with NSLog for each "didStartElement" and "foundCharacters" call) which I retrieve from a web service (from their site: "... output of the request is XML, which is presented in the Atom feed format").

If I print out the XML as an NSString converted from NSData received from the site with the following line:

    NSString * responseString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];

It prints the XML below which i also validated on a website. However, when I try to create an SMXMLDocument with the following line of code, the document when printed in NSLog prints "<(null)/>".

    SMXMLDocument * document = [SMXMLDocument documentWithData:responseObject error:&error];
    NSLog(@"Document:\n %@", document);

Is this (Atom) formatted XML not supported or am I doing something incorrectly?

<?xml version="1.0" encoding="UTF-8"?>
<feed xml:base="http://apps.nlm.nih.gov/medlineplus/services/" xml:lang="en" xmlns="http://www.w3.org
/2005/Atom" xmlns:v3="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <title type="text">MedlinePlus Connect</title>
    <subtitle type="text">MedlinePlus Connect results for RXCUI 387013</subtitle>
    <author>
        <name>U.S. National Library of Medicine</name>
        <uri>http://www.nlm.nih.gov</uri>
    </author>
    <updated type="text">2013-02-03T05:02:19Z</updated>
    <category scheme="REDS_MT010001UV" term="MATCHED">
        <v3:mainSearchCriteria classCode="OBS" moodCode="DEF" xmlns:v3="urn:hl7-org:v3">
        <v3:code code="KSUBJ" codeSystem="2.16.840.1.113883.5.4" xmlns:v3="urn:hl7-org:v3"/>
        <v3:value code="387013" codeSystem="2.16.840.1.113883.6.88" displayName="" xmlns:v3="urn:hl7-org:v3"/>
        </v3:mainSearchCriteria>
        <v3:informationRecipient typeCode="IRCP" xmlns:v3="urn:hl7-org:v3">
            <v3:patient classCode="PAT" xmlns:v3="urn:hl7-org:v3"/>
        </v3:informationRecipient>
   </category>
   <id></id>
   <entry>
       <title>Nebivolol</title>
       <link href="http://www.nlm.nih.gov/medlineplus/druginfo/meds/a608029.html" rel="alternate"/>
       <id>tag: nlm.nih.gov, 2013-03-02:/medlineplus/druginfo/meds/a608029.html</id>
       <updated>2013-02-03T05:02:19Z</updated>
       <summary/>
   </entry>
</feed>  

bejmax commented Feb 5, 2013

Wow, i apologize. I first downloaded the non-arc version but my test build uses ARC so i downloaded that and replaced the original files i put in my test program. Once i put an NSLog statement in a function in your class, it recompiled, re-linked and it works. So, it must have failed due to caching the wrong version of your files.

Sorry to waste your time!

bejmax closed this Feb 5, 2013

Owner

nfarina commented Feb 5, 2013

Oh wild, interesting! Well glad it all worked out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment