pax_global_header00006660000000000000000000000064113763346740014530gustar00rootroot0000000000000052 comment=03b1219679c1e46551f9ce14c85e0859abc5e37c xmlextras-20060529/000077500000000000000000000000001137633467400140305ustar00rootroot00000000000000xmlextras-20060529/buddy.dtd000066400000000000000000000034171137633467400156410ustar00rootroot00000000000000 xmlextras-20060529/buddy.xml000066400000000000000000001172551137633467400156740ustar00rootroot00000000000000 xmlextras-20060529/demo.html000066400000000000000000000205721137633467400156500ustar00rootroot00000000000000 Xml Extras Demo
Source

Options
Load Style
Output format

 
xmlextras-20060529/license.txt000066400000000000000000000264501137633467400162220ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. xmlextras-20060529/local/000077500000000000000000000000001137633467400151225ustar00rootroot00000000000000xmlextras-20060529/local/helptip.css000066400000000000000000000013711137633467400173030ustar00rootroot00000000000000/* Notice that IE has a display problem if the help link is on the last line of a container with no padding. If this is the case increase the padding bottom to at least 1px */ a.helpLink { color: Green; text-decoration: none; border-bottom: 1px dashed Green; } a.helpLink:hover { color: Red; text-decoration: none; border-bottom: 1px dashed Red; } .help-tooltip { position: absolute; width: 250px; border: 1px Solid WindowFrame; background: Infobackground; color: InfoText; font: StatusBar; font: Status-Bar; padding: 3px; filter: progid:DXImageTransform.Microsoft.Shadow(color="#777777", Direction=135, Strength=3); z-index: 10000; } .help-tooltip a, .help-tooltip a:hover { color: blue !important; background: none; } xmlextras-20060529/local/helptip.js000066400000000000000000000050141137633467400171250ustar00rootroot00000000000000/* * This script was created by Erik Arvidsson (erik(at)eae.net) * for WebFX (http://webfx.eae.net) * Copyright 2001 * * For usage see license at http://webfx.eae.net/license.html * * Version: 1.0 * Created: 2001-09-27 * Updated: 2001-11-25 Added a resize to the tooltip if the document width is too small * * Dependencies: helptip.css (To set up the CSS of the help-tooltip class) * * Usage: * * * * * Help * */ function showHelpTip(e, s) { // find anchor element var el = e.target ? e.target : e.srcElement; while (el.tagName != "A") el = el.parentNode; // is there already a tooltip? If so, remove it if (el._helpTip) { document.body.removeChild(el._helpTip); el._helpTip = null; el.onblur = null; return; } // create element and insert last into the body var d = document.createElement("DIV"); d.className = "help-tooltip"; document.body.appendChild(d); d.innerHTML = s; // Allow clicks on A elements inside tooltip d.onmousedown = function (e) { if (!e) e = event; var t = e.target ? e.target : e.srcElement; while (t.tagName != "A" && t != d) t = t.parentNode; if (t == d) return; el._onblur = el.onblur; el.onblur = null; }; d.onmouseup = function () { el.onblur = el._onblur; el.focus(); }; // position tooltip var dw = document.width ? document.width : document.documentElement.offsetWidth - 25; if (d.offsetWidth >= dw) d.style.width = dw - 10 + "px"; else d.style.width = ""; var scroll = getScroll(); if (e.clientX > dw - d.offsetWidth) d.style.left = dw - d.offsetWidth + scroll.x + "px"; else d.style.left = e.clientX - 2 + scroll.x + "px"; d.style.top = e.clientY + 18 + scroll.y + "px"; // add a listener to the blur event. When blurred remove tooltip and restore anchor el.onblur = function () { document.body.removeChild(d); el.onblur = null; el._helpTip = null; }; // store a reference to the tooltip div el._helpTip = d; } // returns the scroll left and top for the browser viewport. function getScroll() { if (document.all && document.body.scrollTop != undefined) { // IE model var ieBox = document.compatMode != "CSS1Compat"; var cont = ieBox ? document.body : document.documentElement; return {x : cont.scrollLeft, y : cont.scrollTop}; } else { return {x : window.pageXOffset, y : window.pageYOffset}; } }xmlextras-20060529/local/howto.txt000066400000000000000000000003101137633467400170150ustar00rootroot00000000000000Creata a sub folder in the zip directory and copy all these files to that dir. Replace the include statements of webfxlayout.js and webfxapi.js to point at local/webfxlayout.js and local/webfxapi.jsxmlextras-20060529/local/title-background.png000066400000000000000000000026731137633467400210760ustar00rootroot00000000000000PNG  IHDR,FAYgAMA7tEXtSoftwareAdobe ImageReadyqe<PLTEp|{n}GҰIDATx| @PP2Kc]K qYo/Ⰺ GU?v/0ƌ>d,63K%_5 T$TRUF\sm'0#*@dF؁=B 1*` B `h@ )@4MYb 0 @4MY`jj9eI@T>HS@ J\LQ2eJY@"P1D) gʂ[9 $) yʂT$eHYrr%e RJa)K  I ,Xe`4ᑲ)G @MY*0@8eAh,3uuu`) MʒAh,pRGMY` 7HR@ c$) FS ) FS FS ) FS he,~R&{{kRC!eS)̆B ڥ,`BJ?0`̰uUUUPR҃9eR,ijj ek IRXД +eS<\/script>" ); document.write( "" ); document.write( "" ); function toggleMethodArguments( e, a ) { if ( a && a.nextSibling && typeof a.nextSibling.innerHTML != "undefined" && typeof showHelpTip != "undefined" ) { showHelpTip( e, a.nextSibling.innerHTML ); } } xmlextras-20060529/local/webfxlayout.css000066400000000000000000000115611137633467400202110ustar00rootroot00000000000000 /* bright: rgb(234,242,255); normal: rgb(120,172,255); dark: rgb(0,66,174); */ /* import menu css */ /* @import "dhtml/xmenu/xmenu.css"; */ #webfx-about { position: absolute; background: white; top: 102px; right: 10px; width: 20px; writing-mode: tb-rl; filter: flipH() flipV() alpha(opacity=50); } /* headers css */ #webfx-title { position: absolute; left: 90px; top: -5px; color: black; background: transparent; border: 0; padding: 0; margin: 0; font-family: Arial Black, Verdana, Helvetica, Sans-Serif; font-weight: bold; font-style: italic; font-size: 45px; letter-spacing: -5px; } #webfx-title-background { width: 100%; height: 67px; background: white no-repeat;/*rgb(100,100,100) no-repeat;*/ background-image: url("images/title-background.png"); background-position: 0 0; } #webfx-sub-title { position: absolute; left: 96px; top: 45px; color: black; background: transparent; padding: 0; margin: 0; border: 0; font-family: Verdana, Helvetica, Sans-Serif; font-size: 11px; } #webfx-menu-bar-1, #webfx-menu-bar-2, #webfx-menu-bar-3, #webfx-menu-bar-4, #webfx-menu-bar-5 { height: 2px; font-size: 0; overflow: hidden; background: rgb(120,172,255);/*#ff8800;*/ padding: 0; } #webfx-menu-bar-1 { background: rgb(0,66,174);/*rgb(120,172,255);/*black;/*rgb(234,242,255);*/ height: 1px; } #webfx-menu-bar-2 { background: rgb(120,172,255);/*#ff8800;*/ height: 1px; } #webfx-menu-bar-3 { background: rgb(120,172,255);/*#ff8800;*/ height: 1px; } #webfx-menu-bar-4 { background: rgb(0,66,174); height: 1px; } #webfx-menu-bar-5 { background: #dddddd; height: 3px; } /* headers css end */ html, body { height: 100%; margin: 0; padding: 0; background: url("images/background-shadow.gif") repeat-y white; color: black; font-size: 13px; font-family: "Verdana", "Tahoma", "Helvetica", "Sans-Serif"; } .webfx-main-body { margin-left: 100px; width: 500px; border-left: 1px solid rgb(120,172,255); } /* h1 only used in header */ h2,h3,h4,h5,h6 { margin-top: 10px; margin-left: 10px; margin-right: 10px; padding: 2px 10px 2px 10px; background: rgb(234,242,255); border-bottom: 1px solid rgb(120,172,255); } h1,h2 { font-weight: normal; } h3,h4,h5,h6 { font-weight: bold; } h1 { font-size: 50px; } h2 { font-size: 20px; } h3 { font-size: 15px; } h4 { font-size: 12px; } p { margin: 10px; font-size: 13px; color: black; text-align: justify; } td { font-size: 13px; font-family: "Verdana", "Tahoma", "Helvetica", "Sans-Serif"; } pre { margin: 20px; margin-right: 10px; background: #eeeeee; padding: 10px; border: 1px solid #dddddd; color: black; } code { background: #eeeeee; border: 1px solid #dddddd; color: black; } a { text-decoration:underline; color: rgb(0,66,174); } a:hover {/*rgb(0,66,174)*/ color: rgb(0,66,174); background: rgb(234,242,255); } a:visited { color: rgb(120,172,255); } a:visited:hover { color: rgb(0,66,174); } hr { margin-left: 10px; margin-right: 10px; padding: 0; text-align: left; height: 1px; color: rgb(120,172,255); background-color: rgb(120,172,255); border-bottom: 1px solid rgb(120,172,255); border: 0; } h2 a, h3 a { display: block; text-decoration: none; width: expression("100%"); } table { margin: 10px; font-size: 13px; color: black; } thead td { background: rgb(234,242,255); border-bottom: 1px solid rgb(120,172,255); font-weight: bold; } .author { margin-top: 50px; font-style: italic; } .date { color: rgb(0,66,174); } .warning, .warning a { color: red; } .warning a:visited, .warning a:hover { color: red; } .warning a:hover { background: rgb(255,230,230); } .license { margin: 10px 10px 0px 10px; padding: 2px 10px 2px 10px; background: rgb(234,242,255); border: 1px solid #dddddd; } .license p { margin: 5px 0px 0px 0px; font-size: 80%; } /* copied from xmenu.css */ .webfx-menu-bar { background: rgb(120,172,255);/*rgb(255,128,0);*/ padding: 2px; font-family: Verdana, Helvetica, Sans-Serif; font-size: 11px; } .webfx-menu-bar a, .webfx-menu-bar a:visited { color: black; border: 1px solid rgb(120,172,255);/*rgb(255,128,0);*/ text-decoration: none; padding: 1px; padding-left: 5px; padding-right: 5px; } .webfx-menu-bar a:hover { color: black; background: rgb(120,172,255); border-left: 1px solid rgb(234,242,255);/*#ffcc88;*/ border-right: 1px solid rgb(0,66,174);/*#884400;*/ border-top: 1px solid rgb(234,242,255);/*#ffcc88;*/ border-bottom: 1px solid rgb(0,66,174);/*#884400;*/ } .webfx-menu-bar a .arrow { border: 0; float: none; /* float: right; width: 6px; height: 16px; margin-right: 2px; background: red; */ } .webfx-menu-bar a:active, .webfx-menu-bar a:focus { -moz-outline: none; outline: none; } /* end xmenu.css copy */xmlextras-20060529/local/webfxlayout.js000066400000000000000000000070041137633467400200320ustar00rootroot00000000000000/* this is a dummy webfxlayout file to be used in download zip files */ /* Do includes */ if (window.pathToRoot == null) pathToRoot = "./"; document.write(''); webfxMenuDefaultImagePath = pathToRoot + "images/"; /* end includes */ /* set up browser checks and add a simple emulation for IE4 */ // check browsers var op = /opera 5|opera\/5/i.test(navigator.userAgent); var ie = !op && /msie/i.test(navigator.userAgent); // preventing opera to be identified as ie var mz = !op && /mozilla\/5/i.test(navigator.userAgent); // preventing opera to be identified as mz if (ie && document.getElementById == null) { // ie4 document.getElementById = function(sId) { return document.all[sId]; }; } /* end browser checks */ webfxLayout = { writeTitle : function (s, s2) { document.write("
"); if (op) { document.write("

" + s + "

"); } else { document.write("

" + s + "

"); } if (s2 == null) s2 = "WebFX - What you never thought possible!"; if (op) { document.write("" + s2 + ""); } else { document.write("" + s2 + ""); } }, writeMainTitle : function () { this.writeTitle("WebFX", "What you never thought possible!"); }, writeTopMenuBar : function () { document.write("
"); if (op) { document.write(""); document.write("
"); } else document.write("
"); document.write("
");// div is closed in writeBottomMenuBar }, writeBottomMenuBar : function () { document.write("
"); if (op) document.write("
"); else document.write("
"); document.write("
"); document.write("
"); }, writeMenu : function () { this.writeTopMenuBar(); //document.write(webfxMenuBar); document.write(""); this.writeBottomMenuBar(); }, writeDesignedByEdger : function () { if (ie && document.body.currentStyle.writingMode != null) document.write("
Page designed and maintained by " + "Erik Arvidsson & " + "Emil A Eklund.
"); } }; if (ie && window.attachEvent) { window.attachEvent("onload", function () { var scrollBorderColor = "rgb(120,172,255)"; var scrollFaceColor = "rgb(234,242,255)"; with (document.body.style) { scrollbarDarkShadowColor = scrollBorderColor; scrollbar3dLightColor = scrollBorderColor; scrollbarArrowColor = "black"; scrollbarBaseColor = scrollFaceColor; scrollbarFaceColor = scrollFaceColor; scrollbarHighlightColor = scrollFaceColor; scrollbarShadowColor = scrollFaceColor; scrollbarTrackColor = "white"; } }); } /* we also need some dummy constructors */ webfxMenuBar = { add : function () {} }; function WebFXMenu() { this.add = function () {}; } function WebFXMenuItem() {} function WebFXMenuSeparator() {} function WebFXMenuButton() {}xmlextras-20060529/marquee-binding.xml000066400000000000000000000362361137633467400176330ustar00rootroot00000000000000 //= innerContainer.offsetWidth ? element.offsetWidth - innerContainer.offsetWidth : 0)) + "px"; fireEvent("start"); } break; case "right": innerContainer.style.top = "0px"; if (oldDirection != "left") { innerContainer.style.left = (_behavior == "scroll" ? -innerContainer.offsetWidth : 0) + "px"; fireEvent("start"); } break; case "down": innerContainer.style.left = "0px"; if (oldDirection != "up") { innerContainer.style.top = (_behavior == "scroll" ? -innerContainer.offsetHeight : 0) + "px"; fireEvent("start"); } break; case "up": innerContainer.style.left = "0px"; if (oldDirection != "down") { innerContainer.style.top = (_behavior == "scroll" ? element.offsetHeight : (element.offsetHeight >= innerContainer.offsetHeight ? element.offsetHeight - innerContainer.offsetHeight: 0)) + "px"; fireEvent("start"); } break; } }; this.start = function () { if (isStopped) { isStopped = false; timer = window.setTimeout(updatePosition, _scrollDelay); } }; this.stop = function () { if ( !isStopped ) { isStopped = true; if (timer != null) window.clearTimeout(timer); } }; // This function handles the positioning of the content. function updatePosition() { if (isStopped) return; if (_behavior == "scroll") { switch (_direction) { case "left": var left = parseInt(innerContainer.style.left);//offsetLeft; if (left + innerContainer.offsetWidth <= 0) { innerContainer.style.left = element.offsetWidth + "px"; if (_loop == 1) __marquee__.stop(); else if (_loop > 1) _loop--; if (_loop > 1 || _loop == -1) fireEvent("start"); } else innerContainer.style.left = left - _scrollAmount + "px"; break; case "right": var left = parseInt(innerContainer.style.left);//offsetLeft; if (left >= element.offsetWidth) { // padding & border innerContainer.style.left = -innerContainer.offsetWidth + "px"; if (_loop == 1) __marquee__.stop(); else if (_loop > 1) _loop--; if (_loop > 1 || _loop == -1) fireEvent("start"); } else innerContainer.style.left = left + _scrollAmount + "px"; break; case "up": var top = parseInt(innerContainer.style.top); if (top + innerContainer.offsetHeight <= 0) { innerContainer.style.top = element.offsetHeight + "px"; if (_loop == 1) __marquee__.stop(); else if (_loop > 1) _loop--; if (_loop > 1 || _loop == -1) fireEvent("start"); } else innerContainer.style.top = top - _scrollAmount + "px"; break; case "down": var top = parseInt(innerContainer.style.top); if (top >= element.offsetHeight) { // padding & border innerContainer.style.top = -innerContainer.offsetHeight + "px"; if (_loop == 1) __marquee__.stop(); else if (_loop > 1) _loop--; if (_loop > 1 || _loop == -1) fireEvent("start"); } else innerContainer.style.top = top + _scrollAmount + "px"; break; } } else { // _behavior == "alternate" switch (_direction) { case "left": var left = parseInt(innerContainer.style.left); var width = element.offsetWidth; var innerWidth = innerContainer.offsetWidth; if (left <= 0 && left + innerWidth <= width && !reverse) { reverse = true; fireEvent("bounce"); } else if (left + innerWidth >= width && left >= 0 && reverse) { reverse = false; if (_loop == 1) __marquee__.stop(); else if (_loop > 1) _loop--; if (_loop > 1 || _loop == -1) fireEvent("bounce"); } var larger = innerWidth > width; var max = larger ? 0 : width - innerWidth; var min = !larger ? 0 : width - innerWidth; innerContainer.style.left = Math.min(max, Math.max(min, left + (reverse ? 1 : -1) * _scrollAmount)) + "px"; break; case "right": var left = parseInt(innerContainer.style.left); var width = element.offsetWidth; var innerWidth = innerContainer.offsetWidth; if (left <= 0 && left + innerWidth <= width && reverse) { reverse = false; if (_loop == 1) __marquee__.stop(); else if (_loop > 1) _loop--; if (_loop > 1 || _loop == -1) fireEvent("bounce"); } else if (left + innerWidth >= width && left >= 0 && !reverse) { reverse = true; fireEvent("bounce"); } var larger = innerWidth > width; var max = larger ? 0 : width - innerWidth; var min = !larger ? 0 : width - innerWidth; innerContainer.style.left = Math.min(max, Math.max(min, left + (!reverse ? 1 : -1) * _scrollAmount)) + "px"; break; case "up": var top = parseInt(innerContainer.style.top); var height = element.offsetHeight; var innerHeight = innerContainer.offsetHeight; if (top <= 0 && top + innerHeight <= height && !reverse) { reverse = true; fireEvent("bounce"); } else if (top + innerHeight >= height && top >= 0 && reverse) { reverse = false; if (_loop == 1) __marquee__.stop(); else if (_loop > 1) _loop--; if (_loop > 1 || _loop == -1) fireEvent("bounce"); } var larger = innerHeight > height; var max = larger ? 0 : height - innerHeight; var min = !larger ? 0 : height - innerHeight; innerContainer.style.top = Math.min(max, Math.max(min, top + (reverse ? 1 : -1) * _scrollAmount)) + "px"; break; case "down": var top = parseInt(innerContainer.style.top); var height = element.offsetHeight; var innerHeight = innerContainer.offsetHeight; if (top <= 0 && top + innerHeight <= height && reverse) { reverse = false; if (_loop == 1) __marquee__.stop(); else if (_loop > 1) _loop--; if (_loop > 1 || _loop == -1) fireEvent("bounce"); } else if (top + innerHeight >= height && top >= 0 && !reverse) { reverse = true; fireEvent("bounce"); } var larger = innerHeight > height; var max = larger ? 0 : height - innerHeight; var min = !larger ? 0 : height - innerHeight; innerContainer.style.top = Math.min(max, Math.max(min, top + (reverse ? -1 : 1) * _scrollAmount)) + "px"; break; } } timer = window.setTimeout(updatePosition, _scrollDelay); } function fireEvent(sType) { var e = document.createEvent("Events"); e.initEvent(sType, false, false); element.dispatchEvent(e); } this.getLoop = function () { return _loop; }; this.setLoop = function (nLoop) { var n = Number(nLoop); if (!isNaN(n) && n > 0) { _loop = n; element.__marquee__setAttribute("loop", n); } else throw new Error("Invalid argument for Marquee::loop"); }; this.getScrollDelay = function () { return _scrollDelay; }; this.setScrollDelay = function (nScrollDelay) { var n = Number(nScrollDelay); if (!isNaN(n) && n > 0) { _scrollDelay = n; element.__marquee__setAttribute("scrollDelay", n); } else throw new Error("Invalid argument for Marquee::scrollDelay"); }; this.getScrollAmount = function () { return _scrollAmount; }; this.setScrollAmount = function (nScrollAmount) { var n = Number(nScrollAmount); if (!isNaN(n) && n >= 0) { _scrollAmount = n; element.__marquee__setAttribute("scrollAmount", n); } else throw new Error("Invalid argument for Marquee::scrollAmount"); }; this.getDirection = function () { return _direction; }; this.setDirection = function (sDirection) { var s = String(sDirection).toLowerCase(); if (_direction == s) return; switch (s) { case "left": case "right": case "up": case "down": break; default: throw new Error("Invalid argument for Marquee::direction"); } oldDirection = _direction; _direction = s; element.__marquee__setAttribute("direction", s); init(); }; this.getBehavior = function () { return _behavior; }; this.setBehavior = function (sBehavior) { var s = String(sBehavior).toLowerCase(); if (_behavior == s) return; switch (s) { case "scroll": case "alternate": break; default: throw new Error("Invalid argument for Marquee::behavior"); } var oldBehavior = _behavior; _behavior = s; element.__marquee__setAttribute("behavior", s); if (oldBehavior == "alternate" && s == "scroll" && reverse) { // reinit init(); } }; this.setInlineEventListener = function (sType, v) { if ( !(sType in inlineEventListeners) ) { element.removeEventListener(sType, inlineEventListeners[sType], false); delete inlineEventListeners[sType]; } var f; if (typeof v == "function") f = v; else if (typeof v == "string") f = new Function("event", v); if (f != undefined) { inlineEventListeners[sType] = f; element.addEventListener(sType, f, false); } }; this.getInlineEventListener = function (sType) { return inlineEventListeners[sType]; }; // init event listeners var _onbounce = getPropAttr("onbounce", null); var _onstart = getPropAttr("onstart", null); if (_onbounce != null) this.setInlineEventListener("bounce", _onbounce); if (_onstart != null) this.setInlineEventListener("start", _onstart); }); // override setAttribute and getAttribute to allow XBL to work as one expects element.__marquee__setAttribute = element.setAttribute; // backup original element.setAttribute = function (sAttrName, sAttrValue) { switch (sAttrName.toLowerCase()) { case "loop": this.__marquee__.setLoop(sAttrValue); break; case "scrollamount": this.__marquee__.setScrollAmount(sAttrValue); break; case "scrolldelay": this.__marquee__.setScrollDelay(sAttrValue); break; case "behavior": this.__marquee__.setBehavior(sAttrValue); break; case "direction": this.__marquee__.setDirection(sAttrValue); break; case "onbounce": this.__marquee__.setInlineEventListener("bounce", sAttrValue); break; case "onstart": this.__marquee__.setInlineEventListener("start", sAttrValue); break; } return this.__marquee__setAttribute(sAttrName, sAttrValue); }; element.__marquee__getAttribute = element.getAttribute; // backup original element.getAttribute = function (sAttrName) { switch (sAttrName.toLowerCase()) { case "loop": return this.__marquee__.getLoop(); case "scrollamount": return this.__marquee__.getScrollAmount(); case "scrolldelay": return this.__marquee__.getScrollDelay(); case "behavior": return this.__marquee__.setBehavior(); case "direction": return this.__marquee__.setDirection(); case "onbounce": return this.__marquee__.getInlineEventListener("bounce"); case "onstart": return this.__marquee__.getInlineEventListener("start"); } return this.__marquee__getAttribute(sAttrName); }; //]]> this.__marquee__.stop(); this.__marquee__.start(); xmlextras-20060529/tree.xml000066400000000000000000000007011137633467400155070ustar00rootroot00000000000000 xmlextras-20060529/usage.html000066400000000000000000000142511137633467400160250ustar00rootroot00000000000000 Xml Extras (WebFX)

Usage

In this document we will go through some common uses of the XML objects provided by IE and Mozilla.

To use the XML extras one has to include the needed JS file.

<script type="text/javascript" src="xmlextras.js"></script>

Notice that this JS file uses try/catch statements and therefore it will give syntax errors in old browsers that does not support these.

Load XML File

...using asyncronous XmlHttp

To load an XML file one can use both the XmlHttp object and the XmlDocument object but I usually prefer the first one because it is a bit more powerful.

function loadAsync(sUri) {
   var xmlHttp = XmlHttp.create();
   var async = true;
   xmlHttp.open("GET", sUri, async);
   xmlHttp.onreadystatechange = function () {
      if (xmlHttp.readyState == 4)
         doSomething(xmlHttp.responseXML); // responseXML : XmlDocument
   }
   xmlHttp.send(null);
}

The open method takes three arguments and the first one is either "GET" or "POST". The last argument allows you to load the document synchronously or asynchronously. Synchronous loading is easier to use because the call to send does not return until the XML file has loaded. The downside to this is that the browser does not respond during this time. The argument to send is needed and in case one is using "POST" this should be of type XmlDocument.

...using syncronous XmlHttp

In case you want to use synchronous loading set the third argument of open to false. Once the send method has been called we can access the responseXML property.

function loadSync(sUri) {
   var xmlHttp = XmlHttp.create();
   var async = false;
   xmlHttp.open("GET", sUri, async);
   xmlHttp.send(null);
   doSomething(xmlHttp.responseXML); // responseXML : XmlDocument
}

Posting an XML file

To post an XML document to the server we once again use the XmlHttp object. To do this one only needs to pass the XmlDocument as the argument to the send method.

function postAsync(sUri, xmlDoc) {
   var xmlHttp = XmlHttp.create();
   var async = true;
   xmlHttp.open("GET", sUri, async);
   xmlHttp.onreadystatechange = function () {
      if (xmlHttp.readyState == 4)
         doSomething(xmlHttp.responseXML); // responseXML : XmlDocument
   }
   xmlHttp.send(xmlDoc);
}

Loading a text file

The XmlHttp object also allows you to read non XML files. This is done in almost exactly the same way as one reads XML files but instead of looking at the responseXML property one looks at responseText.

function loadTextSync(sUri) {
   var xmlHttp = XmlHttp.create();
   var async = false;
   xmlHttp.open("GET", sUri, async);
   xmlHttp.send(null);
   doSomething(xmlHttp.responseText); // responseText : String
}

Using XmlDocument

The XmlDocument can be used in almost exactly the same was as one uses the normal document object in DHTML. As long as one uses standard DOM methods and properties no problems should arise. Below is a simple example that creates a document, parses a string and then finds all test elements and alerts their name.

var doc = XmlDocument.create();
doc.loadXML( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
   "<root>" +
      "<test name=\"Test 1\"/>" +
      "<test name=\"Test 2\"/>" +
   "</root>");

var testEls = doc.getElementsByTagName("test");
for (var i = 0; i < testEls.length; i++)
   alert(tests[i].getAttribute("name"));

Load using XmlDocument

One can also load an xml file from the server using an XmlDocument object. This is done using the load method. To make the loading asychronous one sets the property async to true of the XmlDocument object. When using asynchronous loading wait until the readyState is 4.

function loadAsync2(sUri) {
   var doc = XmlDocument.create();
   doc.async = true;
   doc.onreadystatechange = function () {
      if (doc.readyState == 4)
         alert(doc.xml); // doc.xml : String
   }
   doc.load(sUri);
}

Demo

The demo page allows you to load a few different xml files as well as enter some text and load non xml files. When outputting an XMl tree the xml document is traversed and some color coded html is generated.

Try the demo

Xml Extras
Usage
Demo
Download

Author: Erik Arvidsson

xmlextras-20060529/xmlextras.html000066400000000000000000000253761137633467400167620ustar00rootroot00000000000000 Xml Extras (WebFX)
Licensed under the Apache Software License 2.0

This component may be obtained, modified and distributed free of charge for personal as well as commercial use. Please see the license for the complete terms and exact wording.

(2006-05-29) Changed license to Apache Software License 2.0.

Introduction

The usage of XML is everywhere. The usage of XML inside the browser has been around for a while but not until lately has it been possible to get this to work in a satisfactory way in more than one browser. A while back Mozilla added support for creating MS compatible XML classes scriptable from JavaScript.

This script creates a common interface for Mozilla and IE and also extends the Mozilla classes a little to make them behave even more like the Microsoft interfaces.

XML in IE

In IE there are two useful ActiveX objects that are marked as safe for scripting. These objects use the MSXML XML parser and are created like this:

var xmlDocument = new ActiveXObject("MsXml2.XmlDom");
var xmlHttp = new ActiveXObject("MsXml2.XmlHttp");

The first object is an XML document that allows you to add new nodes to, using standard DOM1 Core methods. There are also a few extra methods provided by this object that allows you to load (get) an XML document from a file or from a string.

The second of these objects allows you to post an XML document to the server and the reply from the server is sent back to the XML HTTP request object. This allows you to post XML data to the server without leaving the current page.

XML in Mozilla

Mozilla uses W3C compatible technologies whenever there is one. In the case of creating an XML document there happens to be a standard way to do this that was introduced in DOM Level 2. This uses the createDocument method of the DOMImplementation interface.

document.implementation.createDocument(sNameSpaceUri, sQualifiedName, oDoctype);
// in the simplest case it can be used as below
document.implementation.createDocument("", "", null);

This creates an XmlDocument and one can use any DOM (level 1, 2 and 3) methods supported by Mozilla. Mozilla also decided to add the method load that allows you to load an XML document from a file (to be compatible with MS).

Mozilla also has support for XML http request objects. In this case Mozilla tried to implement as much as possible of the MS equivalent object but since this is not part of any W3C standard a special JS contructor is provided. Below is the code to create an XML http request object.

new XMLHttpRequest();

Implementation

The implementation creates two factory classes, called XmlDocument and XmlHttp. Both these classes have a static method (class method, shared method) called create that creates an instance object of the right type.

var xmlDoc  = XmlDocument.create();
var xmlHttp = XmlHttp.create();

XmlHttp

// XmlHttp factory
function XmlHttp() {}

XmlHttp.create = function () {
   try {
      if (window.XMLHttpRequest) {
         var req = new XMLHttpRequest();

         // some older versions of Moz did not support the readyState property
         // and the onreadystate event so we patch it!
         if (req.readyState == null) {
            req.readyState = 1;
            req.addEventListener("load", function () {
               req.readyState = 4;
               if (typeof req.onreadystatechange == "function")
                  req.onreadystatechange();
            }, false);
         }

         return req;
      }
      if (window.ActiveXObject) {
         return new ActiveXObject(getControlPrefix() + ".XmlHttp");
      }
   }
   catch (ex) {}
   // fell through
   throw new Error("Your browser does not support XmlHttp objects");
};

If one removes the extra handling of the onreadystate event for Mozilla the static method create just checks the support of the browser and uses the supported mechanism to create an instance of the desired object. If the current version of Mozilla does not support the readyState property we know that it does not support the onreadystate event so we listen to the onload event and once that occurs we call the custom event handler (if provided).

XmlDocument

// XmlDocument factory
function XmlDocument() {}

XmlDocument.create = function () {
   try {
      // DOM2
      if (document.implementation && document.implementation.createDocument) {
         var doc = document.implementation.createDocument("", "", null);

         // some versions of Moz do not support the readyState property
         // and the onreadystate event so we patch it!
         if (doc.readyState == null) {
            doc.readyState = 1;
            doc.addEventListener("load", function () {
               doc.readyState = 4;
               if (typeof doc.onreadystatechange == "function")
                  doc.onreadystatechange();
            }, false);
         }

         return doc;
      }
      if (window.ActiveXObject)
         return new ActiveXObject(getControlPrefix() + ".XmlDom");
   }
   catch (ex) {}
   throw new Error("Your browser does not support XmlDocument objects");
};

In this case the same extra handling to support onreadystatechange is added but except for this the create method should be fairly straight forward.

getControlPrefix

Different versions of IE and Windows has different version of the MSXML parser installed and therefore we have created a litte helper function that checks which control prefix works in the user's version of IE. This function tries to create both the "XmlHttp" and "XmlDom" ActiveX objects and once it finds a prefix that works it stores that so that it does not have to try that again. If no valid control prefix is found an exception is thrown. The version independent control prefix is "MSXML2" and that is what is tried first. After that a few other prefixes are tested.

function getControlPrefix() {
   if (getControlPrefix.prefix)
      return getControlPrefix.prefix;

   var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];
   var o, o2;
   for (var i = 0; i < prefixes.length; i++) {
      try {
         // try to create the objects
         o = new ActiveXObject(prefixes[i] + ".XmlHttp");
         o2 = new ActiveXObject(prefixes[i] + ".XmlDom");
         return getControlPrefix.prefix = prefixes[i];
      }
      catch (ex) {};
   }

   throw new Error("Could not find an installed XML parser");
}

