xml-parser.js

来自「原名JSPackager」· JavaScript 代码 · 共 47 行

JS
47
字号
var ie5 = "test".replace(/\w+/,'$&') == "$&";

/**
 * @public
 * @constructor
 * @param <String> source
 */
function XMLParser(source){
  this.initialize(source);
}

$JSI.extend(XMLParser,SourceParser);
//ECMAParser.prototype = new SourceParser();

/**
 * keywords Regexp.
 * default is for javascript 
 * @protected
 */
XMLParser.prototype.setKeywordsGroup({'':
['']});
/**

	   (<!\[CDATA\[\s*.*\s*\]\]>)
	   | (<!--\s*.*\s*?-->)
	   | (<)*(\w+)*\s*(\w+)\s*=\s*(".*?"|'.*?'|\w+)(/*>)*
	   | (</?)(.*?)(/?>)
 * partitions Regexp.
 * default is for javascript 
 * @protected
 */
 
var notCdata = "[^\\]]|\\][^\\]]|\\]\\][^>]";
var id = '[\\w_][\\w\\d-_.]*';
var str = '"(?:\\\\.|[^"\\n\\r])*"|'+"'(?:\\\\.|[^'\\n\\r])*'";
XMLParser.prototype.setPartitionsGroup(
{
      'cdata':'<\\!\\[[\\w]*\\['+notCdata+'\\]\\]>'//cdata
      ,'processor':'<\\?(?:[^\\?]|\\?[^>])*\\?>'//processor
      ,'comment':'<!--(?:[^-]|-[^-])*-->'//comment
      ,'begin':'<'+id+'(?:\\s+'+id+'\\s*=\\s*'+str+')*\\s*/?>' //string
      ,'end':'</'+id+'>'             //process
}
);
//ECMAParser.prototype = new SourceParser();
//<![ ... [ ... ]]>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?