1 |
// ----------------------------------------------------------------------------- |
// -------------------------------------------------------------------------- |
2 |
// IWF - Interactive Website Framework. Javascript library for creating |
/// IWF - Interactive Website Framework. Javascript library for creating |
3 |
// responsive thin client interfaces. |
/// responsive thin client interfaces. |
4 |
// |
/// |
5 |
// Copyright (C) 2005 Brock Weaver brockweaver@gmail.com |
/// Copyright (C) 2005 Brock Weaver brockweaver@users.sourceforge.net |
6 |
// |
/// |
7 |
// This library is free software; you can redistribute it and/or modify |
/// This library is free software; you can redistribute it and/or modify |
8 |
// it under the terms of the GNU Lesser General Public License as published |
/// it under the terms of the GNU Lesser General Public License as published |
9 |
// by the Free Software Foundation; either version 2.1 of the License, or |
/// by the Free Software Foundation; either version 2.1 of the License, or |
10 |
// (at your option) any later version. |
/// (at your option) any later version. |
11 |
// |
/// |
12 |
// This library is distributed in the hope that it will be useful, but |
/// This library is distributed in the hope that it will be useful, but |
13 |
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
/// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
14 |
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
/// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
15 |
// License for more details. |
/// License for more details. |
16 |
|
/// |
17 |
|
/// You should have received a copy of the GNU Lesser General Public License |
18 |
|
/// along with this library; if not, write to the Free Software Foundation, |
19 |
|
/// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
|
/// |
21 |
|
/// Brock Weaver |
22 |
|
/// brockweaver@users.sourceforge.net |
23 |
|
/// 1605 NW Maple Pl |
24 |
|
/// Ankeny, IA 50021 |
25 |
|
/// |
26 |
|
//! http://iwf.sourceforge.net/ |
27 |
|
// -------------------------------------------------------------------------- |
28 |
|
//! NOTE: To minimize file size, strip all fluffy comments (except the LGPL, of course!) |
29 |
|
//! using the following regex (global flag and multiline on): |
30 |
|
//! ^\t*//([^/!].*|$) |
31 |
// |
// |
32 |
// You should have received a copy of the GNU Lesser General Public License |
// This reduces file size by about 30%, give or take. |
|
// along with this library; if not, write to the Free Software Foundation, |
|
|
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
33 |
// |
// |
34 |
// Brock Weaver |
//! To rip out only logging statements (commented or uncommented): |
35 |
// brockweaver@gmail.com |
//! ^/{0,2}iwfLog.* |
36 |
// 1605 NW Maple Pl |
// -------------------------------------------------------------------------- |
|
// Ankeny, IA 50021 |
|
|
// ----------------------------------------------------------------------------- |
|
37 |
|
|
38 |
// -------------------------------------------------------------------------- |
// -------------------------------------------------------------------------- |
39 |
// iwfxml.js |
//! iwfxml.js |
40 |
// |
// |
41 |
// Javascript-based xml parser |
// Javascript-based xml parser |
42 |
// |
// |
43 |
// Dependencies: |
//! Dependencies: |
44 |
// iwfcore.js |
//! iwfcore.js |
45 |
// |
// |
46 |
// Brock Weaver - brockweaver@sourceforge.net - iwf.sourceforge.net |
//! Brock Weaver - brockweaver@users.sourceforge.net |
47 |
// v 0.1 - 2005-06-05 |
//! v 0.2 - 2005-11-14 |
48 |
// Initial release. |
//! core bug patch |
49 |
|
// -------------------------------------------------------------------------- |
50 |
|
//! Brock Weaver - brockweaver@users.sourceforge.net |
51 |
|
//! v 0.1 - 2005-06-05 |
52 |
|
//! Initial release. |
53 |
// -------------------------------------------------------------------------- |
// -------------------------------------------------------------------------- |
54 |
// This class is meant to ease the burden of parsing xml. |
// This class is meant to ease the burden of parsing xml. |
55 |
// Xml is parsed into sets of arrays, in a hierarchical format. |
// Xml is parsed into sets of arrays, in a hierarchical format. |
114 |
|
|
115 |
|
|
116 |
// -------------------------------------------------------------------------- |
// -------------------------------------------------------------------------- |
117 |
// iwfXmlNode |
//! iwfXmlNode |
118 |
// |
// |
119 |
// Brock Weaver - brockweaver@gmail.com |
//! Brock Weaver - brockweaver@users.sourceforge.net |
120 |
// v 0.1 - 2005-06-05 |
//! v 0.1 - 2005-06-05 |
121 |
// Initial release. |
//! Initial release. |
122 |
// -------------------------------------------------------------------------- |
// -------------------------------------------------------------------------- |
123 |
// This class is used to represent a single xml node. |
// This class is used to represent a single xml node. |
124 |
// All xml is kept except processing instructions. |
// All xml is kept except processing instructions. |
633 |
|
|
634 |
|
|
635 |
// -------------------------------------------------------------------------- |
// -------------------------------------------------------------------------- |
636 |
// iwfWriter |
//! iwfWriter |
637 |
// |
// |
638 |
// Brock Weaver - brockweaver@gmail.com |
//! Brock Weaver - brockweaver@users.sourceforge.net |
639 |
// |
// |
640 |
// v 0.1 - 2005-06-05 |
//! v 0.1 - 2005-06-05 |
641 |
// Initial release. |
//! Initial release. |
642 |
// -------------------------------------------------------------------------- |
// -------------------------------------------------------------------------- |
643 |
// This class is meant to ease the creation of xml strings. |
// This class is meant to ease the creation of xml strings. |
644 |
// Note it is not a fully-compliant xml generator. |
// Note it is not a fully-compliant xml generator. |
739 |
} else { |
} else { |
740 |
// we're using quotes to delimit html |
// we're using quotes to delimit html |
741 |
attval = attval.replace(/'/gi, "\\'").replace(/"/gi, '"').replace(/>/gi, '>'); |
attval = attval.replace(/'/gi, "\\'").replace(/"/gi, '"').replace(/>/gi, '>'); |
|
// attval = attval.replace(/&/gi, '&').replace(/"/gi, '"').replace(/</gi, '<').replace(/>/gi, '>'); |
|
742 |
} |
} |
743 |
} else { |
} else { |
744 |
attval = iwfXmlEncode(attval); |
attval = iwfXmlEncode(attval); |
803 |
break; |
break; |
804 |
default: |
default: |
805 |
if (this._nodeOpened){ |
if (this._nodeOpened){ |
806 |
// hack for <script /> needing to be <script></script> |
//! hack for <script /> and <div /> needing to be <script></script> or <div></div> |
807 |
switch(name){ |
switch(name){ |
808 |
case 'script': |
case 'script': |
809 |
|
case 'div': |
810 |
this.writeRaw("></" + name + ">"); |
this.writeRaw("></" + name + ">"); |
811 |
break; |
break; |
812 |
default: |
default: |