/usr/include/vtk-6.3/vtkXMLParser.h is in libvtk6-dev 6.3.0+dfsg1-5.
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkXMLParser.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkXMLParser - Parse XML to handle element tags and attributes.
// .SECTION Description
// vtkXMLParser reads a stream and parses XML element tags and corresponding
// attributes. Each element begin tag and its attributes are sent to
// the StartElement method. Each element end tag is sent to the
// EndElement method. Subclasses should replace these methods to actually
// use the tags.
// .SECTION ToDo: Add commands for parsing in Tcl.
#ifndef vtkXMLParser_h
#define vtkXMLParser_h
#include "vtkIOXMLParserModule.h" // For export macro
#include "vtkObject.h"
extern "C"
{
void vtkXMLParserStartElement(void*, const char*, const char**);
void vtkXMLParserEndElement(void*, const char*);
void vtkXMLParserCharacterDataHandler(void*, const char*, int);
}
class VTKIOXMLPARSER_EXPORT vtkXMLParser : public vtkObject
{
public:
vtkTypeMacro(vtkXMLParser,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
static vtkXMLParser* New();
//BTX
// Description:
// Get/Set the input stream.
vtkSetMacro(Stream, istream*);
vtkGetMacro(Stream, istream*);
// Description:
// Used by subclasses and their supporting classes. These methods
// wrap around the tellg and seekg methods of the input stream to
// work-around stream bugs on various platforms.
vtkTypeInt64 TellG();
void SeekG(vtkTypeInt64 position);
//ETX
// Description:
// Parse the XML input.
virtual int Parse();
// Description:
// Parse the XML message. If length is specified, parse only the
// first "length" characters
virtual int Parse(const char* inputString);
virtual int Parse(const char* inputString, unsigned int length);
// Description:
// When parsing fragments of XML or streaming XML, use the following
// three methods. InitializeParser method initialize parser but
// does not perform any actual parsing. ParseChunk parses framgent
// of XML. This has to match to what was already
// parsed. CleanupParser finishes parsing. If there were errors,
// CleanupParser will report them.
virtual int InitializeParser();
virtual int ParseChunk(const char* inputString, unsigned int length);
virtual int CleanupParser();
// Description:
// Set and get file name.
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
// Description:
// If this is off (the default), CharacterDataHandler will be called to
// process text within XML Elements. If this is on, the text will be
// ignored.
vtkSetMacro(IgnoreCharacterData, int);
vtkGetMacro(IgnoreCharacterData, int);
// Description:
// Set and get the encoding the parser should expect (NULL defaults to
// Expat's own default encoder, i.e UTF-8).
// This should be set before parsing (i.e. a call to Parse()) or
// even initializing the parser (i.e. a call to InitializeParser())
vtkSetStringMacro(Encoding);
vtkGetStringMacro(Encoding);
protected:
vtkXMLParser();
~vtkXMLParser();
// Input stream. Set by user.
istream* Stream;
// File name to parse
char* FileName;
// Encoding
char* Encoding;
// This variable is true if there was a parse error while parsing in
// chunks.
int ParseError;
// Character message to parse
const char* InputString;
int InputStringLength;
// Expat parser structure. Exists only during call to Parse().
void* Parser;
// Create/Allocate the internal parser (can be overriden by subclasses).
virtual int CreateParser();
// Called by Parse() to read the stream and call ParseBuffer. Can
// be replaced by subclasses to change how input is read.
virtual int ParseXML();
// Called before each block of input is read from the stream to
// check if parsing is complete. Can be replaced by subclasses to
// change the terminating condition for parsing. Parsing always
// stops when the end of file is reached in the stream.
virtual int ParsingComplete();
// Called when a new element is opened in the XML source. Should be
// replaced by subclasses to handle each element.
// name = Name of new element.
// atts = Null-terminated array of attribute name/value pairs.
// Even indices are attribute names, and odd indices are values.
virtual void StartElement(const char* name, const char** atts);
// Called at the end of an element in the XML source opened when
// StartElement was called.
virtual void EndElement(const char* name);
// Called when there is character data to handle.
virtual void CharacterDataHandler(const char* data, int length);
// Called by begin handlers to report any stray attribute values.
virtual void ReportStrayAttribute(const char* element, const char* attr,
const char* value);
// Called by begin handlers to report any missing attribute values.
virtual void ReportMissingAttribute(const char* element, const char* attr);
// Called by begin handlers to report bad attribute values.
virtual void ReportBadAttribute(const char* element, const char* attr,
const char* value);
// Called by StartElement to report unknown element type.
virtual void ReportUnknownElement(const char* element);
// Called by Parse to report an XML syntax error.
virtual void ReportXmlParseError();
// Get the current byte index from the beginning of the XML stream.
vtkTypeInt64 GetXMLByteIndex();
// Send the given buffer to the XML parser.
virtual int ParseBuffer(const char* buffer, unsigned int count);
// Send the given c-style string to the XML parser.
int ParseBuffer(const char* buffer);
// Utility for convenience of subclasses. Wraps isspace C library
// routine.
static int IsSpace(char c);
//BTX
friend void vtkXMLParserStartElement(void*, const char*, const char**);
friend void vtkXMLParserEndElement(void*, const char*);
friend void vtkXMLParserCharacterDataHandler(void*, const char*, int);
//ETX
int IgnoreCharacterData;
private:
vtkXMLParser(const vtkXMLParser&); // Not implemented.
void operator=(const vtkXMLParser&); // Not implemented.
};
//----------------------------------------------------------------------------
inline
void vtkXMLParserCharacterDataHandler(
void* parser,
const char* data,
int length)
{
// Character data handler that is registered with the XML_Parser.
// This just casts the user data to a vtkXMLParser and calls
// CharacterDataHandler.
static_cast<vtkXMLParser*>(parser)->CharacterDataHandler(data, length);
}
#endif
|