How to clear XML file for Java parsing by placing quotation marks around attributes

I have a series of xml files that looks something like this:

<ROOT>
    <F P=100> Some text here </F>
    <F P=101> More text </F>
    ...
</ROOT>

I am trying to parse xml using the standard DOM method, but since the attribute values ​​for are Pnot quoted, Java complains.

I tried to use JTidy to clean it, but as my xml is not HTML, Tidy gives an error complaining that it does not recognize tags <ROOT>and <F>etc.

So, is there any other way to do this? As an alternative, I think I could use a regular expression, since <F>only attributes without quotes are present in the tags . Any thoughts or?

Thanks in advance

+3
source share
1

, , - tidy.setXmlTags(true), XML, HTML

- sheldon

+3

All Articles