node-xml.js

Wed, 24 Feb 2010 22:04:06 -0800

author
zuwiki <zuwiki@gmail.com>
date
Wed, 24 Feb 2010 22:04:06 -0800
changeset 15
b328899c936a
parent 14
aaad945d10ba
permissions
-rw-r--r--

Cleaning up and documenting some changes.

14
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1 // node-xml
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
2 // An xml parser for node.js
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
3 // (C) Rob Righter (@robrighter) 2009 - 2010, Licensed under the MIT-LICENSE
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
4 // Contributions from David Joham
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
5
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
6
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
7 (function () {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
8
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
9 // CONSTANTS
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
10 var whitespace = "\n\r\t ";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
11
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
12
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
13 //XMLP is a pull-based parser. The calling application passes in a XML string
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
14 //to the constructor, then repeatedly calls .next() to parse the next segment.
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
15 //.next() returns a flag indicating what type of segment was found, and stores
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
16 //data temporarily in couple member variables (name, content, array of
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
17 //attributes), which can be accessed by several .get____() methods.
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
18 //
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
19 //Basically, XMLP is the lowest common denominator parser - an very simple
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
20 //API which other wrappers can be built against.
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
21
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
22
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
23 var XMLP = function(strXML) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
24 // Normalize line breaks
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
25 strXML = SAXStrings.replace(strXML, null, null, "\r\n", "\n");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
26 strXML = SAXStrings.replace(strXML, null, null, "\r", "\n");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
27
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
28 this.m_xml = strXML;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
29 this.m_iP = 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
30 this.m_iState = XMLP._STATE_PROLOG;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
31 this.m_stack = new Stack();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
32 this._clearAttributes();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
33 this.m_pause = false;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
34 this.m_preInterruptIState = XMLP._STATE_PROLOG;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
35 this.m_namespaceList = new Array();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
36 this.m_chunkTransitionContinuation = null;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
37
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
38 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
39
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
40
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
41 // CONSTANTS (these must be below the constructor)
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
42 XMLP._NONE = 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
43 XMLP._ELM_B = 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
44 XMLP._ELM_E = 2;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
45 XMLP._ELM_EMP = 3;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
46 XMLP._ATT = 4;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
47 XMLP._TEXT = 5;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
48 XMLP._ENTITY = 6;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
49 XMLP._PI = 7;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
50 XMLP._CDATA = 8;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
51 XMLP._COMMENT = 9;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
52 XMLP._DTD = 10;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
53 XMLP._ERROR = 11;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
54 XMLP._INTERRUPT = 12;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
55
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
56 XMLP._CONT_XML = 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
57 XMLP._CONT_ALT = 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
58
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
59 XMLP._ATT_NAME = 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
60 XMLP._ATT_VAL = 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
61
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
62 XMLP._STATE_PROLOG = 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
63 XMLP._STATE_DOCUMENT = 2;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
64 XMLP._STATE_MISC = 3;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
65
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
66 XMLP._errs = new Array();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
67 XMLP._errs[XMLP.ERR_CLOSE_PI = 0 ] = "PI: missing closing sequence";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
68 XMLP._errs[XMLP.ERR_CLOSE_DTD = 1 ] = "DTD: missing closing sequence";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
69 XMLP._errs[XMLP.ERR_CLOSE_COMMENT = 2 ] = "Comment: missing closing sequence";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
70 XMLP._errs[XMLP.ERR_CLOSE_CDATA = 3 ] = "CDATA: missing closing sequence";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
71 XMLP._errs[XMLP.ERR_CLOSE_ELM = 4 ] = "Element: missing closing sequence";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
72 XMLP._errs[XMLP.ERR_CLOSE_ENTITY = 5 ] = "Entity: missing closing sequence";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
73 XMLP._errs[XMLP.ERR_PI_TARGET = 6 ] = "PI: target is required";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
74 XMLP._errs[XMLP.ERR_ELM_EMPTY = 7 ] = "Element: cannot be both empty and closing";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
75 XMLP._errs[XMLP.ERR_ELM_NAME = 8 ] = "Element: name must immediatly follow \"<\"";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
76 XMLP._errs[XMLP.ERR_ELM_LT_NAME = 9 ] = "Element: \"<\" not allowed in element names";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
77 XMLP._errs[XMLP.ERR_ATT_VALUES = 10] = "Attribute: values are required and must be in quotes";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
78 XMLP._errs[XMLP.ERR_ATT_LT_NAME = 11] = "Element: \"<\" not allowed in attribute names";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
79 XMLP._errs[XMLP.ERR_ATT_LT_VALUE = 12] = "Attribute: \"<\" not allowed in attribute values";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
80 XMLP._errs[XMLP.ERR_ATT_DUP = 13] = "Attribute: duplicate attributes not allowed";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
81 XMLP._errs[XMLP.ERR_ENTITY_UNKNOWN = 14] = "Entity: unknown entity";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
82 XMLP._errs[XMLP.ERR_INFINITELOOP = 15] = "Infininte loop";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
83 XMLP._errs[XMLP.ERR_DOC_STRUCTURE = 16] = "Document: only comments, processing instructions, or whitespace allowed outside of document element";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
84 XMLP._errs[XMLP.ERR_ELM_NESTING = 17] = "Element: must be nested correctly";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
85
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
86
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
87
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
88 XMLP.prototype.continueParsing = function(strXML) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
89
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
90 if(this.m_chunkTransitionContinuation){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
91 strXML = this.m_chunkTransitionContinuation + strXML;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
92 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
93 // Normalize line breaks
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
94 strXML = SAXStrings.replace(strXML, null, null, "\r\n", "\n");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
95 strXML = SAXStrings.replace(strXML, null, null, "\r", "\n");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
96
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
97 this.m_xml = strXML;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
98 this.m_iP = 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
99 this.m_iState = XMLP._STATE_DOCUMENT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
100 //this.m_stack = new Stack();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
101 //this._clearAttributes();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
102 this.m_pause = false;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
103 this.m_preInterruptIState = XMLP._STATE_PROLOG;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
104 this.m_chunkTransitionContinuation = null;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
105
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
106 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
107
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
108 XMLP.prototype._addAttribute = function(name, value) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
109 this.m_atts[this.m_atts.length] = new Array(name, value);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
110 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
111
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
112 XMLP.prototype._checkStructure = function(iEvent) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
113 if(XMLP._STATE_PROLOG == this.m_iState) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
114 if((XMLP._TEXT == iEvent) || (XMLP._ENTITY == iEvent)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
115 if(SAXStrings.indexOfNonWhitespace(this.getContent(), this.getContentBegin(), this.getContentEnd()) != -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
116 return this._setErr(XMLP.ERR_DOC_STRUCTURE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
117 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
118 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
119
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
120 if((XMLP._ELM_B == iEvent) || (XMLP._ELM_EMP == iEvent)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
121 this.m_iState = XMLP._STATE_DOCUMENT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
122 // Don't return - fall through to next state
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
123 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
124 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
125 if(XMLP._STATE_DOCUMENT == this.m_iState) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
126 if((XMLP._ELM_B == iEvent) || (XMLP._ELM_EMP == iEvent)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
127 this.m_stack.push(this.getName());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
128 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
129
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
130 if((XMLP._ELM_E == iEvent) || (XMLP._ELM_EMP == iEvent)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
131 var strTop = this.m_stack.pop();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
132 if((strTop == null) || (strTop != this.getName())) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
133 return this._setErr(XMLP.ERR_ELM_NESTING);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
134 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
135 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
136
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
137 if(this.m_stack.count() == 0) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
138 this.m_iState = XMLP._STATE_MISC;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
139 return iEvent;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
140 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
141 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
142 if(XMLP._STATE_MISC == this.m_iState) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
143 if((XMLP._ELM_B == iEvent) || (XMLP._ELM_E == iEvent) || (XMLP._ELM_EMP == iEvent) || (XMLP.EVT_DTD == iEvent)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
144 return this._setErr(XMLP.ERR_DOC_STRUCTURE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
145 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
146
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
147 if((XMLP._TEXT == iEvent) || (XMLP._ENTITY == iEvent)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
148 if(SAXStrings.indexOfNonWhitespace(this.getContent(), this.getContentBegin(), this.getContentEnd()) != -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
149 return this._setErr(XMLP.ERR_DOC_STRUCTURE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
150 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
151 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
152 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
153
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
154 return iEvent;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
155
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
156 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
157
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
158 XMLP.prototype._clearAttributes = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
159 this.m_atts = new Array();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
160 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
161
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
162 XMLP.prototype._findAttributeIndex = function(name) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
163 for(var i = 0; i < this.m_atts.length; i++) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
164 if(this.m_atts[i][XMLP._ATT_NAME] == name) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
165 return i;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
166 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
167 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
168 return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
169
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
170 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
171
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
172 XMLP.prototype.getAttributeCount = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
173 return this.m_atts ? this.m_atts.length : 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
174 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
175
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
176 XMLP.prototype.getAttributeName = function(index) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
177 return ((index < 0) || (index >= this.m_atts.length)) ? null : this.m_atts[index][XMLP._ATT_NAME];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
178 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
179
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
180 XMLP.prototype.getAttributeValue = function(index) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
181 return ((index < 0) || (index >= this.m_atts.length)) ? null : __unescapeString(this.m_atts[index][XMLP._ATT_VAL]);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
182 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
183
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
184 XMLP.prototype.getAttributeValueByName = function(name) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
185 return this.getAttributeValue(this._findAttributeIndex(name));
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
186 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
187
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
188 XMLP.prototype.getColumnNumber = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
189 return SAXStrings.getColumnNumber(this.m_xml, this.m_iP);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
190 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
191
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
192 XMLP.prototype.getContent = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
193 return (this.m_cSrc == XMLP._CONT_XML) ? this.m_xml : this.m_cAlt;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
194 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
195
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
196 XMLP.prototype.getContentBegin = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
197 return this.m_cB;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
198 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
199
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
200 XMLP.prototype.getContentEnd = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
201 return this.m_cE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
202 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
203
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
204 XMLP.prototype.getLineNumber = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
205 return SAXStrings.getLineNumber(this.m_xml, this.m_iP);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
206 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
207
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
208 XMLP.prototype.getName = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
209 return this.m_name;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
210 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
211
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
212 XMLP.prototype.pause = function(){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
213 this.m_pause = true;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
214 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
215
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
216 XMLP.prototype.resume = function(){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
217 this.m_pause = false;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
218 this.m_iState = this.m_preInterruptIState;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
219 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
220
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
221 XMLP.prototype.next = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
222 if(!this.m_pause){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
223 return this._checkStructure(this._parse());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
224 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
225 else{
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
226 //save off the current event loop state and set the state to interrupt
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
227 this.m_preInterruptIState = this.m_iState;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
228 return XMLP._INTERRUPT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
229 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
230 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
231
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
232 XMLP.prototype._parse = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
233 if(this.m_iP == this.m_xml.length) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
234 return XMLP._NONE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
235 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
236
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
237 if(this.m_iP == this.m_xml.indexOf("<?", this.m_iP)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
238 return this._parsePI (this.m_iP + 2);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
239 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
240 else if(this.m_iP == this.m_xml.indexOf("<!DOCTYPE", this.m_iP)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
241 return this._parseDTD (this.m_iP + 9);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
242 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
243 else if(this.m_iP == this.m_xml.indexOf("<!--", this.m_iP)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
244 return this._parseComment(this.m_iP + 4);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
245 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
246 else if(this.m_iP == this.m_xml.indexOf("<![CDATA[", this.m_iP)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
247 return this._parseCDATA (this.m_iP + 9);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
248 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
249 else if(this.m_iP == this.m_xml.indexOf("<", this.m_iP)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
250 return this._parseElement(this.m_iP + 1);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
251 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
252 else if(this.m_iP == this.m_xml.indexOf("&", this.m_iP)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
253 return this._parseEntity (this.m_iP + 1);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
254 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
255 else{
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
256 return this._parseText (this.m_iP);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
257 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
258
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
259
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
260 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
261
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
262 ////////// NAMESPACE SUPPORT //////////////////////////////////////////
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
263 XMLP.prototype._parsePrefixAndElementName = function (elementlabel){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
264 splits = elementlabel.split(':',2);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
265 return { prefix : ((splits.length === 1) ? '' : splits[0]), name : ((splits.length === 1) ? elementlabel : splits[1]), };
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
266 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
267
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
268 XMLP.prototype._parseNamespacesAndAtts = function (atts){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
269 //translate namespaces into objects with "prefix","uri", "scopetag" Add them to: this.m_namespaceList
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
270 //The function should return a new list of tag attributes with the namespaces filtered
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
271 that = this;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
272 var newnamespaces = [];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
273 var filteredatts = [];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
274 atts.map(function (item){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
275 if(item[0].slice(0,5) === "xmlns"){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
276 newnamespaces.push({
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
277 prefix : item[0].slice(6),
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
278 uri : item[1],
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
279 scopetag : that.m_name,
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
280 });
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
281 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
282 else{
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
283 filteredatts.push(item);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
284 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
285 return "not used";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
286 });
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
287 this.m_namespaceList = this.m_namespaceList.concat(newnamespaces);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
288 return [ filteredatts, newnamespaces.map(function(item){return [item.prefix,item.uri];}) ];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
289 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
290
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
291 XMLP.prototype._getContextualNamespace = function (prefix){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
292 if(prefix !== ''){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
293 for(item in this.m_namespaceList){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
294 item = this.m_namespaceList[item];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
295 if(item.prefix === prefix){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
296 return item.uri;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
297 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
298 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
299 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
300
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
301 //no match was found for the prefix so pop off the first non-prefix namespace
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
302 for(var i = (this.m_namespaceList.length-1); i>= 0; i--){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
303 var item = this.m_namespaceList[i];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
304 if(item.prefix === ''){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
305 return item.uri;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
306 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
307 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
308
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
309 //still nothing, lets just return an empty string
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
310 return '';
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
311 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
312
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
313 XMLP.prototype._removeExpiredNamesapces = function (closingtagname) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
314 //remove the expiring namespaces from the list (you can id them by scopetag)
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
315 var keeps = [];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
316 this.m_namespaceList.map(function (item){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
317 if(item.scopetag !== closingtagname){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
318 keeps.push(item);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
319 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
320 });
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
321
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
322 this.m_namespaceList = keeps;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
323
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
324 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
325
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
326 ////////////////////////////////////////////////////////////////////////
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
327
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
328
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
329 XMLP.prototype._parseAttribute = function(iB, iE) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
330 var iNB, iNE, iEq, iVB, iVE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
331 var cQuote, strN, strV;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
332
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
333 this.m_cAlt = ""; //resets the value so we don't use an old one by accident (see testAttribute7 in the test suite)
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
334
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
335 iNB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
336 if((iNB == -1) ||(iNB >= iE)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
337 return iNB;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
338 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
339
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
340 iEq = this.m_xml.indexOf("=", iNB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
341 if((iEq == -1) || (iEq > iE)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
342 return this._setErr(XMLP.ERR_ATT_VALUES);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
343 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
344
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
345 iNE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iNB, iEq);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
346
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
347 iVB = SAXStrings.indexOfNonWhitespace(this.m_xml, iEq + 1, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
348 if((iVB == -1) ||(iVB > iE)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
349 return this._setErr(XMLP.ERR_ATT_VALUES);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
350 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
351
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
352 cQuote = this.m_xml.charAt(iVB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
353 if(SAXStrings.QUOTES.indexOf(cQuote) == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
354 return this._setErr(XMLP.ERR_ATT_VALUES);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
355 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
356
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
357 iVE = this.m_xml.indexOf(cQuote, iVB + 1);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
358 if((iVE == -1) ||(iVE > iE)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
359 return this._setErr(XMLP.ERR_ATT_VALUES);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
360 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
361
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
362 strN = this.m_xml.substring(iNB, iNE + 1);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
363 strV = this.m_xml.substring(iVB + 1, iVE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
364
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
365 if(strN.indexOf("<") != -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
366 return this._setErr(XMLP.ERR_ATT_LT_NAME);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
367 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
368
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
369 if(strV.indexOf("<") != -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
370 return this._setErr(XMLP.ERR_ATT_LT_VALUE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
371 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
372
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
373 strV = SAXStrings.replace(strV, null, null, "\n", " ");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
374 strV = SAXStrings.replace(strV, null, null, "\t", " ");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
375 iRet = this._replaceEntities(strV);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
376 if(iRet == XMLP._ERROR) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
377 return iRet;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
378 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
379
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
380 strV = this.m_cAlt;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
381
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
382 if(this._findAttributeIndex(strN) == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
383 this._addAttribute(strN, strV);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
384 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
385 else {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
386 return this._setErr(XMLP.ERR_ATT_DUP);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
387 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
388
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
389 this.m_iP = iVE + 2;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
390
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
391 return XMLP._ATT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
392
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
393 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
394
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
395 XMLP.prototype._parseCDATA = function(iB) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
396 var iE = this.m_xml.indexOf("]]>", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
397 if (iE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
398 //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
399 this.m_chunkTransitionContinuation = this.m_xml.slice(iB-9);//the '-<![CDATA[ adds the '<!DOCTYPE' back into the string
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
400 return XMLP._INTERRUPT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
401 //return this._setErr(XMLP.ERR_CLOSE_CDATA);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
402 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
403
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
404 this._setContent(XMLP._CONT_XML, iB, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
405
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
406 this.m_iP = iE + 3;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
407
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
408 return XMLP._CDATA;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
409
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
410 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
411
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
412 XMLP.prototype._parseComment = function(iB) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
413 var iE = this.m_xml.indexOf("-" + "->", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
414 if (iE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
415 //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
416 this.m_chunkTransitionContinuation = this.m_xml.slice(iB-4);//the '-4' adds the '<!--' back into the string
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
417 return XMLP._INTERRUPT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
418 //return this._setErr(XMLP.ERR_CLOSE_COMMENT);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
419 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
420
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
421 this._setContent(XMLP._CONT_XML, iB, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
422
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
423 this.m_iP = iE + 3;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
424
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
425 return XMLP._COMMENT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
426
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
427 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
428
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
429 XMLP.prototype._parseDTD = function(iB) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
430 // Eat DTD
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
431 var iE, strClose, iInt, iLast;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
432
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
433 iE = this.m_xml.indexOf(">", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
434 if(iE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
435 //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
436 this.m_chunkTransitionContinuation = this.m_xml.slice(iB-9);//the '-9' adds the '<!DOCTYPE' back into the string
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
437 return XMLP._INTERRUPT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
438 //return this._setErr(XMLP.ERR_CLOSE_DTD);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
439 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
440
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
441 iInt = this.m_xml.indexOf("[", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
442 strClose = ((iInt != -1) && (iInt < iE)) ? "]>" : ">";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
443
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
444 while(true) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
445 // DEBUG: Remove
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
446 if(iE == iLast) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
447 return this._setErr(XMLP.ERR_INFINITELOOP);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
448 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
449
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
450 iLast = iE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
451 // DEBUG: Remove End
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
452
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
453 iE = this.m_xml.indexOf(strClose, iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
454 if(iE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
455 return this._setErr(XMLP.ERR_CLOSE_DTD);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
456 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
457
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
458 // Make sure it is not the end of a CDATA section
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
459 if (this.m_xml.substring(iE - 1, iE + 2) != "]]>") {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
460 break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
461 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
462 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
463
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
464 this.m_iP = iE + strClose.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
465
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
466 return XMLP._DTD;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
467
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
468 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
469
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
470 XMLP.prototype._parseElement = function(iB) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
471 sys = require('sys');
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
472 var iE, iDE, iNE, iRet;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
473 var iType, strN, iLast;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
474
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
475 iDE = iE = this.m_xml.indexOf(">", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
476 if(iE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
477 //This element never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
478 this.m_chunkTransitionContinuation = this.m_xml.slice(iB-1);//the '-1' adds the '<' back into the string
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
479 return XMLP._INTERRUPT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
480 //return this._setErr(XMLP.ERR_CLOSE_ELM);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
481 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
482
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
483 if(this.m_xml.charAt(iB) == "/") {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
484 iType = XMLP._ELM_E;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
485 iB++;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
486 } else {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
487 iType = XMLP._ELM_B;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
488 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
489
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
490 if(this.m_xml.charAt(iE - 1) == "/") {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
491 if(iType == XMLP._ELM_E) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
492 return this._setErr(XMLP.ERR_ELM_EMPTY);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
493 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
494 iType = XMLP._ELM_EMP;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
495 iDE--;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
496 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
497
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
498 iDE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iB, iDE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
499
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
500 //djohack
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
501 //hack to allow for elements with single character names to be recognized
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
502
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
503 if (iE - iB != 1 ) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
504 if(SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iDE) != iB) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
505 return this._setErr(XMLP.ERR_ELM_NAME);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
506 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
507 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
508 // end hack -- original code below
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
509
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
510 /*
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
511 if(SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iDE) != iB)
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
512 return this._setErr(XMLP.ERR_ELM_NAME);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
513 */
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
514 this._clearAttributes();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
515
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
516 iNE = SAXStrings.indexOfWhitespace(this.m_xml, iB, iDE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
517 if(iNE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
518 iNE = iDE + 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
519 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
520 else {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
521 this.m_iP = iNE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
522 while(this.m_iP < iDE) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
523 // DEBUG: Remove
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
524 if(this.m_iP == iLast) return this._setErr(XMLP.ERR_INFINITELOOP);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
525 iLast = this.m_iP;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
526 // DEBUG: Remove End
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
527
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
528
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
529 iRet = this._parseAttribute(this.m_iP, iDE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
530 if(iRet == XMLP._ERROR) return iRet;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
531 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
532 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
533
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
534 strN = this.m_xml.substring(iB, iNE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
535
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
536 if(strN.indexOf("<") != -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
537 return this._setErr(XMLP.ERR_ELM_LT_NAME);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
538 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
539
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
540 this.m_name = strN;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
541 this.m_iP = iE + 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
542
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
543 return iType;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
544
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
545 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
546
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
547 XMLP.prototype._parseEntity = function(iB) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
548 var iE = this.m_xml.indexOf(";", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
549 if(iE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
550 //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
551 this.m_chunkTransitionContinuation = this.m_xml.slice(iB-1);//the '-1' adds the '&' back into the string
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
552 return XMLP._INTERRUPT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
553 //return this._setErr(XMLP.ERR_CLOSE_ENTITY);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
554 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
555
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
556 this.m_iP = iE + 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
557
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
558 return this._replaceEntity(this.m_xml, iB, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
559
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
560 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
561
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
562 XMLP.prototype._parsePI = function(iB) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
563 var iE, iTB, iTE, iCB, iCE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
564
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
565 iE = this.m_xml.indexOf("?>", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
566 if(iE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
567 //This item never closes, although it could be a malformed document, we will assume that we are mid-chunck, save the string and reurn as interrupted
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
568 this.m_chunkTransitionContinuation = this.m_xml.slice(iB-2);//the '-2' adds the '?>' back into the string
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
569 return XMLP._INTERRUPT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
570 return this._setErr(XMLP.ERR_CLOSE_PI);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
571 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
572
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
573 iTB = SAXStrings.indexOfNonWhitespace(this.m_xml, iB, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
574 if(iTB == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
575 return this._setErr(XMLP.ERR_PI_TARGET);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
576 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
577
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
578 iTE = SAXStrings.indexOfWhitespace(this.m_xml, iTB, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
579 if(iTE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
580 iTE = iE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
581 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
582
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
583 iCB = SAXStrings.indexOfNonWhitespace(this.m_xml, iTE, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
584 if(iCB == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
585 iCB = iE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
586 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
587
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
588 iCE = SAXStrings.lastIndexOfNonWhitespace(this.m_xml, iCB, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
589 if(iCE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
590 iCE = iE - 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
591 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
592
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
593 this.m_name = this.m_xml.substring(iTB, iTE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
594 this._setContent(XMLP._CONT_XML, iCB, iCE + 1);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
595 this.m_iP = iE + 2;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
596
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
597 return XMLP._PI;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
598
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
599 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
600
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
601 XMLP.prototype._parseText = function(iB) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
602 var iE, iEE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
603
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
604 iE = this.m_xml.indexOf("<", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
605 if(iE == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
606 iE = this.m_xml.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
607 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
608
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
609 iEE = this.m_xml.indexOf("&", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
610 if((iEE != -1) && (iEE <= iE)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
611 iE = iEE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
612 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
613
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
614 this._setContent(XMLP._CONT_XML, iB, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
615
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
616 this.m_iP = iE;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
617
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
618 return XMLP._TEXT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
619
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
620 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
621
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
622 XMLP.prototype._replaceEntities = function(strD, iB, iE) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
623 if(SAXStrings.isEmpty(strD)) return "";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
624 iB = iB || 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
625 iE = iE || strD.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
626
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
627
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
628 var iEB, iEE, strRet = "";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
629
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
630 iEB = strD.indexOf("&", iB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
631 iEE = iB;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
632
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
633 while((iEB > 0) && (iEB < iE)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
634 strRet += strD.substring(iEE, iEB);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
635
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
636 iEE = strD.indexOf(";", iEB) + 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
637
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
638 if((iEE == 0) || (iEE > iE)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
639 return this._setErr(XMLP.ERR_CLOSE_ENTITY);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
640 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
641
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
642 iRet = this._replaceEntity(strD, iEB + 1, iEE - 1);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
643 if(iRet == XMLP._ERROR) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
644 return iRet;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
645 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
646
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
647 strRet += this.m_cAlt;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
648
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
649 iEB = strD.indexOf("&", iEE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
650 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
651
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
652 if(iEE != iE) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
653 strRet += strD.substring(iEE, iE);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
654 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
655
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
656 this._setContent(XMLP._CONT_ALT, strRet);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
657
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
658 return XMLP._ENTITY;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
659
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
660 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
661
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
662 XMLP.prototype._replaceEntity = function(strD, iB, iE) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
663 if(SAXStrings.isEmpty(strD)) return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
664 iB = iB || 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
665 iE = iE || strD.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
666
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
667 switch(strD.substring(iB, iE)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
668 case "amp": strEnt = "&"; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
669 case "lt": strEnt = "<"; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
670 case "gt": strEnt = ">"; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
671 case "apos": strEnt = "'"; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
672 case "quot": strEnt = "\""; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
673 case "nbsp":strEnt = ''; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
674 case "lt":strEnt = '<'; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
675 case "gt":strEnt = '>'; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
676 case "amp":strEnt = '&'; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
677 case "cent":strEnt = "¢"; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
678 case "pound":strEnt = '£'; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
679 case "yen":strEnt = 'Â¥'; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
680 case "euro":strEnt = '€'; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
681 case "sect":strEnt = '§'; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
682 case "copy":strEnt = '©'; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
683 case "reg":strEnt = '®'; break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
684 default:
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
685 if(strD.charAt(iB) == "#") {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
686 strEnt = String.fromCharCode(parseInt(strD.substring(iB + 1, iE)));
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
687 } else {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
688 strEnt = ' ';
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
689 //return this._setErr(XMLP.ERR_ENTITY_UNKNOWN);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
690 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
691 break;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
692 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
693 this._setContent(XMLP._CONT_ALT, strEnt);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
694
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
695 return XMLP._ENTITY;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
696 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
697
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
698 XMLP.prototype._setContent = function(iSrc) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
699 var args = arguments;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
700
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
701 if(XMLP._CONT_XML == iSrc) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
702 this.m_cAlt = null;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
703 this.m_cB = args[1];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
704 this.m_cE = args[2];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
705 } else {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
706 this.m_cAlt = args[1];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
707 this.m_cB = 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
708 this.m_cE = args[1].length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
709 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
710 this.m_cSrc = iSrc;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
711
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
712 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
713
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
714 XMLP.prototype._setErr = function(iErr) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
715 var strErr = XMLP._errs[iErr];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
716
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
717 this.m_cAlt = strErr;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
718 this.m_cB = 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
719 this.m_cE = strErr.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
720 this.m_cSrc = XMLP._CONT_ALT;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
721
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
722 return XMLP._ERROR;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
723
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
724 } // end function _setErr
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
725
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
726
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
727 //SaxParser is an object that basically wraps an XMLP instance, and provides an
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
728 //event-based interface for parsing. This is the object users interact with when coding
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
729 //with XML for <SCRIPT>
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
730 var SaxParser = function(eventhandlerfactory) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
731
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
732 var eventhandler = new function(){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
733
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
734 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
735
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
736 var thehandler = function() {};
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
737 thehandler.prototype.onStartDocument = function (funct){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
738 eventhandler.onStartDocument = funct;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
739 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
740 thehandler.prototype.onEndDocument = function (funct){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
741 eventhandler.onEndDocument = funct;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
742 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
743 thehandler.prototype.onStartElementNS = function (funct){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
744 eventhandler.onStartElementNS = funct;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
745 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
746 thehandler.prototype.onEndElementNS = function (funct){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
747 eventhandler.onEndElementNS = funct;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
748 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
749 thehandler.prototype.onCharacters = function(funct) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
750 eventhandler.onCharacters = funct;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
751 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
752 thehandler.prototype.onCdata = function(funct) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
753 eventhandler.onCdata = funct;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
754 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
755 thehandler.prototype.onComment = function(funct) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
756 eventhandler.onComment = funct;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
757 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
758 thehandler.prototype.onWarning = function(funct) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
759 eventhandler.onWarning = funct;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
760 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
761
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
762 thehandler.prototype.onError = function(funct) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
763 eventhandler.onError = funct;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
764 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
765
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
766
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
767 eventhandlerfactory(new thehandler());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
768 //eventhandler = eventhandler(eventhandler);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
769 this.m_hndDoc = eventhandler;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
770 this.m_hndErr = eventhandler;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
771 this.m_hndLex = eventhandler;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
772 this.m_interrupted = false;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
773 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
774
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
775
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
776 // CONSTANTS (these must be below the constructor)
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
777 SaxParser.DOC_B = 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
778 SaxParser.DOC_E = 2;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
779 SaxParser.ELM_B = 3;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
780 SaxParser.ELM_E = 4;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
781 SaxParser.CHARS = 5;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
782 SaxParser.PI = 6;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
783 SaxParser.CD_B = 7;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
784 SaxParser.CD_E = 8;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
785 SaxParser.CMNT = 9;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
786 SaxParser.DTD_B = 10;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
787 SaxParser.DTD_E = 11;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
788
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
789 SaxParser.prototype.parseFile = function(filename) { //This function will only work in the node.js environment.
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
790 var fs = require('fs');
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
791 var that = this;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
792 fs.cat(filename).addCallback(function (content) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
793 that.parseString(content);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
794 });
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
795 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
796
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
797
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
798 SaxParser.prototype.parseString = function(strD) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
799 sys = require('sys');
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
800 var that = this;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
801
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
802 setTimeout(function(){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
803 var startnew = true;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
804 if(!that.m_parser){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
805 that.m_parser = new XMLP(strD);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
806 startnew = false;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
807 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
808 else{
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
809 that.m_parser.continueParsing(strD);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
810 startnew = true;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
811 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
812
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
813 //if(that.m_hndDoc && that.m_hndDoc.setDocumentLocator) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
814 // that.m_hndDoc.setDocumentLocator(that);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
815 //}
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
816
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
817 that.m_bErr = false;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
818
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
819 if(!that.m_bErr && !startnew) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
820 that._fireEvent(SaxParser.DOC_B);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
821 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
822 that._parseLoop();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
823 if(!that.m_bErr && !that.m_interrupted) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
824 that._fireEvent(SaxParser.DOC_E);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
825 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
826
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
827 that.m_xml = null;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
828 that.m_iP = 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
829 that.m_interrupted = false;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
830 }, 0);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
831
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
832 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
833
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
834 SaxParser.prototype.pause = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
835 this.m_parser.pause();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
836 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
837
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
838 SaxParser.prototype.resume = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
839 //reset the state
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
840 this.m_parser.resume();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
841 //now start up the parse loop
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
842 var that = this;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
843 setTimeout(function(){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
844 that._parseLoop();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
845 }, 0);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
846 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
847
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
848 SaxParser.prototype.setDocumentHandler = function(hnd) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
849 this.m_hndDoc = hnd;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
850 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
851
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
852 SaxParser.prototype.setErrorHandler = function(hnd) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
853 this.m_hndErr = hnd;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
854 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
855
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
856 SaxParser.prototype.setLexicalHandler = function(hnd) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
857 this.m_hndLex = hnd;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
858 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
859
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
860 SaxParser.prototype.getColumnNumber = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
861 return this.m_parser.getColumnNumber();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
862 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
863
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
864 SaxParser.prototype.getLineNumber = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
865 return this.m_parser.getLineNumber();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
866 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
867
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
868 SaxParser.prototype.getMessage = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
869 return this.m_strErrMsg;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
870 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
871
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
872 SaxParser.prototype.getPublicId = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
873 return null;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
874 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
875
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
876 SaxParser.prototype.getSystemId = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
877 return null;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
878 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
879
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
880 SaxParser.prototype.getLength = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
881 return this.m_parser.getAttributeCount();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
882 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
883
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
884 SaxParser.prototype.getName = function(index) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
885 return this.m_parser.getAttributeName(index);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
886 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
887
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
888 SaxParser.prototype.getValue = function(index) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
889 return this.m_parser.getAttributeValue(index);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
890 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
891
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
892 SaxParser.prototype.getValueByName = function(name) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
893 return this.m_parser.getAttributeValueByName(name);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
894 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
895
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
896 SaxParser.prototype._fireError = function(strMsg) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
897 this.m_strErrMsg = strMsg;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
898 this.m_bErr = true;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
899
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
900 if(this.m_hndErr && this.m_hndErr.onError) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
901 this.m_hndErr.onError(this.m_strErrMsg);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
902 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
903 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
904
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
905
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
906
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
907 SaxParser.prototype._fireEvent = function(iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
908 var hnd, func, args = arguments, iLen = args.length - 1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
909
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
910
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
911 if(this.m_bErr) return;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
912
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
913 if(SaxParser.DOC_B == iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
914 func = "onStartDocument"; hnd = this.m_hndDoc;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
915 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
916 else if (SaxParser.DOC_E == iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
917 func = "onEndDocument"; hnd = this.m_hndDoc;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
918 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
919 else if (SaxParser.ELM_B == iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
920 func = "onStartElementNS"; hnd = this.m_hndDoc;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
921 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
922 else if (SaxParser.ELM_E == iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
923 func = "onEndElementNS"; hnd = this.m_hndDoc;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
924 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
925 else if (SaxParser.CHARS == iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
926 func = "onCharacters"; hnd = this.m_hndDoc;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
927 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
928 else if (SaxParser.PI == iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
929 func = "processingInstruction"; hnd = this.m_hndDoc;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
930 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
931 else if (SaxParser.CD_B == iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
932 func = "onCdata"; hnd = this.m_hndLex;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
933 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
934 else if (SaxParser.CD_E == iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
935 func = "onEndCDATA"; hnd = this.m_hndLex;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
936 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
937 else if (SaxParser.CMNT == iEvt) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
938 func = "onComment"; hnd = this.m_hndLex;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
939 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
940
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
941 if(hnd && hnd[func]) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
942 if(0 == iLen) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
943 hnd[func]();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
944 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
945 else if (1 == iLen) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
946 hnd[func](args[1]);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
947 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
948 else if (2 == iLen) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
949 hnd[func](args[1], args[2]);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
950 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
951 else if (3 == iLen) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
952 hnd[func](args[1], args[2], args[3]);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
953 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
954 else if (4 == iLen) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
955 hnd[func](args[1], args[2], args[3], args[4]);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
956 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
957 else if (5 == iLen) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
958 hnd[func](args[1], args[2], args[3], args[4], args[5]);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
959 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
960 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
961
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
962 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
963
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
964
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
965
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
966
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
967 SaxParser.prototype._parseLoop = function(parser) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
968 var iEvent, parser;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
969
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
970 parser = this.m_parser;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
971 while(!this.m_bErr) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
972 iEvent = parser.next();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
973
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
974 if(iEvent == XMLP._ELM_B) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
975 theatts = this.m_parser.m_atts;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
976 nameobject = parser._parsePrefixAndElementName(parser.getName());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
977 theattsandnamespace = parser._parseNamespacesAndAtts(theatts);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
978 var theuri = parser._getContextualNamespace(nameobject.prefix);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
979 this._fireEvent(SaxParser.ELM_B, nameobject.name, theattsandnamespace[0], (nameobject.prefix === '')? null : nameobject.prefix, (theuri === '')? null : theuri ,theattsandnamespace[1] );
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
980 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
981 else if(iEvent == XMLP._ELM_E) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
982 nameobject = parser._parsePrefixAndElementName(parser.getName());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
983 var theuri = parser._getContextualNamespace(nameobject.prefix);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
984 parser._removeExpiredNamesapces(parser.getName());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
985 this._fireEvent(SaxParser.ELM_E, nameobject.name, (nameobject.prefix === '')? null : nameobject.prefix, (theuri === '')? null : theuri);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
986 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
987 else if(iEvent == XMLP._ELM_EMP) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
988 //this is both a begin and end element
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
989 theatts = this.m_parser.m_atts;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
990 nameobject = parser._parsePrefixAndElementName(parser.getName());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
991 theattsandnamespace = parser._parseNamespacesAndAtts(theatts);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
992 var theuri = parser._getContextualNamespace(nameobject.prefix);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
993 this._fireEvent(SaxParser.ELM_B, nameobject.name, theattsandnamespace[0], (nameobject.prefix === '')? null : nameobject.prefix, (theuri === '')? null : theuri ,theattsandnamespace[1] );
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
994
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
995 parser._removeExpiredNamesapces(parser.getName());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
996 this._fireEvent(SaxParser.ELM_E, nameobject.name, (nameobject.prefix === '')? null : nameobject.prefix, (theuri === '')? null : theuri);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
997 //this._fireEvent(SaxParser.ELM_B, parser.getName(), this.m_parser.m_atts.map(function(item){return { name : item[0], value : item[1], };}) );
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
998 //this._fireEvent(SaxParser.ELM_E, parser.getName());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
999 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1000 else if(iEvent == XMLP._TEXT) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1001 this._fireEvent(SaxParser.CHARS, parser.getContent().slice(parser.getContentBegin(),parser.getContentEnd()));
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1002 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1003 else if(iEvent == XMLP._ENTITY) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1004 this._fireEvent(SaxParser.CHARS, parser.getContent(), parser.getContentBegin(), parser.getContentEnd() - parser.getContentBegin());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1005 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1006 else if(iEvent == XMLP._PI) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1007 this._fireEvent(SaxParser.PI, parser.getName(), parser.getContent().substring(parser.getContentBegin(), parser.getContentEnd()));
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1008 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1009 else if(iEvent == XMLP._CDATA) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1010 this._fireEvent(SaxParser.CD_B, parser.getContent().slice(parser.getContentBegin(),parser.getContentEnd()));
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1011 //this._fireEvent(SaxParser.CHARS, parser.getContent(), parser.getContentBegin(), parser.getContentEnd() - parser.getContentBegin());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1012 //this._fireEvent(SaxParser.CD_E);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1013 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1014 else if(iEvent == XMLP._COMMENT) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1015 this._fireEvent(SaxParser.CMNT, parser.getContent().slice(parser.getContentBegin(),parser.getContentEnd()));
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1016 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1017 else if(iEvent == XMLP._DTD) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1018 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1019 else if(iEvent == XMLP._ERROR) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1020 this._fireError(parser.getContent());
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1021 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1022 else if(iEvent == XMLP._INTERRUPT){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1023 this.m_interrupted = true;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1024 return;//just return and wait to be restarted
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1025 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1026 else if(iEvent == XMLP._NONE) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1027 return;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1028 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1029 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1030
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1031 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1032
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1033 //SAXStrings: a useful object containing string manipulation functions
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1034 var SAXStrings = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1035 //This is the constructor of the SAXStrings object
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1036 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1037
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1038
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1039 // CONSTANTS (these must be below the constructor)
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1040 SAXStrings.WHITESPACE = " \t\n\r";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1041 SAXStrings.QUOTES = "\"'";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1042
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1043
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1044 SAXStrings.getColumnNumber = function(strD, iP) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1045 if(SAXStrings.isEmpty(strD)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1046 return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1047 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1048 iP = iP || strD.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1049
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1050 var arrD = strD.substring(0, iP).split("\n");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1051 var strLine = arrD[arrD.length - 1];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1052 arrD.length--;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1053 var iLinePos = arrD.join("\n").length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1054
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1055 return iP - iLinePos;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1056
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1057 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1058
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1059 SAXStrings.getLineNumber = function(strD, iP) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1060 if(SAXStrings.isEmpty(strD)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1061 return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1062 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1063 iP = iP || strD.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1064
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1065 return strD.substring(0, iP).split("\n").length
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1066 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1067
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1068 SAXStrings.indexOfNonWhitespace = function(strD, iB, iE) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1069 if(SAXStrings.isEmpty(strD)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1070 return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1071 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1072 iB = iB || 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1073 iE = iE || strD.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1074
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1075 for(var i = iB; i < iE; i++){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1076 if(SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1077 return i;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1078 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1079 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1080 return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1081 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1082
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1083 SAXStrings.indexOfWhitespace = function(strD, iB, iE) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1084 if(SAXStrings.isEmpty(strD)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1085 return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1086 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1087 iB = iB || 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1088 iE = iE || strD.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1089
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1090 for(var i = iB; i < iE; i++) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1091 if(SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) != -1) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1092 return i;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1093 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1094 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1095 return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1096 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1097
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1098 SAXStrings.isEmpty = function(strD) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1099 return (strD == null) || (strD.length == 0);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1100 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1101
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1102 SAXStrings.lastIndexOfNonWhitespace = function(strD, iB, iE) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1103 if(SAXStrings.isEmpty(strD)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1104 return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1105 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1106 iB = iB || 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1107 iE = iE || strD.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1108
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1109 for(var i = iE - 1; i >= iB; i--){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1110 if(SAXStrings.WHITESPACE.indexOf(strD.charAt(i)) == -1){
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1111 return i;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1112 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1113 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1114 return -1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1115 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1116
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1117 SAXStrings.replace = function(strD, iB, iE, strF, strR) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1118 if(SAXStrings.isEmpty(strD)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1119 return "";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1120 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1121 iB = iB || 0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1122 iE = iE || strD.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1123
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1124 return strD.substring(iB, iE).split(strF).join(strR);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1125
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1126 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1127
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1128 var Stack = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1129 this.m_arr = new Array();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1130 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1131
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1132 Stack.prototype.clear = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1133 this.m_arr = new Array();
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1134 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1135
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1136 Stack.prototype.count = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1137 return this.m_arr.length;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1138 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1139
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1140 Stack.prototype.destroy = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1141 this.m_arr = null;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1142 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1143
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1144 Stack.prototype.peek = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1145 if(this.m_arr.length == 0) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1146 return null;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1147 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1148
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1149 return this.m_arr[this.m_arr.length - 1];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1150
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1151 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1152
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1153 Stack.prototype.pop = function() {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1154 if(this.m_arr.length == 0) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1155 return null;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1156 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1157
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1158 var o = this.m_arr[this.m_arr.length - 1];
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1159 this.m_arr.length--;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1160 return o;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1161
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1162 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1163
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1164 Stack.prototype.push = function(o) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1165 this.m_arr[this.m_arr.length] = o;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1166 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1167
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1168 // CONVENIENCE FUNCTIONS
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1169 function isEmpty(str) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1170 return (str==null) || (str.length==0);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1171 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1172
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1173
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1174 function trim(trimString, leftTrim, rightTrim) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1175 if (isEmpty(trimString)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1176 return "";
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1177 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1178
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1179 // the general focus here is on minimal method calls - hence only one
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1180 // substring is done to complete the trim.
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1181
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1182 if (leftTrim == null) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1183 leftTrim = true;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1184 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1185
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1186 if (rightTrim == null) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1187 rightTrim = true;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1188 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1189
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1190 var left=0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1191 var right=0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1192 var i=0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1193 var k=0;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1194
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1195
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1196 // modified to properly handle strings that are all whitespace
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1197 if (leftTrim == true) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1198 while ((i<trimString.length) && (whitespace.indexOf(trimString.charAt(i++))!=-1)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1199 left++;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1200 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1201 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1202 if (rightTrim == true) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1203 k=trimString.length-1;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1204 while((k>=left) && (whitespace.indexOf(trimString.charAt(k--))!=-1)) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1205 right++;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1206 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1207 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1208 return trimString.substring(left, trimString.length - right);
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1209 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1210
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1211 function __escapeString(str) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1212
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1213 var escAmpRegEx = /&/g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1214 var escLtRegEx = /</g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1215 var escGtRegEx = />/g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1216 var quotRegEx = /"/g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1217 var aposRegEx = /'/g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1218
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1219 str = str.replace(escAmpRegEx, "&amp;");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1220 str = str.replace(escLtRegEx, "&lt;");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1221 str = str.replace(escGtRegEx, "&gt;");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1222 str = str.replace(quotRegEx, "&quot;");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1223 str = str.replace(aposRegEx, "&apos;");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1224
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1225 return str;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1226 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1227
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1228 function __unescapeString(str) {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1229
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1230 var escAmpRegEx = /&amp;/g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1231 var escLtRegEx = /&lt;/g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1232 var escGtRegEx = /&gt;/g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1233 var quotRegEx = /&quot;/g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1234 var aposRegEx = /&apos;/g;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1235
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1236 str = str.replace(escAmpRegEx, "&");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1237 str = str.replace(escLtRegEx, "<");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1238 str = str.replace(escGtRegEx, ">");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1239 str = str.replace(quotRegEx, "\"");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1240 str = str.replace(aposRegEx, "'");
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1241
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1242 return str;
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1243 }
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1244
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1245 process.mixin(exports, {
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1246 SaxParser: SaxParser
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1247 });
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1248
aaad945d10ba Adding node-xml.js by Rob Righter. Fixing up xmpp.js to work for me. Can't say exactly what all was wrong, other than apparent changes in the node.js TCP API.
zuwiki <zuwiki@gmail.com>
parents:
diff changeset
1249 })()

mercurial