Extending Mozilla

For a general article about extending the Mozilla DOM see the IE Emu articles.

We would like to be able to use the loadXML method on the XmlDocument that takes a string and parses that as XML. The Mozilla version of XmlDocument does not support that natively so we extend the prototype of the Document to support this. To parse an XML string in Mozilla one can use the built in DOMParser object.

To load the document with an XML string we first parse the string and after that we remove all the nodes of the original tree and inserts all of the nodes from the document we got from the parsed string.

Document.prototype.loadXML = function (s) {

   // parse the string to a new doc
   var doc2 = (new DOMParser()).parseFromString(s, "text/xml");

   // remove all initial children
   while (this.hasChildNodes())
      this.removeChild(this.lastChild);

   // insert and import nodes
   for (var i = 0; i < doc2.childNodes.length; i++) {
      this.appendChild(this.importNode(doc2.childNodes[i], true));
   }
};

There is one more important feature that the Mozilla native version of the XML document is missing and that is a a way to serialize the DOM tree to an XML string. Fortunately the Mozilla developers have realized this and provided a class that can do this easily (even if creating a serializer using JS is fairly easy). This is done by using a class called XMLSerializer. In IE the XML document has a property called xml that returns the DOM tree serialized to an XML string so we define a setter on the Document.prototype that returns this.

