亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? xml_parser.m

?? matlab數(shù)字信號處理工具箱
?? M
字號:
function tree = xml_parser(xmlstr)
% XML (eXtensible Markup Language) Processor
% FORMAT tree = xml_parser(xmlstr)
%
% xmlstr  - XML string to parse
% tree    - tree structure corresponding to the XML file
%_______________________________________________________________________
%
% xml_parser.m is an XML 1.0 (http://www.w3.org/TR/REC-xml) parser
% written in Matlab. It aims to be fully conforming. It is currently not
% a validating XML processor.
%
% A description of the tree structure provided in output is detailed in 
% the header of this m-file.
%_______________________________________________________________________
% @(#)xml_parser.m              Guillaume Flandin            2002/04/04

% XML Processor for MATLAB (The Mathworks, Inc.).
% Copyright (C) 2002-2003 Guillaume Flandin
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
% 
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation Inc, 59 Temple Pl. - Suite 330, Boston, MA 02111-1307, USA.
%-----------------------------------------------------------------------

% Please feel free to email the author any comment/suggestion/bug report
% to improve this XML processor in Matlab.
% Email: Guillaume.Flandin@sophia.inria.fr
% Check also the latest developments on the following webpage:
% http://www-sop.inria.fr/epidaure/personnel/flandin/xml/
%-----------------------------------------------------------------------

% The implementation of this XML parser is much inspired from a 
% Javascript parser available at http://www.jeremie.com

% A mex-file xml_findstr.c is also required, to encompass some
% limitations of the built-in findstr Matlab function.
% Compile it on your architecture using 'mex -O xml_findstr.c' command
% if the compiled version for your system is not provided.
% If this function behaves badly (crash or wrong results), comment the
% line '#define __HACK_MXCHAR__' in xml_findstr.c and compile it again.
%-----------------------------------------------------------------------

% Structure of the output tree:
% There are 5 types of nodes in an XML file: element, chardata, cdata,
% pi and comment.
% Each of them contains an UID (Unique Identifier): an integer between
% 1 and the number of nodes of the XML file.
%
%    element (a tag <name key="value"> [contents] </name>
%       |_ type:       'element'
%       |_ name:       string
%       |_ attributes: cell array of struct 'key' and 'value' or []
%       |_ contents:   double array of uid's or [] if empty
%       |_ parent:     uid of the parent ([] if root)
%       |_ uid:        double
%
%    chardata (a character array)
%       |_ type:   'chardata'
%       |_ value:  string
%       |_ parent: uid of the parent
%       |_ uid:    double
%
%    cdata (a litteral string <![CDATA[value]]>)
%       |_ type:   'cdata'
%       |_ value:  string
%       |_ parent: uid of the parent
%       |_ uid:    double
%
%      pi (a processing instruction <?target value ?>)
%       |_ type:   'pi' 
%       |_ target: string (may be empty)
%       |_ value:  string
%       |_ parent: uid of the parent
%       |_ uid:    double
%
%    comment (a comment <!-- value -->)
%       |_ type:   'comment'
%       |_ value:  string
%       |_ parent: uid of the parent
%       |_ uid:    double
%
%-----------------------------------------------------------------------

% TODO/BUG/FEATURES:
%  - [compile] only a warning if TagStart is empty ?
%  - [attribution] should look for " and ' rather than only "
%  - [main] with normalize as a preprocessing, CDATA are modified
%  - [prolog] look for a DOCTYPE in the whole string even if it occurs
%    only in a far CDATA tag, bug even if the doctype is inside a comment
%  - [tag_element] erode should replace normalize here
%  - remove globals? uppercase globals  rather persistent (clear mfile)?
%  - xml_findstr is indeed xml_strfind according to Mathworks vocabulary
%  - problem with entities: do we need to convert them here? (&eacute;)
%-----------------------------------------------------------------------

%- XML string to parse and number of tags read
global xmlstring Xparse_count xtree;

%- Check input arguments
error(nargchk(1,1,nargin));
if isempty(xmlstr)
	error('[XML] Not enough parameters.')
elseif ~isstr(xmlstr) | sum(size(xmlstr)>1)>1
	error('[XML] Input must be a string.')
end

%- Initialize number of tags (<=> uid)
Xparse_count = 0;

%- Remove prolog and white space characters from the XML string
xmlstring = normalize(prolog(xmlstr));

%- Initialize the XML tree
xtree = {};
tree = fragment;
tree.str = 1;
tree.parent = 0;

%- Parse the XML string
tree = compile(tree);

%- Return the XML tree
tree = xtree;

%- Remove global variables from the workspace
clear global xmlstring Xparse_count xtree;

%=======================================================================
% SUBFUNCTIONS

%-----------------------------------------------------------------------
function frag = compile(frag)
	global xmlstring xtree Xparse_count;
	
	while 1,
		if length(xmlstring)<=frag.str | ...
		   (frag.str == length(xmlstring)-1 & strcmp(xmlstring(frag.str:end),' '))
			return
		end
		TagStart = xml_findstr(xmlstring,'<',frag.str,1);
		if isempty(TagStart)
			%- Character data
			error(sprintf(['[XML] Unknown data at the end of the XML file.\n' ...
			'      Please send me your XML file at flandin@sophia.inria.fr']));
			xtree{Xparse_count} = chardata;
			xtree{Xparse_count}.value = erode(entity(xmlstring(frag.str:end)));
			xtree{Xparse_count}.parent = frag.parent;
			xtree{frag.parent}.contents = [xtree{frag.parent}.contents Xparse_count];
			frag.str = '';
		elseif TagStart > frag.str
			if strcmp(xmlstring(frag.str:TagStart-1),' ')
				%- A single white space before a tag (ignore)
				frag.str = TagStart;
			else
				%- Character data
				xtree{Xparse_count} = chardata;
				xtree{Xparse_count}.value = erode(entity(xmlstring(frag.str:TagStart-1)));
				xtree{Xparse_count}.parent = frag.parent;
				xtree{frag.parent}.contents = [xtree{frag.parent}.contents Xparse_count];
				frag.str = TagStart;
			end
		else 
			if strcmp(xmlstring(frag.str+1),'?')
				%- Processing instruction
				frag = tag_pi(frag);
			else
				if length(xmlstring)-frag.str>4 & strcmp(xmlstring(frag.str+1:frag.str+3),'!--')
					%- Comment
					frag = tag_comment(frag);
				else
					if length(xmlstring)-frag.str>9 & strcmp(xmlstring(frag.str+1:frag.str+8),'![CDATA[')
						%- Litteral data
						frag = tag_cdata(frag);
					else
						%- A tag element (empty (<.../>) or not)
						if ~isempty(frag.end)
							endmk = ['/' frag.end '>'];
						else 
							endmk = '/>';
						end
						if strcmp(xmlstring(frag.str+1:frag.str+length(frag.end)+2),endmk) | ...
							strcmp(strip(xmlstring(frag.str+1:frag.str+length(frag.end)+2)),endmk)
							frag.str = frag.str + length(frag.end)+3;
							return
						else
							frag = tag_element(frag);
						end
					end
				end
			end
		end
	end

%-----------------------------------------------------------------------
function frag = tag_element(frag)
	global xmlstring xtree Xparse_count;
	close =  xml_findstr(xmlstring,'>',frag.str,1);
	if isempty(close)
		error('[XML] Tag < opened but not closed.');
	else
		empty = strcmp(xmlstring(close-1:close),'/>');
		if empty
			close = close - 1;
		end
		starttag = normalize(xmlstring(frag.str+1:close-1));
		nextspace = xml_findstr(starttag,' ',1,1);
		attribs = '';
		if isempty(nextspace)
			name = starttag;
		else
			name = starttag(1:nextspace-1);
			attribs = starttag(nextspace+1:end);
		end
		xtree{Xparse_count} = element;
		xtree{Xparse_count}.name = strip(name);
		if frag.parent
			xtree{Xparse_count}.parent = frag.parent;
			xtree{frag.parent}.contents = [xtree{frag.parent}.contents Xparse_count];
		end
		if length(attribs) > 0
			xtree{Xparse_count}.attributes = attribution(attribs);
		end
		if ~empty
			contents = fragment;
			contents.str = close+1;
			contents.end = name;
			contents.parent = Xparse_count;
			contents = compile(contents);
			frag.str = contents.str;
		else
			frag.str = close+2;
		end
	end

%-----------------------------------------------------------------------
function frag = tag_pi(frag)
	global xmlstring xtree Xparse_count;
	close = xml_findstr(xmlstring,'?>',frag.str,1);
	if isempty(close)
		warning('[XML] Tag <? opened but not closed.')
	else
		nextspace = xml_findstr(xmlstring,' ',frag.str,1);
		xtree{Xparse_count} = pri;
		if nextspace > close | nextspace == frag.str+2
			xtree{Xparse_count}.value = erode(xmlstring(frag.str+2:close-1));
		else
			xtree{Xparse_count}.value = erode(xmlstring(nextspace+1:close-1));
			xtree{Xparse_count}.target = erode(xmlstring(frag.str+2:nextspace));
		end
		if frag.parent
			xtree{frag.parent}.contents = [xtree{frag.parent}.contents Xparse_count];
			xtree{Xparse_count}.parent = frag.parent;
		end
		frag.str = close+2;
	end

%-----------------------------------------------------------------------
function frag = tag_comment(frag)
	global xmlstring xtree Xparse_count;
	close = xml_findstr(xmlstring,'-->',frag.str,1);
	if isempty(close)
		warning('[XML] Tag <!-- opened but not closed.')
	else
		xtree{Xparse_count} = comment;
		xtree{Xparse_count}.value = erode(xmlstring(frag.str+4:close-1));
		if frag.parent
			xtree{frag.parent}.contents = [xtree{frag.parent}.contents Xparse_count];
			xtree{Xparse_count}.parent = frag.parent;
		end
		frag.str = close+3;
	end

%-----------------------------------------------------------------------
function frag = tag_cdata(frag)
	global xmlstring xtree Xparse_count;
	close = xml_findstr(xmlstring,']]>',frag.str,1);
	if isempty(close)
		warning('[XML] Tag <![CDATA[ opened but not closed.')
	else
		xtree{Xparse_count} = cdata;
		xtree{Xparse_count}.value = xmlstring(frag.str+9:close-1);
		if frag.parent
			xtree{frag.parent}.contents = [xtree{frag.parent}.contents Xparse_count];
			xtree{Xparse_count}.parent = frag.parent;
		end
		frag.str = close+3;
	end

%-----------------------------------------------------------------------
function all = attribution(str)
	%- Initialize attributs
	nbattr = 0;
	all = cell(nbattr);
	%- Look for 'key="value"' substrings
	while 1,
		eq = xml_findstr(str,'=',1,1);
		if isempty(str) | isempty(eq), return; end
		id = xml_findstr(str,'"',1,1);       % should also look for ''''
		nextid = xml_findstr(str,'"',id+1,1);% rather than only '"'
		nbattr = nbattr + 1;
		all{nbattr}.key = strip(str(1:(eq-1)));
		all{nbattr}.val = entity(str((id+1):(nextid-1)));
		str = str((nextid+1):end);
	end

%-----------------------------------------------------------------------
function elm = element
	global Xparse_count;
	Xparse_count = Xparse_count + 1;
	elm = struct('type','element','name','','attributes',[],'contents',[],'parent',[],'uid',Xparse_count);
   
%-----------------------------------------------------------------------
function cdat = chardata
	global Xparse_count;
	Xparse_count = Xparse_count + 1;
	cdat = struct('type','chardata','value','','parent',[],'uid',Xparse_count);
   
%-----------------------------------------------------------------------
function cdat = cdata
	global Xparse_count;
	Xparse_count = Xparse_count + 1;
	cdat = struct('type','cdata','value','','parent',[],'uid',Xparse_count);
   
%-----------------------------------------------------------------------
function proce = pri
	global Xparse_count;
	Xparse_count = Xparse_count + 1;
	proce = struct('type','pi','value','','target','','parent',[],'uid',Xparse_count);

%-----------------------------------------------------------------------
function commt = comment
	global Xparse_count;
	Xparse_count = Xparse_count + 1;
	commt = struct('type','comment','value','','parent',[],'uid',Xparse_count);

%-----------------------------------------------------------------------
function frg = fragment
	frg = struct('str','','parent','','end','');

%-----------------------------------------------------------------------
function str = prolog(str)
	%- Initialize beginning index of elements tree
	b = 1;
	%- Initial tag
	start = xml_findstr(str,'<',1,1);
	if isempty(start) 
		error('[XML] No tag found.')
	end
	%- Header (<?xml version="1.0" ... ?>)
	if strcmp(lower(str(start:start+2)),'<?x')
		close = xml_findstr(str,'?>',1,1);
		if ~isempty(close) 
			b = close + 2;
		else 
			warning('[XML] Header tag incomplete.')
		end
	end
	%- Doctype (<!DOCTYPE type ... [ declarations ]>)
	start = xml_findstr(str,'<!DOCTYPE',b,1);  % length('<!DOCTYPE') = 9
	if ~isempty(start) 
		close = xml_findstr(str,'>',start+9,1);
		if ~isempty(close)
			b = close + 1;
			dp = xml_findstr(str,'[',start+9,1);
			if (~isempty(dp) & dp < b)
				k = xml_findstr(str,']>',start+9,1);
				if ~isempty(k)
					b = k + 2;
				else
					warning('[XML] Tag [ in DOCTYPE opened but not closed.')
				end
			end
		else
			warning('[XML] Tag DOCTYPE opened but not closed.')
		end
	end
	%- Skip prolog from the xml string
	str = str(b:end);

%-----------------------------------------------------------------------
function str = strip(str)
	a = isspace(str);
	a = find(a==1);
	str(a) = '';

%-----------------------------------------------------------------------
function str = normalize(str)
	% Find white characters (space, newline, carriage return, tabs, ...)
	i = isspace(str);
	i = find(i == 1);
	str(i) = ' ';
	% replace several white characters by only one
	if ~isempty(i)
		j = i - [i(2:end) i(end)];
		k = find(j == -1);
		str(i(k)) = [];
	end

%-----------------------------------------------------------------------
function str = entity(str)
	str = strrep(str,'&lt;','<');
	str = strrep(str,'&gt;','>');
	str = strrep(str,'&quot;','"');
	str = strrep(str,'&apos;','''');
	str = strrep(str,'&amp;','&');
   
%-----------------------------------------------------------------------
function str = erode(str)
	if ~isempty(str) & str(1)==' ' str(1)=''; end;
	if ~isempty(str) & str(end)==' ' str(end)=''; end;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久蜜桃av一区精品变态类天堂 | 国产亚洲人成网站| 日韩二区三区四区| 欧美一区日本一区韩国一区| 天天综合色天天| 欧美成人三级在线| 国产盗摄一区二区| 国产精品女主播av| 欧美中文字幕不卡| 全国精品久久少妇| 26uuu精品一区二区在线观看| 精品一区二区av| 国产精品天天摸av网| 91免费视频网址| 午夜精品久久久久久久| 精品国产伦理网| 99久久国产综合精品色伊| 亚洲国产精品久久久男人的天堂| 欧美日韩三级在线| 国产精品综合久久| 亚洲女人小视频在线观看| 欧美精品日韩一区| 国产乱子伦一区二区三区国色天香| 中日韩免费视频中文字幕| 色诱亚洲精品久久久久久| 日本aⅴ亚洲精品中文乱码| 国产丝袜欧美中文另类| 在线看不卡av| 激情五月激情综合网| 综合久久给合久久狠狠狠97色 | 亚洲一区中文日韩| 日韩精品一区二区三区视频| 99精品在线免费| 日本不卡一区二区三区高清视频| 久久久精品国产免大香伊| 欧美无人高清视频在线观看| 国产一区二区三区日韩| 亚洲图片欧美色图| 日本一区二区三区在线不卡| 欧美老肥妇做.爰bbww视频| 国产精品一区免费视频| 午夜精品久久久| 国产精品久久精品日日| 日韩一区二区精品葵司在线| 99精品视频在线播放观看| 全国精品久久少妇| 一区二区三区在线不卡| 久久亚洲二区三区| 精品视频资源站| 成人高清视频在线| 裸体在线国模精品偷拍| 亚洲国产中文字幕| 国产精品灌醉下药二区| 精品福利av导航| 欧美放荡的少妇| 色综合久久久网| 国产剧情一区二区三区| 日本 国产 欧美色综合| 亚洲一区二区中文在线| 中文字幕一区二区视频| 国产日韩综合av| 精品88久久久久88久久久| 欧美精品第1页| 欧美三级一区二区| 色一区在线观看| 成人综合婷婷国产精品久久| 精久久久久久久久久久| 奇米在线7777在线精品| 婷婷久久综合九色国产成人| 亚洲一线二线三线视频| 伊人色综合久久天天人手人婷| 国产精品婷婷午夜在线观看| 亚洲精品一线二线三线| 欧美成人高清电影在线| 欧美大片日本大片免费观看| 欧美精三区欧美精三区| 欧美日本一区二区在线观看| 欧美综合视频在线观看| 色欧美片视频在线观看在线视频| 99国产欧美久久久精品| 不卡视频免费播放| 高清不卡一区二区| 国产成人午夜视频| 国产91在线观看| 丰满放荡岳乱妇91ww| 成人福利视频在线看| 成人免费毛片app| 高清国产一区二区| 成人av手机在线观看| 色综合天天做天天爱| 色拍拍在线精品视频8848| 欧美亚洲动漫另类| 欧美疯狂做受xxxx富婆| 欧美tickling挠脚心丨vk| 久久久亚洲精品石原莉奈| 国产午夜三级一区二区三| 国产精品久久久久天堂| 中文字幕亚洲欧美在线不卡| 亚洲黄色性网站| 午夜精品久久久久久久99樱桃| 蜜臀av性久久久久蜜臀av麻豆| 国产一区二区三区四| 成人黄色小视频在线观看| 91免费版在线看| 欧美久久婷婷综合色| 日韩精品中文字幕一区| 国产欧美日韩三区| 亚洲免费观看高清| 奇米一区二区三区av| 国产精品99久久久久久似苏梦涵| 不卡一区二区三区四区| 欧美丰满美乳xxx高潮www| 久久精品亚洲精品国产欧美| 日韩一区在线播放| 青草av.久久免费一区| 国产丶欧美丶日本不卡视频| 91福利视频久久久久| 日韩欧美亚洲一区二区| 国产精品毛片无遮挡高清| 亚洲成人动漫在线观看| 国产精品白丝jk白祙喷水网站| 91啪在线观看| 精品免费一区二区三区| 亚洲码国产岛国毛片在线| 日韩精品视频网| 成人一区二区视频| 欧美喷水一区二区| 国产精品二三区| 偷窥国产亚洲免费视频 | 成人av网站免费| 欧美顶级少妇做爰| 亚洲视频小说图片| 韩国欧美一区二区| 欧美日韩精品一区视频| 中文字幕的久久| 美女一区二区三区在线观看| 91网站黄www| 久久青草欧美一区二区三区| 亚洲成a人片综合在线| 91在线视频免费91| 久久久美女毛片| 免费在线欧美视频| 欧美日韩一区二区在线观看视频| 久久久三级国产网站| 美女视频黄免费的久久 | 久久女同互慰一区二区三区| 国产精品色一区二区三区| 免费观看日韩电影| 欧美日韩亚洲另类| 亚洲黄色av一区| 99精品热视频| 久久久久国色av免费看影院| 日本在线不卡视频| 欧美日韩一级片网站| 亚洲精品免费视频| 成人深夜福利app| 久久久综合九色合综国产精品| 美女精品自拍一二三四| 337p亚洲精品色噜噜狠狠| 亚洲一区免费视频| 欧美性生活影院| 亚洲综合图片区| 色噜噜狠狠一区二区三区果冻| 国产精品色眯眯| 成人精品一区二区三区中文字幕| 久久综合成人精品亚洲另类欧美 | 国产成人免费视| 久久久美女毛片| 国产精品一区在线观看你懂的| 欧美大胆人体bbbb| 国内久久精品视频| 亚洲精品在线观| 国产精品99久久不卡二区| 精品福利二区三区| 国产精品99久久久久| 久久久精品天堂| 国产白丝网站精品污在线入口| 国产亚洲一区二区在线观看| 国产伦精品一区二区三区在线观看| 久久网站最新地址| 东方欧美亚洲色图在线| 国产精品女同一区二区三区| 91视频观看免费| 亚洲影视在线播放| 9191成人精品久久| 狠狠色综合日日| 久久精品亚洲乱码伦伦中文| 国产91在线看| 亚洲美女免费视频| 欧美一区二区视频在线观看2020 | 久久精品这里都是精品| 国产999精品久久久久久绿帽| 国产精品美女久久久久高潮| 91亚洲永久精品| 午夜精品123| 久久一留热品黄| av欧美精品.com| 天天色天天爱天天射综合| 精品乱码亚洲一区二区不卡| 成人激情校园春色|