buxViewer.js.uncompressed.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. require({cache:{
  2. 'dijit/form/Textarea':function(){
  3. define("dijit/form/Textarea", [
  4. "dojo/_base/declare", // declare
  5. "dojo/dom-style", // domStyle.set
  6. "./_ExpandingTextAreaMixin",
  7. "./SimpleTextarea"
  8. ], function(declare, domStyle, _ExpandingTextAreaMixin, SimpleTextarea){
  9. /*=====
  10. var _ExpandingTextAreaMixin = dijit.form._ExpandingTextAreaMixin;
  11. var SimpleTextarea = dijit.form.SimpleTextarea;
  12. =====*/
  13. // module:
  14. // dijit/form/Textarea
  15. // summary:
  16. // A textarea widget that adjusts it's height according to the amount of data.
  17. return declare("dijit.form.Textarea", [SimpleTextarea, _ExpandingTextAreaMixin], {
  18. // summary:
  19. // A textarea widget that adjusts it's height according to the amount of data.
  20. //
  21. // description:
  22. // A textarea that dynamically expands/contracts (changing it's height) as
  23. // the user types, to display all the text without requiring a scroll bar.
  24. //
  25. // Takes nearly all the parameters (name, value, etc.) that a vanilla textarea takes.
  26. // Rows is not supported since this widget adjusts the height.
  27. //
  28. // example:
  29. // | <textarea data-dojo-type="dijit.form.TextArea">...</textarea>
  30. // TODO: for 2.0, rename this to ExpandingTextArea, and rename SimpleTextarea to TextArea
  31. baseClass: "dijitTextBox dijitTextArea dijitExpandingTextArea",
  32. // Override SimpleTextArea.cols to default to width:100%, for backward compatibility
  33. cols: "",
  34. buildRendering: function(){
  35. this.inherited(arguments);
  36. // tweak textarea style to reduce browser differences
  37. domStyle.set(this.textbox, { overflowY: 'hidden', overflowX: 'auto', boxSizing: 'border-box', MsBoxSizing: 'border-box', WebkitBoxSizing: 'border-box', MozBoxSizing: 'border-box' });
  38. }
  39. });
  40. });
  41. },
  42. 'dijit/form/_ExpandingTextAreaMixin':function(){
  43. define("dijit/form/_ExpandingTextAreaMixin", [
  44. "dojo/_base/declare", // declare
  45. "dojo/dom-construct", // domConstruct.create
  46. "dojo/_base/lang", // lang.hitch
  47. "dojo/_base/window" // win.body
  48. ], function(declare, domConstruct, lang, win){
  49. // module:
  50. // dijit/form/_ExpandingTextAreaMixin
  51. // summary:
  52. // Mixin for textarea widgets to add auto-expanding capability
  53. // feature detection
  54. var needsHelpShrinking;
  55. return declare("dijit.form._ExpandingTextAreaMixin", null, {
  56. // summary:
  57. // Mixin for textarea widgets to add auto-expanding capability
  58. _setValueAttr: function(){
  59. this.inherited(arguments);
  60. this.resize();
  61. },
  62. postCreate: function(){
  63. this.inherited(arguments);
  64. var textarea = this.textbox;
  65. if(needsHelpShrinking == undefined){
  66. var te = domConstruct.create('textarea', {rows:"5", cols:"20", value: ' ', style: {zoom:1, fontSize:"12px", height:"96px", overflow:'hidden', visibility:'hidden', position:'absolute', border:"5px solid white", margin:"0", padding:"0", boxSizing: 'border-box', MsBoxSizing: 'border-box', WebkitBoxSizing: 'border-box', MozBoxSizing: 'border-box' }}, win.body(), "last");
  67. needsHelpShrinking = te.scrollHeight >= te.clientHeight;
  68. win.body().removeChild(te);
  69. }
  70. this.connect(textarea, "onresize", "_resizeLater");
  71. this.connect(textarea, "onfocus", "_resizeLater");
  72. textarea.style.overflowY = "hidden";
  73. },
  74. startup: function(){
  75. this.inherited(arguments);
  76. this._resizeLater();
  77. },
  78. _onInput: function(e){
  79. this.inherited(arguments);
  80. this.resize();
  81. },
  82. _estimateHeight: function(){
  83. // summary:
  84. // Approximate the height when the textarea is invisible with the number of lines in the text.
  85. // Fails when someone calls setValue with a long wrapping line, but the layout fixes itself when the user clicks inside so . . .
  86. // In IE, the resize event is supposed to fire when the textarea becomes visible again and that will correct the size automatically.
  87. //
  88. var textarea = this.textbox;
  89. // #rows = #newlines+1
  90. textarea.rows = (textarea.value.match(/\n/g) || []).length + 1;
  91. },
  92. _resizeLater: function(){
  93. this.defer("resize");
  94. },
  95. resize: function(){
  96. // summary:
  97. // Resizes the textarea vertically (should be called after a style/value change)
  98. var textarea = this.textbox;
  99. function textareaScrollHeight(){
  100. var empty = false;
  101. if(textarea.value === ''){
  102. textarea.value = ' ';
  103. empty = true;
  104. }
  105. var sh = textarea.scrollHeight;
  106. if(empty){ textarea.value = ''; }
  107. return sh;
  108. }
  109. if(textarea.style.overflowY == "hidden"){ textarea.scrollTop = 0; }
  110. if(this.busyResizing){ return; }
  111. this.busyResizing = true;
  112. if(textareaScrollHeight() || textarea.offsetHeight){
  113. var newH = textareaScrollHeight() + Math.max(textarea.offsetHeight - textarea.clientHeight, 0);
  114. var newHpx = newH + "px";
  115. if(newHpx != textarea.style.height){
  116. textarea.style.height = newHpx;
  117. textarea.rows = 1; // rows can act like a minHeight if not cleared
  118. }
  119. if(needsHelpShrinking){
  120. var origScrollHeight = textareaScrollHeight(),
  121. newScrollHeight = origScrollHeight,
  122. origMinHeight = textarea.style.minHeight,
  123. decrement = 4, // not too fast, not too slow
  124. thisScrollHeight,
  125. origScrollTop = textarea.scrollTop;
  126. textarea.style.minHeight = newHpx; // maintain current height
  127. textarea.style.height = "auto"; // allow scrollHeight to change
  128. while(newH > 0){
  129. textarea.style.minHeight = Math.max(newH - decrement, 4) + "px";
  130. thisScrollHeight = textareaScrollHeight();
  131. var change = newScrollHeight - thisScrollHeight;
  132. newH -= change;
  133. if(change < decrement){
  134. break; // scrollHeight didn't shrink
  135. }
  136. newScrollHeight = thisScrollHeight;
  137. decrement <<= 1;
  138. }
  139. textarea.style.height = newH + "px";
  140. textarea.style.minHeight = origMinHeight;
  141. textarea.scrollTop = origScrollTop;
  142. }
  143. textarea.style.overflowY = textareaScrollHeight() > textarea.clientHeight ? "auto" : "hidden";
  144. if(textarea.style.overflowY == "hidden"){ textarea.scrollTop = 0; }
  145. }else{
  146. // hidden content of unknown size
  147. this._estimateHeight();
  148. }
  149. this.busyResizing = false;
  150. }
  151. });
  152. });
  153. },
  154. 'dijit/form/SimpleTextarea':function(){
  155. define("dijit/form/SimpleTextarea", [
  156. "dojo/_base/declare", // declare
  157. "dojo/dom-class", // domClass.add
  158. "dojo/_base/sniff", // has("ie") has("opera")
  159. "dojo/_base/window", // win.doc.selection win.doc.selection.createRange
  160. "./TextBox"
  161. ], function(declare, domClass, has, win, TextBox){
  162. /*=====
  163. var TextBox = dijit.form.TextBox;
  164. =====*/
  165. // module:
  166. // dijit/form/SimpleTextarea
  167. // summary:
  168. // A simple textarea that degrades, and responds to
  169. // minimal LayoutContainer usage, and works with dijit.form.Form.
  170. // Doesn't automatically size according to input, like Textarea.
  171. return declare("dijit.form.SimpleTextarea", TextBox, {
  172. // summary:
  173. // A simple textarea that degrades, and responds to
  174. // minimal LayoutContainer usage, and works with dijit.form.Form.
  175. // Doesn't automatically size according to input, like Textarea.
  176. //
  177. // example:
  178. // | <textarea data-dojo-type="dijit.form.SimpleTextarea" name="foo" value="bar" rows=30 cols=40></textarea>
  179. //
  180. // example:
  181. // | new dijit.form.SimpleTextarea({ rows:20, cols:30 }, "foo");
  182. baseClass: "dijitTextBox dijitTextArea",
  183. // rows: Number
  184. // The number of rows of text.
  185. rows: "3",
  186. // rows: Number
  187. // The number of characters per line.
  188. cols: "20",
  189. templateString: "<textarea ${!nameAttrSetting} data-dojo-attach-point='focusNode,containerNode,textbox' autocomplete='off'></textarea>",
  190. postMixInProperties: function(){
  191. // Copy value from srcNodeRef, unless user specified a value explicitly (or there is no srcNodeRef)
  192. // TODO: parser will handle this in 2.0
  193. if(!this.value && this.srcNodeRef){
  194. this.value = this.srcNodeRef.value;
  195. }
  196. this.inherited(arguments);
  197. },
  198. buildRendering: function(){
  199. this.inherited(arguments);
  200. if(has("ie") && this.cols){ // attribute selectors is not supported in IE6
  201. domClass.add(this.textbox, "dijitTextAreaCols");
  202. }
  203. },
  204. filter: function(/*String*/ value){
  205. // Override TextBox.filter to deal with newlines... specifically (IIRC) this is for IE which writes newlines
  206. // as \r\n instead of just \n
  207. if(value){
  208. value = value.replace(/\r/g,"");
  209. }
  210. return this.inherited(arguments);
  211. },
  212. _onInput: function(/*Event?*/ e){
  213. // Override TextBox._onInput() to enforce maxLength restriction
  214. if(this.maxLength){
  215. var maxLength = parseInt(this.maxLength);
  216. var value = this.textbox.value.replace(/\r/g,'');
  217. var overflow = value.length - maxLength;
  218. if(overflow > 0){
  219. var textarea = this.textbox;
  220. if(textarea.selectionStart){
  221. var pos = textarea.selectionStart;
  222. var cr = 0;
  223. if(has("opera")){
  224. cr = (this.textbox.value.substring(0,pos).match(/\r/g) || []).length;
  225. }
  226. this.textbox.value = value.substring(0,pos-overflow-cr)+value.substring(pos-cr);
  227. textarea.setSelectionRange(pos-overflow, pos-overflow);
  228. }else if(win.doc.selection){ //IE
  229. textarea.focus();
  230. var range = win.doc.selection.createRange();
  231. // delete overflow characters
  232. range.moveStart("character", -overflow);
  233. range.text = '';
  234. // show cursor
  235. range.select();
  236. }
  237. }
  238. }
  239. this.inherited(arguments);
  240. }
  241. });
  242. });
  243. },
  244. 'dojox/xml/DomParser':function(){
  245. define("dojox/xml/DomParser", [
  246. "dojo/_base/kernel",// dojo.getObject
  247. "dojo/_base/array" // dojo.forEach
  248. ], function(dojo){
  249. dojo.getObject("xml", true, dojox);
  250. dojox.xml.DomParser=new (function(){
  251. /**********************************************************
  252. * The DomParser is a close-to (but not entirely)
  253. * conforming XML parser based on regular
  254. * expressions. It will take any XML fragment
  255. * and return a lightweight JS structure that is
  256. * similar to (but not exactly) the DOM specification.
  257. *
  258. * Getter and setter methods are NOT available; the goal
  259. * was to keep the resulting object model entirely JS-like.
  260. *
  261. * All node types but document fragments are supported;
  262. * all nodes support getElementsByTagName and
  263. * getElementsByTagNameNS (with short names byName and
  264. * byNameNS). The document node supports getElementById
  265. * (byId), and all nodes support a supplimental
  266. * childrenByName/childrenByNameNS method as well.
  267. *
  268. * The object model is intended to be a READONLY format;
  269. * mutation events are NOT supported, and though you
  270. * can change properties on a node-by-node basis, certain
  271. * operations are not supported (such as changing the ID
  272. * of an element).
  273. **********************************************************/
  274. // internal use only.
  275. var nodeTypes={ ELEMENT:1, ATTRIBUTE:2, TEXT:3, CDATA_SECTION:4, PROCESSING_INSTRUCTION:7, COMMENT:8, DOCUMENT:9 };
  276. // compile the regular expressions once.
  277. var reTags=/<([^>\/\s+]*)([^>]*)>([^<]*)/g;
  278. var reAttr=/([^=]*)=(("([^"]*)")|('([^']*)'))/g; // patch from tdedischew AT gmail, with additional grouping
  279. var reEntity=/<!ENTITY\s+([^"]*)\s+"([^"]*)">/g;
  280. var reCData=/<!\[CDATA\[([\u0001-\uFFFF]*?)\]\]>/g;
  281. var reComments=/<!--([\u0001-\uFFFF]*?)-->/g;
  282. var trim=/^\s+|\s+$/g;
  283. var normalize=/\s+/g;
  284. var egt=/\&gt;/g;
  285. var elt=/\&lt;/g;
  286. var equot=/\&quot;/g;
  287. var eapos=/\&apos;/g;
  288. var eamp=/\&amp;/g;
  289. var dNs="_def_";
  290. // create a root node.
  291. function _doc(){
  292. return new (function(){
  293. var all={};
  294. this.nodeType=nodeTypes.DOCUMENT;
  295. this.nodeName="#document";
  296. this.namespaces={};
  297. this._nsPaths={};
  298. this.childNodes=[];
  299. this.documentElement=null;
  300. // any element with an ID attribute will be added to the internal hashtable.
  301. this._add=function(obj){
  302. if(typeof(obj.id)!="undefined"){ all[obj.id]=obj; }
  303. };
  304. this._remove=function(id){
  305. if(all[id]){ delete all[id]; }
  306. };
  307. this.byId=this.getElementById=function(id){ return all[id]; };
  308. this.byName=this.getElementsByTagName=byName;
  309. this.byNameNS=this.getElementsByTagNameNS=byNameNS;
  310. this.childrenByName=childrenByName;
  311. this.childrenByNameNS=childrenByNameNS;
  312. })();
  313. }
  314. // functions attached to element nodes
  315. function byName(name){
  316. // return all descendants with name. Fully qualified (i.e. svg:svg)
  317. function __(node, name, arr){
  318. dojo.forEach(node.childNodes, function(c){
  319. if(c.nodeType==nodeTypes.ELEMENT){
  320. if(name=="*"){ arr.push(c); }
  321. else if(c.nodeName==name){ arr.push(c); }
  322. __(c, name, arr);
  323. }
  324. });
  325. }
  326. var a=[];
  327. __(this, name, a);
  328. return a;
  329. }
  330. function byNameNS(name, ns){
  331. // return all descendants with name by namespace. If no namespace passed, the default is used.
  332. function __(node, name, ns, arr){
  333. dojo.forEach(node.childNodes, function(c){
  334. if(c.nodeType==nodeTypes.ELEMENT){
  335. if(name=="*"&&c.ownerDocument._nsPaths[ns]==c.namespace){ arr.push(c); }
  336. else if(c.localName==name&&c.ownerDocument._nsPaths[ns]==c.namespace){ arr.push(c); }
  337. __(c, name, ns, arr);
  338. }
  339. });
  340. }
  341. if(!ns){ ns=dNs; }
  342. var a=[];
  343. __(this, name, ns, a);
  344. return a;
  345. }
  346. // Only child nodes with name.
  347. function childrenByName(name){
  348. var a=[];
  349. dojo.forEach(this.childNodes, function(c){
  350. if(c.nodeType==nodeTypes.ELEMENT){
  351. if(name=="*"){ a.push(c); }
  352. else if(c.nodeName==name){ a.push(c); }
  353. }
  354. });
  355. return a;
  356. }
  357. function childrenByNameNS(name, ns){
  358. var a=[];
  359. dojo.forEach(this.childNodes, function(c){
  360. if(c.nodeType==nodeTypes.ELEMENT){
  361. if(name=="*"&&c.ownerDocument._nsPaths[ns]==c.namespace){ a.push(c); }
  362. else if(c.localName==name&&c.ownerDocument._nsPaths[ns]==c.namespace){ a.push(c); }
  363. }
  364. });
  365. return a;
  366. }
  367. function _createTextNode(v){
  368. return {
  369. nodeType:nodeTypes.TEXT,
  370. nodeName:"#text",
  371. nodeValue:v.replace(normalize," ").replace(egt,">").replace(elt,"<").replace(eapos,"'").replace(equot,'"').replace(eamp,"&")
  372. };
  373. }
  374. // attribute functions
  375. function getAttr(name){
  376. for(var i=0; i<this.attributes.length; i++){
  377. if(this.attributes[i].nodeName==name){
  378. return this.attributes[i].nodeValue;
  379. }
  380. }
  381. return null;
  382. }
  383. function getAttrNS(name, ns){
  384. for(var i=0; i<this.attributes.length; i++){
  385. if(this.ownerDocument._nsPaths[ns]==this.attributes[i].namespace
  386. &&this.attributes[i].localName==name
  387. ){
  388. return this.attributes[i].nodeValue;
  389. }
  390. }
  391. return null;
  392. }
  393. // note that you can only swap IDs using setAttribute, NOT with setAttributeNS.
  394. function setAttr(name, val){
  395. var old=null;
  396. for(var i=0; i<this.attributes.length; i++){
  397. if(this.attributes[i].nodeName==name){
  398. old=this.attributes[i].nodeValue;
  399. this.attributes[i].nodeValue=val;
  400. break;
  401. }
  402. }
  403. if(name=="id"){
  404. if(old!=null){ this.ownerDocument._remove(old); }
  405. this.ownerDocument._add(this);
  406. }
  407. }
  408. function setAttrNS(name, val, ns){
  409. for(var i=0; i<this.attributes.length; i++){
  410. if(this.ownerDocument._nsPaths[ns]==this.attributes[i].namespace
  411. &&this.attributes[i].localName==name
  412. ){
  413. this.attributes[i].nodeValue=val;
  414. return;
  415. }
  416. }
  417. }
  418. // navigation
  419. function prev(){
  420. var p=this.parentNode;
  421. if(p){
  422. for(var i=0;i<p.childNodes.length;i++){
  423. if(p.childNodes[i]==this&&i>0){
  424. return p.childNodes[i-1];
  425. }
  426. }
  427. }
  428. return null;
  429. }
  430. function next(){
  431. var p=this.parentNode;
  432. if(p){
  433. for(var i=0;i<p.childNodes.length;i++){
  434. if(p.childNodes[i]==this&&(i+1)<p.childNodes.length){
  435. return p.childNodes[i+1];
  436. }
  437. }
  438. }
  439. return null;
  440. }
  441. // the main method.
  442. this.parse=function(/* String */str){
  443. var root=_doc();
  444. if(str==null){ return root; }
  445. if(str.length==0){ return root; }
  446. // preprocess custom entities
  447. if(str.indexOf("<!ENTITY")>0){
  448. var entity, eRe=[];
  449. if(reEntity.test(str)){
  450. reEntity.lastIndex=0;
  451. // match entities
  452. while((entity=reEntity.exec(str))!=null){
  453. eRe.push({
  454. entity:"&"+entity[1].replace(trim,"")+";",
  455. expression:entity[2]
  456. });
  457. }
  458. // replace instances in the document.
  459. for(var i=0; i<eRe.length; i++){
  460. str=str.replace(new RegExp(eRe[i].entity, "g"), eRe[i].expression);
  461. }
  462. }
  463. }
  464. // pre-parse for CData, and tokenize.
  465. var cdSections=[], cdata;
  466. while((cdata=reCData.exec(str))!=null){ cdSections.push(cdata[1]); }
  467. for(var i=0; i<cdSections.length; i++){ str=str.replace(cdSections[i], i); }
  468. // pre-parse for comments, and tokenize.
  469. var comments=[], comment;
  470. while((comment=reComments.exec(str))!=null){ comments.push(comment[1]); }
  471. for(i=0; i<comments.length; i++){ str=str.replace(comments[i], i); }
  472. // parse the document
  473. var res, obj=root;
  474. while((res=reTags.exec(str))!=null){
  475. // closing tags.
  476. if(res[2].charAt(0)=="/" && res[2].replace(trim, "").length>1){
  477. if(obj.parentNode){
  478. obj=obj.parentNode;
  479. }
  480. var text=(res[3]||"").replace(trim, "");
  481. if(text.length>0) {
  482. obj.childNodes.push(_createTextNode(text));
  483. }
  484. }
  485. // open tags.
  486. else if(res[1].length>0){
  487. // figure out the type of node.
  488. if(res[1].charAt(0)=="?"){
  489. // processing instruction
  490. var name=res[1].substr(1);
  491. var target=res[2].substr(0,res[2].length-2);
  492. obj.childNodes.push({
  493. nodeType:nodeTypes.PROCESSING_INSTRUCTION,
  494. nodeName:name,
  495. nodeValue:target
  496. });
  497. }
  498. else if(res[1].charAt(0)=="!"){
  499. // CDATA; skip over any declaration elements.
  500. if(res[1].indexOf("![CDATA[")==0){
  501. var val=parseInt(res[1].replace("![CDATA[","").replace("]]",""));
  502. obj.childNodes.push({
  503. nodeType:nodeTypes.CDATA_SECTION,
  504. nodeName:"#cdata-section",
  505. nodeValue:cdSections[val]
  506. });
  507. }
  508. // Comments.
  509. else if(res[1].substr(0,3)=="!--"){
  510. var val=parseInt(res[1].replace("!--","").replace("--",""));
  511. obj.childNodes.push({
  512. nodeType:nodeTypes.COMMENT,
  513. nodeName:"#comment",
  514. nodeValue:comments[val]
  515. });
  516. }
  517. }
  518. else {
  519. // Elements (with attribute and text)
  520. var name=res[1].replace(trim,"");
  521. var o={
  522. nodeType:nodeTypes.ELEMENT,
  523. nodeName:name,
  524. localName:name,
  525. namespace:dNs,
  526. ownerDocument:root,
  527. attributes:[],
  528. parentNode:null,
  529. childNodes:[]
  530. };
  531. // check to see if it's namespaced.
  532. if(name.indexOf(":")>-1){
  533. var t=name.split(":");
  534. o.namespace=t[0];
  535. o.localName=t[1];
  536. }
  537. // set the function references.
  538. o.byName=o.getElementsByTagName=byName;
  539. o.byNameNS=o.getElementsByTagNameNS=byNameNS;
  540. o.childrenByName=childrenByName;
  541. o.childrenByNameNS=childrenByNameNS;
  542. o.getAttribute=getAttr;
  543. o.getAttributeNS=getAttrNS;
  544. o.setAttribute=setAttr;
  545. o.setAttributeNS=setAttrNS;
  546. o.previous=o.previousSibling=prev;
  547. o.next=o.nextSibling=next;
  548. // parse the attribute string.
  549. var attr;
  550. while((attr=reAttr.exec(res[2]))!=null){
  551. if(attr.length>0){
  552. var name=attr[1].replace(trim,"");
  553. var val=(attr[4]||attr[6]||"").replace(normalize," ")
  554. .replace(egt,">")
  555. .replace(elt,"<")
  556. .replace(eapos,"'")
  557. .replace(equot,'"')
  558. .replace(eamp,"&");
  559. if(name.indexOf("xmlns")==0){
  560. if(name.indexOf(":")>0){
  561. var ns=name.split(":");
  562. root.namespaces[ns[1]]=val;
  563. root._nsPaths[val]=ns[1];
  564. } else {
  565. root.namespaces[dNs]=val;
  566. root._nsPaths[val]=dNs;
  567. }
  568. } else {
  569. var ln=name;
  570. var ns=dNs;
  571. if(name.indexOf(":")>0){
  572. var t=name.split(":");
  573. ln=t[1];
  574. ns=t[0];
  575. }
  576. o.attributes.push({
  577. nodeType:nodeTypes.ATTRIBUTE,
  578. nodeName:name,
  579. localName:ln,
  580. namespace:ns,
  581. nodeValue:val
  582. });
  583. // only add id as a property.
  584. if(ln=="id"){ o.id=val; }
  585. }
  586. }
  587. }
  588. root._add(o);
  589. if(obj){
  590. obj.childNodes.push(o);
  591. o.parentNode=obj;
  592. // if it's not a self-closing node.
  593. if(res[2].charAt(res[2].length-1)!="/"){
  594. obj=o;
  595. }
  596. }
  597. var text=res[3];
  598. if(text.length>0){
  599. obj.childNodes.push(_createTextNode(text));
  600. }
  601. }
  602. }
  603. }
  604. // set the document element
  605. for(var i=0; i<root.childNodes.length; i++){
  606. var e=root.childNodes[i];
  607. if(e.nodeType==nodeTypes.ELEMENT){
  608. root.documentElement=e;
  609. break;
  610. }
  611. }
  612. return root;
  613. };
  614. })();
  615. return dojox.xml.DomParser;
  616. });
  617. }}});
  618. define("dojo/buxViewer", [], 1);