Skip to content

Commit db08214

Browse files
author
Robert Righter
committed
documentation
1 parent beedf7f commit db08214

File tree

1 file changed

+45
-55
lines changed

1 file changed

+45
-55
lines changed

README.md

Lines changed: 45 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -33,85 +33,75 @@ Node-xml provides a SAX2 parser interface that can take a string, file.
3333

3434
parser.parseString(string)
3535

36-
* Parse an in memory string
36+
Parse an in memory string
3737
* return: boolean. true if no errors, false otherwise
3838
* Arguments
39-
+ string - a string representing the document to parse
40-
39+
* string - a string representing the document to parse
4140

4241
parser.parseFile(filename)
4342

44-
*Parse a file
45-
*return: boolean. true if no errors, false otherwise
46-
*Arguments
47-
+filename - a string representing the file to be parsed
48-
49-
Callbacks
50-
51-
parser.onStartDocument(function() {})
52-
53-
Called at the start of a document
54-
55-
parse.onEndDocument(function() {})
56-
57-
Called at the end of the document parse
58-
59-
parser.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {})
60-
61-
Called on an open element tag
62-
Arguments
63-
64-
* elem - a string representing the element name
65-
* attrs - an array of arrays: [[key, value], [key, value]]
66-
* prefix - a string representing the namespace prefix of the element
67-
* uri - the namespace URI of the element
68-
* namespaces - an array of arrays: [[prefix, uri], [prefix, uri]]
69-
70-
parser.onEndElementNS(function(elem, prefix, uri) {})
43+
Parse a file
44+
* return: boolean. true if no errors, false otherwise
45+
* Arguments
46+
* filename - a string representing the file to be parsed
7147

72-
Called at the close of an element
73-
Arguments
48+
#Callbacks#
7449

75-
* elem - a string representing the element name
76-
* prefix - a string representing the namespace prefix of the element
77-
* uri - the namespace URI of the element
50+
parser.onStartDocument(function() {})
7851

79-
parser.onCharacters(function(chars) {})
52+
Called at the start of a document
8053

81-
Called when a set of content characters is encountered
82-
Arguments
54+
parse.onEndDocument(function() {})
8355

84-
* chars - a string of characters
56+
Called at the end of the document parse
8557

86-
parser.onCdata(function(cdata) {})
58+
parser.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {})
8759

88-
Called when a CDATA is encountered
89-
Arguments
60+
Called on an open element tag
61+
* Arguments
62+
* elem - a string representing the element name
63+
* attrs - an array of arrays: [[key, value], [key, value]]
64+
* prefix - a string representing the namespace prefix of the element
65+
* uri - the namespace URI of the element
66+
* namespaces - an array of arrays: [[prefix, uri], [prefix, uri]]
9067

91-
* cdata - a string representing the CDATA
68+
parser.onEndElementNS(function(elem, prefix, uri) {})
9269

93-
parser.onComment(function(msg) {})
70+
Called at the close of an element
71+
* Arguments
72+
* elem - a string representing the element name
73+
* prefix - a string representing the namespace prefix of the element
74+
* uri - the namespace URI of the element
9475

95-
Called when a comment is encountered
96-
Arguments
76+
parser.onCharacters(function(chars) {})
9777

98-
* msg - a string representing the comment
78+
Called when a set of content characters is encountered
79+
* Arguments
80+
* chars - a string of characters
9981

100-
parser.onWarning(function(msg) {})
82+
parser.onCdata(function(cdata) {})
10183

102-
Called when a warning is encountered
103-
Arguments
84+
Called when a CDATA is encountered
85+
* Arguments
86+
* cdata - a string representing the CDATA
10487

105-
* msg - a string representing the warning message
88+
parser.onComment(function(msg) {})
10689

107-
parser.onError(function(msg) {})
90+
Called when a comment is encountered
91+
* Arguments
92+
* msg - a string representing the comment
10893

109-
Called when an error is encountered
110-
Arguments
94+
parser.onWarning(function(msg) {})
11195

112-
* msg - a string representing the error message
96+
Called when a warning is encountered
97+
* Arguments
98+
* msg - a string representing the warning message
11399

100+
parser.onError(function(msg) {})
114101

102+
Called when an error is encountered
103+
* Arguments
104+
* msg - a string representing the error message
115105

116106

117107
EXAMPLE USAGE

0 commit comments

Comments
 (0)