Sometimes the DTD file of info.plist xml is giving me XML parsing error

Hi

I'm using this code (java code) to parse the info.plist file of an iOS project and add or replace some values:

Code Block
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
File plistFile=new File("/project/SupportingFiles/Info.plist");
Document doc = dBuilder.parse(new BufferedInputStream(new FileInputStream(plistFile)));


In some cases is working perfectly and parsing the XML, then I can replace values and transform the XML and it works perfectly. But since yesterday, day 7, in some cases, the last line of that sample code is giving me a parsing exception:

Code Block
SAXParseExceptionpublicId: -//Apple//DTD PLIST 1.0//EN; systemId:http://www.apple.com/DTDs/PropertyList-1.0.dtd; lineNumber: 1; columnNumber: 2; The markup declarations contained or pointed to by the document type declaration must be well-formed.


This is the start of the infoplist file:

Code Block
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">


How its possible that sometimes is working and sometimes not since yesterday when it was working for years? how can this be solved?

Thanks

What have you changed on your side ?
  • update Xcode ?

  • modified project ?

Is the same occurring for every project ?

Are you sure the error points to what you showed ?
May be the line with <dict>
Code Block
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>

Could you post more of the info plist ?
Hi

The project is exactly the same and Xcode also it's the same. Note that the same project is working sometimes, and sometimes is getting the parse error. Its happening in every project.

I'm not sure where is the error, but after a research in google of that kind of exception, I think that the problem is not with the plist xml file, but with the DTD from that apple website pointed in the error. The plist should be fine, remember that sometimes work and sometimes not, with the same project/plist.

Why it's failing sometimes?
Could you inspect the BufferedInputStream, to see what's in it ?
Sometimes the DTD file of info.plist xml is giving me XML parsing error
 
 
Q