nyc-bookstores/node_modules/cheerio/node_modules/entities
2013-05-27 13:45:59 -07:00
..
entities all da files 2013-05-27 13:45:59 -07:00
index.js all da files 2013-05-27 13:45:59 -07:00
LICENSE all da files 2013-05-27 13:45:59 -07:00
package.json all da files 2013-05-27 13:45:59 -07:00
readme.md all da files 2013-05-27 13:45:59 -07:00
test.js all da files 2013-05-27 13:45:59 -07:00

#entities

En- & decoder for XML/HTML entities.

####Features:

  • Focussed on speed
  • Supports three levels of entities: XML, HTML4 & HTML5
    • Supports char code entities (eg. U)
    • Special optimizations for XML: A more restrictive syntax allows faster parsing

##How to…

###…install entities

npm install entities

###…use entities

//encoding
require("entities").encode(<str> data[, <int> level]);
//decoding
require("entities").decode(<str> data[, <int> level]);

The level attribute indicates what level of entities should be decoded (0 = XML, 1 = HTML4 and 2 = HTML5). The default is 0 (read: XML).

There are also methods to access the level directly. Just append the name of the level to the action and you're ready to go (e.g. encodeHTML4(data), decodeXML(data)).

##TODO

  • There should be a way to remove tables that aren't used. The HTML5 table is pretty heavy, if it's not needed, it shouldn't be kept in memory.