How to read a xml file which is not well_formed? - xml-parsing

I am trying to read an XML file with xml.etree.ElementTree
it gives me an error when it reaches a specific line of the file. I was assuming that this is a regular XML file. please help me how can I resolve it?
xml_file =ET.parse("/Users/arash/project/my_project/extracting_features/TraceData.log").getroot()

Related

Inp(Abaqus) mesh file conversion into .msh file via meshio

I'm using meshio to convert an .inp mesh file into compatible form for Gmsh (.msh file type).Αlthough the conversion (meshio convert input.inp output.msh) generates a .msh file, Gmsh can't read it because it appears unusual characters. Please check the attached .pnj. Does anyone have an idea or even better a solution to fix it?
thanks in advance
output.msh file
I tried to convert the .msh output file into ascii but it did not workded

Error when adding localizable string file

Copy Strings File Error Group
Localizable.strings:0: error: read failed: The data couldn’t be read because it isn’t in the correct format.
I added Localizable string and add 15 different language string file from info section.
The app was running before adding all localization to it. Not sure what causing this error.
Any help
make sure all the .string files contains format of translation as below:
"key"="translation";
"nav_profile"="Мой профайл";
missing semicolon or any other different format than above format in any line of any string file can generate this error.

How to read a xml file with python with xml.dom

i am having one xml file and i need to fetch value of tags postnumer and regarding every postnumber all the valid number values...i am using xml.dom for reading xml file in python what is the code to fetch the value...how can i do this? please help
xml code:
-<post>
<PostNumber>180</postNumber>
-<validList>
<validNumber>208</validNumber>
<validNumber>209</validNumber>
<validNumber>210</validNumber>
</validlist>
</post>
-<post>
<postNumber>1023832</postNumber>
-<validlist>
<validNumber>264</validNumber>
<validNumber>401</validNumber>
</validlist>
</post>

OpenCV header error (YAML)

Ok so I feel that I have finally successfully used the OpenCV libraries in my app, except for one thing...
My .yml files get generated correctly except the '%YAML:1.0' header at the top turns out like this '01%YAML:1.0'. The '01' infront of the header is causing this error (I think):
OpenCV Error: Parsing error (/var/mobile/Applications/53C6CBA3-15B7-436A-892B-2ECFA75B72CD/Library/DownloadedDescriptors/descriptors.yml(1): Valid XML should start with '<?xml ...?>') in icvXMLParse, file /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/FairfaxNewsDemo/opencv-2.3.1/OpenCV-2.3.1/modules/core/src/persistence.cpp, line 2163
Anyone know how to solve this issue?
Ok after looking into it a bit further I dont think it's the headers problem. My file always gets generated with '01' at the start.
Hmm...this is embarrassing. But it turns out that I had a 'print' statement lingering in the php file that helps generate my .yaml file, causing 0 and 1 to be added to the beginning of the document.
This meant that my file didn't start with '%YAML:1.0' as expected but '01%YAML:1.0'

How to make a xls file a datasource for JasperReports?

I have a web page that returns a xls file.
I'm trying to use the output of the page as a datasource for JasperReports.
Right now I have something like
JRXlsDataSource ds = new JRXlsDataSource(JRLoader.getLocationInputStream("http://192.168.20.19/people/XLS.jsf"));
but I get this error
net.sf.jasperreports.engine.JRException: jxl.read.biff.BiffException: The input file was not found
How can I read the stream and then use it in the JasperPrint object?
Please refer the link below, it would provide a complete idea of XLS datasource for jasper report
http://jasperreports.sourceforge.net/sample.reference/xlsdatasource/index.html

Resources