1 21 package com.izforge.izpack.util.xml; 22 23 import net.n3.nanoxml.XMLElement; 24 25 26 32 public class XMLHelper 33 { 34 36 37 public final static String YES = "YES"; 38 39 40 public final static String NO = "NO"; 41 42 43 public final static String TRUE = "TRUE"; 44 45 46 public final static String FALSE = "FALSE"; 47 48 49 public final static String ON = "ON"; 50 51 52 public final static String OFF = "OFF"; 53 54 55 public final static String _1 = "1"; 56 57 58 public final static String _0 = "0"; 59 60 62 65 public XMLHelper( ) 66 { 67 super( ); 68 } 69 70 72 100 101 102 public static boolean attributeIsTrue( XMLElement element, String name ) 103 { 104 String value = element.getAttribute( name, "" ).toUpperCase( ); 105 106 if( value.equals( YES ) ) 107 { 108 return ( true ); 109 } 110 else if( value.equals( TRUE ) ) 111 { 112 return ( true ); 113 } 114 else if( value.equals( ON ) ) 115 { 116 return ( true ); 117 } 118 else if( value.equals( _1 ) ) 119 { 120 return ( true ); 121 } 122 123 return ( false ); 124 } 125 126 134 public static boolean attributeIsFalse( XMLElement element, String name ) 135 { 136 String value = element.getAttribute( name, "" ).toUpperCase( ); 137 138 if( value.equals( "NO" ) ) 139 { 140 return ( true ); 141 } 142 else if( value.equals( "FALSE" ) ) 143 { 144 return ( true ); 145 } 146 else if( value.equals( "OFF" ) ) 147 { 148 return ( true ); 149 } 150 else if( value.equals( "0" ) ) 151 { 152 return ( true ); 153 } 154 155 return ( false ); 156 } 157 } 158 | Popular Tags |