Improvements for XML diagnose output and Aggregated Tasks

Issue #60 new
Former user created an issue

Hi,

the xml output is the best ID3/mp3 diagnosis I found around. However, there seems to be a bug when trying to escape non-letters. It mostly shows #x-1.

My fix (tested on my mp3 collection) involves

  • do not output CDATA if no < in the text (output as plain xml text content)

  • use the &#xxx; escaping

  • for character codes <= 27 use &xxx; escaping

Additionally, I've included a fix to output Aggregated Frames

All fixes are against the downloaded 2.3.3. source tree

user@host:~/prog/id3_cover/jaudiotagger-2.2.3-sources
$ diff ./org/jaudiotagger/tag/id3/AbstractID3v2Tag.java.orig ./org/jaudiotagger/tag/id3/AbstractID3v2Tag.java
1772a1773,1788
>       else if (o instanceof AggregatedFrame)
>             {
>           AggregatedFrame aframe = (AggregatedFrame) o;
>           //aframe.createStructure();
>           //MP3File.getStructureFormatter().openHeadingElement("aggregatedFrame", aframe.getId());
>           //MP3File.getStructureFormatter().openHeadingElement("body", aframe.getContent());
>               //MP3File.getStructureFormatter().closeHeadingElement("body");
>               //MP3File.getStructureFormatter().closeHeadingElement("aggregatedFrame");
>           MP3File.getStructureFormatter().openHeadingElement("aggregatedFrame", aframe.getId());
>       for (Iterator<AbstractID3v2Frame> li = aframe.getFrames().iterator(); li.hasNext(); )
>                 {
>                     frame = li.next();
>                     frame.createStructure();
>                 }
>               MP3File.getStructureFormatter().closeHeadingElement("aggregatedFrame");
>             }
user@host:~/prog/id3_cover/jaudiotagger-2.2.3-sources
$ diff ./org/jaudiotagger/logging/XMLTagDisplayFormatter.java.orig ./org/jaudiotagger/logging/XMLTagDisplayFormatter.java
84a85,88
>             else if (27 >= Character.codePointAt(xmlData,i))
>             {
>                 replacedString.append("&amp;#x").append(Integer.toString(Character.codePointAt(xmlData,i),16)).append(";");
>             }
87c91
<                 replacedString.append("#x").append(Character.digit(tempChar, 16));
---
>                 replacedString.append("&#x").append(Integer.toString(Character.codePointAt(xmlData,i),16)).append(";");
90c94,97
<         return xmlCDataTagOpen + replacedString + xmlCDataTagClose;
---
>         if (xmlData.contains("<"))
>             return xmlCDataTagOpen + replacedString + xmlCDataTagClose;
>         else
>             return replacedString + "";
143c150,151
<         sb.append(xmlFullTag(type, replaceXMLCharacters(value)));
---
>         sb.append(xmlFullTag(type, value));
>         //sb.append(xmlFullTag(type, replaceXMLCharacters(value)));

Comments (1)

  1. IJabz repo owner

    Thanks, but would be alot easier for me oif you forked the git code and then did a pull request for your code chnages

  2. Log in to comment