Document.prototype.__defineGetter__("xml", function () {
   return (new XMLSerializer()).serializeToString(this);
});

Documentation

The best documentation for the XmlDocument is probably the W3C DOM level 1, 2 and 3 but MS has an easier to read documentation at MSDN. Mozilla.org has a project page covering the extra XML features it provides.

Xml Extras
Usage
Demo
Download

Author: Erik Arvidsson

xmlextras-20060529/xmlextras.js000066400000000000000000000136431137633467400164240ustar00rootroot00000000000000/*----------------------------------------------------------------------------\ | XML Extras | |-----------------------------------------------------------------------------| | Created by Erik Arvidsson | | (http://webfx.eae.net/contact.html#erik) | | For WebFX (http://webfx.eae.net/) | |-----------------------------------------------------------------------------| | XML and XML HTTP request abstraction. | |-----------------------------------------------------------------------------| | Copyright (c) 2001, 2002, 2003, 2006 Erik Arvidsson | |-----------------------------------------------------------------------------| | Licensed under the Apache License, Version 2.0 (the "License"); you may not | | use this file except in compliance with the License. You may obtain a copy | | of the License at http://www.apache.org/licenses/LICENSE-2.0 | | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | | Unless required by applicable law or agreed to in writing, software | | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | | License for the specific language governing permissions and limitations | | under the License. | |-----------------------------------------------------------------------------| | 2001-09-27 | Original Version Posted. | | 2006-05-29 | Changed license to Apache Software License 2.0. | |-----------------------------------------------------------------------------| | Created 2001-09-27 | All changes are in the log above. | Updated 2006-05-29 | \----------------------------------------------------------------------------*/ //