changeset 12077:c3665ffaa17d octave-forge

CR/LF -> LF
author prnienhuis
date Sun, 29 Sep 2013 15:43:11 +0000
parents 7b27813ba4fc
children c544136f77aa
files main/io/inst/getxmlattv.m main/io/inst/getxmlnode.m
diffstat 2 files changed, 103 insertions(+), 103 deletions(-) [+]
line wrap: on
line diff
--- a/main/io/inst/getxmlattv.m	Sun Sep 29 15:42:36 2013 +0000
+++ b/main/io/inst/getxmlattv.m	Sun Sep 29 15:43:11 2013 +0000
@@ -1,47 +1,47 @@
-## Copyright (C) 2013 Philip Nienhuis
-## 
-## 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 3 of the License, or
-## (at your option) 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 Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*- 
-## @deftypefn {Function File} [@var{retval}] = getxmlattv (@var{xmlnode}, @var{att})
-## Get value of attribute @var{att} in xml node in string @var{xmlnode}.
-## of an xml string, return empty if attribute isn't present.
-##
-## @seealso{}
-## @end deftypefn
-
-## Author: Philip Nienhuis <prnienhuis@ at users.sf.net>
-## Created: 2013-09-08
-
-function [retval] = getxmlattv (xmlnode, att)
-
-  retval = '';
-
-  ## Get end of first tag
-  iend = index (xmlnode, ">");
-  ## Get start of value string. Concat '="' to ensure minimal ambiguity
-  vals = index (xmlnode, [att '="']);
-  if (vals == 0)
-    ## Attribute not in current tag
-    return
-  elseif (vals)
-    vals = vals + length (att) + 2;
-    vale = regexp (xmlnode(vals:end), '"[ >/]');
-    if (! isempty (vale))
-      retval = xmlnode(vals:vals+vale-2);
-    endif
-  endif
-
-endfunction
+## Copyright (C) 2013 Philip Nienhuis
+## 
+## 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 3 of the License, or
+## (at your option) 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 Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*- 
+## @deftypefn {Function File} [@var{retval}] = getxmlattv (@var{xmlnode}, @var{att})
+## Get value of attribute @var{att} in xml node in string @var{xmlnode}.
+## of an xml string, return empty if attribute isn't present.
+##
+## @seealso{}
+## @end deftypefn
+
+## Author: Philip Nienhuis <prnienhuis@ at users.sf.net>
+## Created: 2013-09-08
+
+function [retval] = getxmlattv (xmlnode, att)
+
+  retval = '';
+
+  ## Get end of first tag
+  iend = index (xmlnode, ">");
+  ## Get start of value string. Concat '="' to ensure minimal ambiguity
+  vals = index (xmlnode, [att '="']);
+  if (vals == 0)
+    ## Attribute not in current tag
+    return
+  elseif (vals)
+    vals = vals + length (att) + 2;
+    vale = regexp (xmlnode(vals:end), '"[ >/]');
+    if (! isempty (vale))
+      retval = xmlnode(vals:vals+vale-2);
+    endif
+  endif
+
+endfunction
--- a/main/io/inst/getxmlnode.m	Sun Sep 29 15:42:36 2013 +0000
+++ b/main/io/inst/getxmlnode.m	Sun Sep 29 15:43:11 2013 +0000
@@ -1,56 +1,56 @@
-## Copyright (C) 2013 Philip Nienhuis
-## 
-## 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 3 of the License, or
-## (at your option) 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 Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*- 
-## @deftypefn {Function File} {@var{node} =} getxmlnode (@var{xml}, @var{nname})
-## @deftypefnx {Function File} {@var{node} =} getxmlnode (@var{xml}, @var{nname}, @var{is})
-## Get string representing the first xml node @var{nname} from xml file in
-## string @var{xml}, optionally starting at position @var{is}, and return
-## start and end indices.
-##
-## @seealso{}
-## @end deftypefn
-
-## Author: Philip Nienhuis <prnienhuis at users.sf.net>
-## Created: 2013-09-08
-
-function [ node, spos, epos ] = getxmlnode (xml, nname, is=1)
-
-  node = '';
-  spos = index (xml(is:end), ["<" nname]);
-  if (spos)
-    ## Apparently a node exists. Get its end. Maybe it is a single node
-    ## ending in "/>"
-    epos = index (xml(is+spos:end), "/>");
-    ## Do check if the "/>" really belongs to this node
-    if ((! epos) || index (xml(is+spos:is+spos+epos), "><"))
-      ## Apparently it is a composite node 
-      epos = index (xml(is+spos:end), ["</" nname ">"]);
-      if (! epos)
-        ## Apparently the xml is invalid?
-        error ("getxmlnode: couldn't find matching end tag for %s", nname);
-      endif
-      epos = is + spos + epos + length (nname) + 1;
-    else
-      epos = is + spos + epos;
-    endif
-    spos = is + spos - 1;
-    node = xml(spos:epos);
-  else
-    epos = 0;
-  endif
-
-endfunction
+## Copyright (C) 2013 Philip Nienhuis
+## 
+## 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 3 of the License, or
+## (at your option) 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 Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*- 
+## @deftypefn {Function File} {@var{node} =} getxmlnode (@var{xml}, @var{nname})
+## @deftypefnx {Function File} {@var{node} =} getxmlnode (@var{xml}, @var{nname}, @var{is})
+## Get string representing the first xml node @var{nname} from xml file in
+## string @var{xml}, optionally starting at position @var{is}, and return
+## start and end indices.
+##
+## @seealso{}
+## @end deftypefn
+
+## Author: Philip Nienhuis <prnienhuis at users.sf.net>
+## Created: 2013-09-08
+
+function [ node, spos, epos ] = getxmlnode (xml, nname, is=1)
+
+  node = '';
+  spos = index (xml(is:end), ["<" nname]);
+  if (spos)
+    ## Apparently a node exists. Get its end. Maybe it is a single node
+    ## ending in "/>"
+    epos = index (xml(is+spos:end), "/>");
+    ## Do check if the "/>" really belongs to this node
+    if ((! epos) || index (xml(is+spos:is+spos+epos), "><"))
+      ## Apparently it is a composite node 
+      epos = index (xml(is+spos:end), ["</" nname ">"]);
+      if (! epos)
+        ## Apparently the xml is invalid?
+        error ("getxmlnode: couldn't find matching end tag for %s", nname);
+      endif
+      epos = is + spos + epos + length (nname) + 1;
+    else
+      epos = is + spos + epos;
+    endif
+    spos = is + spos - 1;
+    node = xml(spos:epos);
+  else
+    epos = 0;
+  endif
+
+endfunction