Parsing USS XML file in Cobol? - encoding

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.

Related

TBXML Parser with Special character getting EXC_BAD_ACCESS

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.

NSXMLParser quotation in attribute text

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.

Libxml parser iphone issue

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 "&nbsp" string. i cannot just replace this "&nbsp" 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.

Perl XML parser to extract the default values of the optional attributes fromt the xsd file

I need to parse an XML file through a perl script. While parsing the file, I need to validate it with the corresponding xsd(schema definition) file. The xsd file contains some optional attribute with a default value being provided. I have to parse the xml file in such a way so that I should be able to fetch the default value for all the attribute that are not present in the XML(from xsd). The issue is that I couldn't find any appropriate parser in perl for this Job.I could find a parser that is able to validate the file but couldn't get the default value of attributes that are not present the XML.
Can you please suggest me any parser/module that can help me in getting the required data.
Note: I need the values of the attributes that are not present in the XML to make a complete record for database insertion.
Thanks for your time,
You might want to take a look at XML::Compile. It appears to me that the default values feature is supported, but I've never actually used the module at all.
You could also change the database schema so all fields have defaults.

xmlCtxtGetLastError - Iphone

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.