This file is indexed.

/usr/include/ticcutils/XMLtools.h is in libticcutils2-dev 0.4-5.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*
  $Id: XMLtools.h 15892 2013-04-03 08:49:18Z sloot $
  $URL: https://ilk.uvt.nl/svn/sources/libticcutils/trunk/include/ticcutils/XMLtools.h $

  Copyright (c) 1998 - 2013
  ILK   - Tilburg University
  CLiPS - University of Antwerp
 
  This file is part of ticcutils

  timbl 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.

  timbl 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, see <http://www.gnu.org/licenses/>.

  For questions and suggestions, see:
      http://ilk.uvt.nl/software.html
  or send mail to:
      timbl@uvt.nl
*/

#ifndef TICC_XML_TOOLS_H
#define TICC_XML_TOOLS_H

#include <string>
#include <map>
#include <list>
#include "libxml/tree.h"

namespace TiCC {

  inline xmlNode *XmlNewNode( const std::string& elem ){
    return xmlNewNode( 0, (const xmlChar*)elem.c_str() );
  }
  
  inline xmlNode *XmlNewNode( xmlNs *ns, const std::string& elem ){
    return xmlNewNode( ns, (const xmlChar*)elem.c_str() );
  }
  
  inline xmlNode *XmlNewComment( const std::string& elem ){
    return xmlNewComment( (const xmlChar*)elem.c_str() );
  }
  
  inline xmlNode *XmlNewChild( xmlNode *node, 
			       const std::string& elem ){
    xmlNode *chld = xmlNewNode( 0, (const xmlChar*)elem.c_str() );
    return xmlAddChild( node, chld );
  }

  inline xmlNode *XmlNewChild( xmlNode *node, 
			       xmlNs *ns,
			       const std::string& elem ){
    xmlNode *chld = xmlNewNode( ns, (const xmlChar*)elem.c_str() );
    return xmlAddChild( node, chld );
  }

  inline xmlNode *XmlNewTextChild( xmlNode *node, 
				   const std::string& elem, 
				   const std::string& val ){
    if ( val.empty() )
      return xmlNewTextChild( node, 0, (xmlChar*)elem.c_str(), 0 );
    else 
      return xmlNewTextChild( node, 0, 
			      (const xmlChar*)elem.c_str(),
			      (const xmlChar*)val.c_str() );
  }

  inline xmlNode *XmlNewTextChild( xmlNode *node, 
				   xmlNs *ns,
				   const std::string& elem, 
				   const std::string& val ){
    if ( val.empty() )
      return xmlNewTextChild( node, ns,
			      (xmlChar*)elem.c_str(), 0 );
    else 
      return xmlNewTextChild( node, ns,
			      (const xmlChar*)elem.c_str(),
			      (const xmlChar*)val.c_str() );
  }

  inline void XmlAddContent( xmlNode *node, const std::string& cont ){
    xmlNodeAddContent( node, (const xmlChar*)cont.c_str() );
  }
  
  inline xmlAttr *XmlSetAttribute( xmlNode *node, 
				   const std::string& att,
				   const std::string& val ){
    return xmlSetProp( node, 
		       (const xmlChar*)att.c_str(), 
		       (const xmlChar*)val.c_str() );
  }
  
  inline std::string getAttribute( const xmlNode *node, 
				   const std::string& att ){
    if ( node ){
      xmlAttr *a = node->properties;
      while ( a ){
	if ( att == (char*)a->name )
	  return (char *)a->children->content;
	a = a->next;
      }
    }
    return "";
  }

  std::string getNS( const xmlNode *, std::string& );
  inline std::string getNS( const xmlNode *n ) {
    std::string s;
    return getNS( n, s);
  }

  std::map<std::string,std::string> getNSvalues( const xmlNode * );

  std::string serialize( const xmlNode& node );

  inline std::string Name( const xmlNode *node ){
    std::string result;
    if ( node ){
      result = (char *)node->name;
    }
    return result;
  }

  inline std::string XmlContent( const xmlNode *node ){
    std::string result;
    if ( node ){
      xmlChar *tmp = xmlNodeListGetString( node->doc, node->children, 1 );
      if ( tmp ){
	result = std::string( (char *)tmp );
	xmlFree( tmp );
      }
    }
    return result;
  }

  class XmlDoc {
    friend std::ostream& operator << ( std::ostream& , const XmlDoc& );
  public:
    XmlDoc( const std::string& );
    ~XmlDoc(){
      xmlFreeDoc( the_doc );
    }
    void setRoot( xmlNode* );
    xmlNode *getRoot() const;
    xmlNode *MakeRoot( const std::string& );
    const std::string toString() const;
  private:
    xmlDoc *the_doc;
  };

  inline std::ostream& operator << ( std::ostream& os, const XmlDoc& doc ){
    os << doc.toString();
    return os;
  }

  inline std::ostream& operator << ( std::ostream& os, const xmlNode& node ){
    os << serialize( node );
    return os;
  }

  inline std::ostream& operator << ( std::ostream& os, const xmlNode *node ){
    os << serialize( *node );
    return os;
  }

  std::list<xmlNode*> FindNodes( xmlNode *, const std::string& );
  xmlNode *xPath( xmlNode *, const std::string& );

} // namespace TiCC

#endif