comparison m-toolbox/html_help/help/read_item.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function read_item(ch, fd)
2
3 % Reads each item in the TOC and makes a nested html list.
4 %
5 % M Hewitson 24-07-07
6 %
7 % $Id: read_item.m,v 1.2 2007/08/14 09:23:01 ingo Exp $
8 %
9
10 children = ch.getChildNodes;
11
12 % Go through children of AO object
13 for j=1:children.getLength
14
15 ch = children.item(j-1);
16
17 if ch.getNodeType ~= ch.COMMENT_NODE
18
19 childs = ch.getChildNodes;
20
21 nodeName = char(ch.getNodeName);
22
23 txtcon = deblank(char(ch.getTextContent));
24
25 if childs.getLength >= 1
26 fprintf(fd, '<ul>\n');
27 read_item(ch, fd);
28 fprintf(fd, '</ul>\n');
29 elseif ~isempty(txtcon)
30 % check if this node has a target attribute
31 p = ch.getParentNode;
32 att = p.getAttributes;
33 if ~isempty(att)
34 target = deblank(char(att.getNamedItem('target')));
35 if ~isempty(target)
36 fprintf(fd, '<li><a %s>%s</a></li>\n', strrep(target, 'target', 'href'), txtcon);
37 else
38 fprintf(fd, '<li>%s</li>\n', txtcon);
39 end
40 else
41 fprintf(fd, '<li>%s</li>\n', txtcon);
42 end
43 else
44 end
45
46 end
47
48 end