1# jsonParser.py 2# 3# Copyright (c) 2006, Paul McGuire 4# 5 6test1 = """ 7{ 8 "glossary": { 9 "title": "example glossary", 10 "GlossDiv": { 11 "title": "S", 12 "GlossList": [ 13 { 14 "ID": "SGML", 15 "SortAs": "SGML", 16 "GlossDef": "A meta-markup language, used to create markup languages such as DocBook.", 17 "GlossSeeAlso": ["GML", "XML", "markup"], 18 "GlossTerm": "Standard Generalized Markup Language", 19 "Acronym": "SGML", 20 "LargestPrimeLessThan100": 97, 21 "AvogadroNumber": 6.02E23, 22 "EvenPrimesGreaterThan2": [], 23 "PrimesLessThan10" : [2,3,5,7], 24 "FermatTheoremInMargin" : false, 25 "MapRequiringFiveColors" : null, 26 "Abbrev": "ISO 8879:1986", 27 "EmptyDict" : {}, 28 "EmptyList" : [] 29 } 30 ] 31 } 32 } 33} 34""" 35 36test2 = """ 37{"menu": { 38 "id": "file", 39 "value": "File:", 40 "popup": { 41 "menuitem": [ 42 {"value": "New", "onclick": "CreateNewDoc()"}, 43 {"value": "Open", "onclick": "OpenDoc()"}, 44 {"value": "Close", "onclick": "CloseDoc()"} 45 ] 46 } 47}} 48""" 49 50test3 = """ 51{"widget": { 52 "debug": "on", 53 "window": { 54 "title": "Sample Konfabulator Widget", "name": "main_window", "width": 500, "height": 500 55 }, "image": { 56 "src": "Images/Sun.png", 57 "name": "sun1", "hOffset": 250, "vOffset": 250, "alignment": "center" 58 }, "text": { 59 "data": "Click Here", 60 "size": 36, 61 "style": "bold", "name": "text1", "hOffset": 250, "vOffset": 100, "alignment": "center", 62 "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" 63 } 64}} 65""" 66test4 = """ 67{"web-app": { 68 "servlet": [ // Defines the CDSServlet 69 { 70 "servlet-name": "cofaxCDS", 71 "servlet-class": "org.cofax.cds.CDSServlet", 72 /* 73 Defines glossary variables that template designers 74 can use across the site. You can add new 75 variables to this set by creating a new init-param, with 76 the param-name prefixed with "configGlossary:". 77 */ 78 "init-param": { 79 "configGlossary:installationAt": "Philadelphia, PA", 80 "configGlossary:adminEmail": "ksm@pobox.com", 81 "configGlossary:poweredBy": "Cofax", 82 "configGlossary:poweredByIcon": "/images/cofax.gif", 83 "configGlossary:staticPath": "/content/static", 84 /* 85 Defines the template loader and template processor 86 classes. These are implementations of org.cofax.TemplateProcessor 87 and org.cofax.TemplateLoader respectively. Simply create new 88 implementation of these classes and set them here if the default 89 implementations do not suit your needs. Leave these alone 90 for the defaults. 91 */ 92 "templateProcessorClass": "org.cofax.WysiwygTemplate", 93 "templateLoaderClass": "org.cofax.FilesTemplateLoader", 94 "templatePath": "templates", 95 "templateOverridePath": "", 96 /* 97 Defines the names of the default templates to look for 98 when acquiring WYSIWYG templates. Leave these at their 99 defaults for most usage. 100 */ 101 "defaultListTemplate": "listTemplate.htm", 102 "defaultFileTemplate": "articleTemplate.htm", 103 /* 104 New! useJSP switches on JSP template processing. 105 jspListTemplate and jspFileTemplate are the names 106 of the default templates to look for when acquiring JSP 107 templates. Cofax currently in production at KR has useJSP 108 set to false, since our sites currently use WYSIWYG 109 templating exclusively. 110 */ 111 "useJSP": false, 112 "jspListTemplate": "listTemplate.jsp", 113 "jspFileTemplate": "articleTemplate.jsp", 114 /* 115 Defines the packageTag cache. This cache keeps 116 Cofax from needing to interact with the database 117 to look up packageTag commands. 118 */ 119 "cachePackageTagsTrack": 200, 120 "cachePackageTagsStore": 200, 121 "cachePackageTagsRefresh": 60, 122 /* 123 Defines the template cache. Keeps Cofax from needing 124 to go to the file system to load a raw template from 125 the file system. 126 */ 127 "cacheTemplatesTrack": 100, 128 "cacheTemplatesStore": 50, 129 "cacheTemplatesRefresh": 15, 130 /* 131 Defines the page cache. Keeps Cofax from processing 132 templates to deliver to users. 133 */ 134 "cachePagesTrack": 200, 135 "cachePagesStore": 100, 136 "cachePagesRefresh": 10, 137 "cachePagesDirtyRead": 10, 138 /* 139 Defines the templates Cofax will use when 140 being browsed by a search engine identified in 141 searchEngineRobotsDb 142 */ 143 "searchEngineListTemplate": "forSearchEnginesList.htm", 144 "searchEngineFileTemplate": "forSearchEngines.htm", 145 "searchEngineRobotsDb": "WEB-INF/robots.db", 146 /* 147 New! useDataStore enables/disables the Cofax database pool 148 */ 149 "useDataStore": true, 150 /* 151 Defines the implementation of org.cofax.DataStore that Cofax 152 will use. If this DataStore class does not suit your needs 153 simply implement a new DataStore class and set here. 154 */ 155 "dataStoreClass": "org.cofax.SqlDataStore", 156 /* 157 Defines the implementation of org.cofax.Redirection that 158 Cofax will use. If this Redirection class does not suit 159 your needs simply implenet a new Redirection class 160 and set here. 161 */ 162 "redirectionClass": "org.cofax.SqlRedirection", 163 /* 164 Defines the data store name. Keep this at the default 165 */ 166 "dataStoreName": "cofax", 167 /* 168 Defines the JDBC driver that Cofax's database pool will use 169 */ 170 "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver", 171 /* 172 Defines the JDBC connection URL to connect to the database 173 */ 174 "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon", 175 /* 176 Defines the user name to connect to the database 177 */ 178 "dataStoreUser": "sa", 179 /* 180 Defines the password to connect to the database 181 */ 182 "dataStorePassword": "dataStoreTestQuery", 183 /* 184 A query that will run to test the validity of the 185 connection in the pool. 186 */ 187 "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';", 188 /* 189 A log file to print out database information 190 */ 191 "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", 192 /* 193 The number of connection to initialize on startup 194 */ 195 "dataStoreInitConns": 10, 196 /* 197 The maximum number of connection to use in the pool 198 */ 199 "dataStoreMaxConns": 100, 200 /* 201 The number of times a connection will be utilized from the 202 pool before disconnect 203 */ 204 "dataStoreConnUsageLimit": 100, 205 /* 206 The level of information to print to the log 207 */ 208 "dataStoreLogLevel": "debug", 209 /* 210 The maximum URL length allowable by the CDS Servlet 211 Helps to prevent hacking 212 */ 213 "maxUrlLength": 500}}, 214 /* 215 Defines the Email Servlet 216 */ 217 { 218 "servlet-name": "cofaxEmail", 219 "servlet-class": "org.cofax.cds.EmailServlet", 220 "init-param": { 221 /* 222 The mail host to be used by the mail servlet 223 */ 224 "mailHost": "mail1", 225 /* 226 An override 227 */ 228 "mailHostOverride": "mail2"}}, 229 /* 230 Defines the Admin Servlet - used to refresh cache on 231 demand and see statistics 232 */ 233 { 234 "servlet-name": "cofaxAdmin", 235 "servlet-class": "org.cofax.cds.AdminServlet"}, 236 /* 237 Defines the File Servlet - used to display files like Apache 238 */ 239 { 240 "servlet-name": "fileServlet", 241 "servlet-class": "org.cofax.cds.FileServlet"}, 242 { 243 "servlet-name": "cofaxTools", 244 "servlet-class": "org.cofax.cms.CofaxToolsServlet", 245 "init-param": { 246 /* 247 Path to the template folder relative to the tools tomcat installation. 248 */ 249 "templatePath": "toolstemplates/", 250 /* 251 Logging boolean 1 = on, 0 = off 252 */ 253 "log": 1, 254 /* 255 Location of log. If empty, log will be written System.out 256 */ 257 "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", 258 /* 259 Max size of log in BITS. If size is empty, no limit to log. 260 If size is defined, log will be overwritten upon reaching defined size. 261 */ 262 "logMaxSize": "", 263 /* 264 DataStore logging boolean 1 = on, 0 = off 265 */ 266 "dataLog": 1, 267 /* 268 DataStore location of log. If empty, log will be written System.out 269 */ 270 "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", 271 /* 272 Max size of log in BITS. If size is empty, no limit to log. 273 If size is defined, log will be overwritten upon reaching defined size. 274 */ 275 "dataLogMaxSize": "", 276 /* 277 Http string relative to server root to call for page cache 278 removal to Cofax Servlet. 279 */ 280 "removePageCache": "/content/admin/remove?cache=pages&id=", 281 /* 282 Http string relative to server root to call for template 283 cache removal to Cofax Servlet. 284 */ 285 "removeTemplateCache": "/content/admin/remove?cache=templates&id=", 286 /* 287 Location of folder from root of drive that will be used for 288 ftp transfer from beta server or user hard drive to live servers. 289 Note that Edit Article will not function without this variable 290 set correctly. MultiPart request relies upon access to this folder. 291 */ 292 "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder", 293 /* 294 Defines whether the Server should look in another path for 295 config files or variables. 296 */ 297 "lookInContext": 1, 298 /* 299 Number of the ID of the top level administration group in tblPermGroups. 300 */ 301 "adminGroupID": 4, 302 /* 303 Is the tools app running on the 'beta server'. 304 */ 305 "betaServer": true}}], 306 "servlet-mapping": { 307 /* 308 URL mapping for the CDS Servlet 309 */ 310 "cofaxCDS": "/", 311 /* 312 URL mapping for the Email Servlet 313 */ 314 "cofaxEmail": "/cofaxutil/aemail/*", 315 /* 316 URL mapping for the Admin servlet 317 */ 318 "cofaxAdmin": "/admin/*", 319 /* 320 URL mapping for the Files servlet 321 */ 322 "fileServlet": "/static/*", 323 "cofaxTools": "/tools/*"}, 324 /* 325 New! The cofax taglib descriptor file 326 */ 327 "taglib": { 328 "taglib-uri": "cofax.tld", 329 "taglib-location": "/WEB-INF/tlds/cofax.tld"}}} 330 331""" 332 333test5 = """ 334{"menu": { 335 "header": "SVG Viewer", 336 "items": [ 337 {"id": "Open"}, 338 {"id": "OpenNew", "label": "Open New"}, 339 null, 340 {"id": "ZoomIn", "label": "Zoom In"}, 341 {"id": "ZoomOut", "label": "Zoom Out"}, 342 {"id": "OriginalView", "label": "Original View"}, 343 null, 344 {"id": "Quality"}, 345 {"id": "Pause"}, 346 {"id": "Mute"}, 347 null, 348 {"id": "Find", "label": "Find..."}, 349 {"id": "FindAgain", "label": "Find Again"}, 350 {"id": "Copy"}, 351 {"id": "CopyAgain", "label": "Copy Again"}, 352 {"id": "CopySVG", "label": "Copy SVG"}, 353 {"id": "ViewSVG", "label": "View SVG"}, 354 {"id": "ViewSource", "label": "View Source"}, 355 {"id": "SaveAs", "label": "Save As"}, 356 null, 357 {"id": "Help"}, 358 {"id": "About", "label": "About Adobe CVG Viewer..."} 359 ] 360}} 361""" 362