Menu

#215 Posible issue with attributes manipulation

closed
aditsu
None
5
2012-10-08
2010-04-08
Anonymous
No

Using JTidy with some HTMLs that have attributes with value without quotes (") I gave an error because the separator space for attributes was deleted.
Example:
Original: <A NAME="JD_CdigoTributarioArt.6RESOLUCIONN55">
After JTidy:

In this case, JTidy added a 'name' attribute with the same value of the 'id' attribute but without separator spaces for attributes.
The options used for this case are:
Tidy tidy = new Tidy();
tidy.setXmlOut(true);
tidy.setXHTML(true);
tidy.setPrintBodyOnly(true);
tidy.setShowWarnings(false);
tidy.setQuiet(true);
tidy.setNumEntities(true);
tidy.setDropProprietaryAttributes(true);
tidy.setLiteralAttribs(true);

I solve this using the option:
tidy.setIndentAttributes(true);

I attach the original htm of the example.
Sorry for my english and for guest user post

Discussion

  • Nobody/Anonymous

    HTM of the example

     
  • aditsu

    aditsu - 2010-04-11

    I tried your input and your code, and the output I get is:

    As you can see, the name attribute is on a separate line.
    What version of JTidy are you using?

     
  • Nobody/Anonymous

    Hi

    I think that you has tested it with setIndentAttributes(true). Try it WITHOUT this option. I solved my problem with this option. Without setIndentAttributes(true) you can see my error.

     
  • aditsu

    aditsu - 2010-04-12

    No, I used your exact code, without setIndentAttributes.
    And you haven't answered my question.

     
  • Nobody/Anonymous

    You're right, I'm sorry.

    Now, I'm using jtidy-r938.jar. I will test it much more

    Thanks for your answer.

     

Log in to post a comment.