[brailleblaster] [brailleblaster.newdesign] push by RandomCh...@xxxxxxxxx - Added condition for missing ID attribute in <img> elements. on 2013-07-30 19:24 GMT

  • From: brailleblaster@xxxxxxxxxxxxxx
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Tue, 30 Jul 2013 19:24:54 +0000

Revision: 606ac98b51fc
Branch:   default
Author:   cmyers@xxxxxxxxxxxxxxxxx
Date:     Tue Jul 30 13:31:20 2013
Log:      Added condition for missing ID attribute in <img> elements.
http://code.google.com/p/brailleblaster/source/detail?r=606ac98b51fc&repo=newdesign

Modified:
 /src/main/org/brailleblaster/imagedescriber/ImageDescriber.java

=======================================
--- /src/main/org/brailleblaster/imagedescriber/ImageDescriber.java Tue Jul 30 12:58:43 2013 +++ /src/main/org/brailleblaster/imagedescriber/ImageDescriber.java Tue Jul 30 13:31:20 2013
@@ -199,18 +199,24 @@
                Element captElm = new Element("caption", nameSpace);
                Element copyElm = (nu.xom.Element)e.copy();

+               // If there was no id attribute in the <img> element, add one.
+               if(copyElm.getAttribute("id") == null)
+                       copyElm.addAttribute( new Attribute("id", "TODO!") );
+
+               // If the original didn't have an ID value, add one.
+               String idValue = copyElm.getAttributeValue("id");
+               if(idValue == null)
+                       idValue = "TODO!";
+
                // Add <prodnote> attributes.
                prodElm.addAttribute( new Attribute("id", "TODO!") );
- prodElm.addAttribute( new Attribute("imgref", copyElm.getAttributeValue("id")) );
+               prodElm.addAttribute( new Attribute("imgref", idValue) );
                prodElm.addAttribute( new Attribute("render", "required") );
                // Add <caption> attributes.
                captElm.addAttribute( new Attribute("id", "TODO!") );
- captElm.addAttribute( new Attribute("imgref", copyElm.getAttributeValue("id")) );
+               captElm.addAttribute( new Attribute("imgref", idValue) );

                // Arrange child hierarchy.
-//             imgGrpElm.appendChild(copyElm);
-//             imgGrpElm.appendChild(captElm);
-//             imgGrpElm.appendChild(prodElm);
                imgGrpElm.insertChild(captElm, 0);
                imgGrpElm.insertChild(prodElm, 0);
                imgGrpElm.insertChild(copyElm, 0);

Other related posts:

  • » [brailleblaster] [brailleblaster.newdesign] push by RandomCh...@xxxxxxxxx - Added condition for missing ID attribute in <img> elements. on 2013-07-30 19:24 GMT - brailleblaster