Skip to content

Update README.md #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,49 @@ Node-xml provides a SAX2 parser interface that can take a string, file. The pars

#SAX Parser#

##new xml.SaxParser()##
## new xml.SaxParser()
* Instantiate a new SaxParser
* returns: a SaxParser object

##new xml.SaxParser(callback)##
## new xml.SaxParser(callback)
* Instantiate a new SaxParser
* returns: a SaxParser object
* Arguments
*callback - a function that accepts the new sax parser as an argument

#Parse#
# Parse

##parser.parseString(string)##
## parser.parseString(string)

Parse an in memory string
* return: boolean. true if no errors, false otherwise
* Arguments
* string - a string representing the document to parse

##parser.parseFile(filename)##
## parser.parseFile(filename)

Parse a file
* return: boolean. true if no errors, false otherwise
* Arguments
* filename - a string representing the file to be parsed

##parser.pause()##
## parser.pause()
pauses parsing of the document

##parser.resume()##
## parser.resume()
resumes parsing of the document

#Callbacks#
# Callbacks

##parser.onStartDocument(function() {})##
## parser.onStartDocument(function() {})

Called at the start of a document

##parse.onEndDocument(function() {})##
## parse.onEndDocument(function() {})

Called at the end of the document parse

##parser.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {})##
## parser.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {})

Called on an open element tag
* Arguments
Expand All @@ -73,39 +73,39 @@ Called on an open element tag
* uri - the namespace URI of the element
* namespaces - an array of arrays: [[prefix, uri], [prefix, uri]]

##parser.onEndElementNS(function(elem, prefix, uri) {})##
## parser.onEndElementNS(function(elem, prefix, uri) {})

Called at the close of an element
* Arguments
* elem - a string representing the element name
* prefix - a string representing the namespace prefix of the element
* uri - the namespace URI of the element

##parser.onCharacters(function(chars) {})##
## parser.onCharacters(function(chars) {})

Called when a set of content characters is encountered
* Arguments
* chars - a string of characters

##parser.onCdata(function(cdata) {})##
## parser.onCdata(function(cdata) {})

Called when a CDATA is encountered
* Arguments
* cdata - a string representing the CDATA

##parser.onComment(function(msg) {})##
## parser.onComment(function(msg) {})

Called when a comment is encountered
* Arguments
* msg - a string representing the comment

##parser.onWarning(function(msg) {})##
## parser.onWarning(function(msg) {})

Called when a warning is encountered
* Arguments
* msg - a string representing the warning message

##parser.onError(function(msg) {})##
## parser.onError(function(msg) {})

Called when an error is encountered
* Arguments
Expand Down