I am using libxml for parsing the xml. I have referred the XMLPerformance example by apple.
Following is the part of xml document which is causing a problem as it contain the " " string. i cannot just replace this " " with any other string is i am getting data in didReceiveData delegate method and i am parsing that data.
Is there any solution to resolve this issue which is coming because of special character?
<ParentTag>
<AUTHOR>Actavis"Totowa "LLC</AUTHOR>
<SPL_INACTIVE_ING>lactose"monohydrate"/"magnesium"stearate"/"starch"pregelatinized"/"talc</SPL_INACTIVE_ING>
</ParentTag>
Any help will be appreciated.
Thanks in advance
To make sure your XML is well format, you can test you XML first with any online XML validator and then later you should parse that.
Related
I am using TBXML Parser ver. 1.4, When I am Parsing this kind of following responce via TBXML parser, getting EXC_BAD_ACCESS...
<trainingOrganization xsi:type="xsd:string">~!##$%^&*()_+?> <,./;'{}|<":;'></trainingOrganization>
Stuck with this issue.
As I observe that <> data is failed to parse by TBXML...
Thanks in Advance.
One of the best way to use CDATA, anything inside of CDATA treat as xml document so if you have special character like ';:,.''<>' then parser will ignore it. So I always prefer to use CDATA and advise you to should use it.
I think it's nothing TBXML parser specific.
Chars like <>\"' have to be masked (by a \), so it's maybe only the coding of your xml file or the settings for its parsing.
Otherwise the parser thinks it is :
<trainingOrganization xsi:type="xsd:string">
~!##$%^&*()_+?
> *<-- closing the previous element*
<,./;'{}|
<":;'>
</trainingOrganization>
If you can't find any settings or coding to let do it automaticaly, try it by replacing the characters with a \ in front of it before parsing.
An other possibility is to use xml correctly and not allow the structure to set <> between elements, which is an easiest way i think.
I am using the Cobol XML Parser to parse an xml document that originated from the HFS (USS) file system through batch JCL.
My problem is that the XML Parser is returning "XML DOCUMENT ERROR 0000000317" which seems to be an encoding issue.
Does anyone know how to get past this?
Thanks
You will need to ensure that the encoding tag on the XML declaration is valid and agrees with what the actual document is. You will also need to make sure that the LPAR you are running on has the proper code page conversions defined in Unicode Conversion Services for z/OS.
I have a problem with parsing xml. I'm using NSXMLParser and when xml contains tag with attribute with data including quotation marks, it finishes with errorOccur and makes me very upset. Do you know about some solution,setting for xmlparser or anything where could be the problem?
Example:
<stuff attr="This is "special" text."/> ---> PROBLEM
<stuff attr="This is some text."/> ---> THIS IS OK
Thank you
The "problem" XML is not correctly formed, and as such the parser is correct in generating an error - even at the expense of making you very upset :-) Parsers are like that.
As mentioned by #D33 in the comment, the XML should use " - so if you have written the code producing the XML yourself, you can fix it there. Otherwise, you'd have to re-write the malformed XML into correct XML, and that is a slippery slope.
i have a xml file on a server that look for example like this one:
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>two of our famous Belgian Waffles with plenty of real maple syrup</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>light Belgian waffles covered with strawberries and whipped cream</description>
<calories>900</calories>
</food>
</breakfast_menu>
i need xml parser that will parse it and enter each one of them to a class that for examle will called food(and have 4 parameters : name,price,.....).
and finally to create an array of the classes that he create.there is built xml parser that do it?
Here are some sources on the topic:
Navigating XML from Objective-C
How do I parse an NSString containing XML in Objective-C?
Objective C: Parsing an XML file
Parsing XML in Cocoa
Parsing XML in objective-c
For learning to parse xml, look at the links Brandon provided. Your requirement to build an array of classes from xml is something you'll need to create yourself.
A suggestion I have for you is instead of creating classes, just put the data into a NSMutableArray. The array will contain NSDictionary objects for food sub-items.
I have been programming with NSXMLParser for quite a while and lately, I came out with this error. The strangiest thing is that it only happens in debug mode. Once I load the App in Simulator and run it from Simulator (without Xcode involved), it runs fine.
The code is very straight foward, it is a simple XML parsing whose contents were loaded from the web in a separated thread.
Does anybody have alredy encoutered that error??
Thanks in advance.
EDIT:
In time I realized that this error occur when you have a bad formated XML Document. In my case, I was extracting some of the contents of an HTML Page and parsing the resulting string, but this string was not allways well formed. A little modification an voilá...
Ensure that your documents are well formed when parsing or you may have the same mistake...
PS: The parser error method did not catch this error.
In time I realized that this error occur when you have a bad formated XML Document. In my case, I was extracting some of the contents of an HTML Page and parsing the resulting string, but this string was not allways well formed. A little modification an voilá...
Ensure that your documents are well formed when parsing or you may have the same mistake... PS: The parser error method did not catch this error.