ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
vtkPVXMLElement.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkPVXMLElement.cxx
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 #include "vtkPVXMLElement.h"
16 
17 #include "vtkCollection.h"
18 #include "vtkObjectFactory.h"
19 #include "vtkSmartPointer.h"
20 
22 
23 #include <ctype.h>
24 #include <sstream>
25 #include <string>
26 #include <vector>
27 #if defined(_WIN32) && !defined(__CYGWIN__)
28 #define SNPRINTF _snprintf
29 #else
30 #define SNPRINTF snprintf
31 #endif
32 
33 struct vtkPVXMLElementInternals
34 {
35  std::vector<std::string> AttributeNames;
36  std::vector<std::string> AttributeValues;
37  typedef std::vector<vtkSmartPointer<vtkPVXMLElement> > VectorOfElements;
38  VectorOfElements NestedElements;
39  std::string CharacterData;
40 };
41 
42 // Function to check if a string is full of whitespace characters.
43 static bool vtkIsSpace(const std::string& str)
44 {
45  for (std::string::size_type cc = 0; cc < str.length(); ++cc)
46  {
47  if (!isspace(str[cc]))
48  {
49  return false;
50  }
51  }
52  return true;
53 }
54 
55 //----------------------------------------------------------------------------
57 {
58  this->Name = 0;
59  this->Id = 0;
60  this->Parent = 0;
61 
62  this->Internal = new vtkPVXMLElementInternals;
63 }
64 
65 //----------------------------------------------------------------------------
67 {
68  this->SetName(0);
69  this->SetId(0);
70 
71  delete this->Internal;
72 }
73 
74 //----------------------------------------------------------------------------
75 void vtkPVXMLElement::PrintSelf(ostream& os, vtkIndent indent)
76 {
77  this->Superclass::PrintSelf(os, indent);
78  os << indent << "Id: " << (this->Id ? this->Id : "<none>") << endl;
79  os << indent << "Name: " << (this->Name ? this->Name : "<none>") << endl;
80  unsigned int numNested = this->GetNumberOfNestedElements();
81  for (unsigned int i = 0; i < numNested; i++)
82  {
83  if (this->GetNestedElement(i))
84  {
85  this->GetNestedElement(i)->PrintSelf(os, indent.GetNextIndent());
86  }
87  }
88 }
89 
90 //----------------------------------------------------------------------------
91 void vtkPVXMLElement::AddAttribute(const char* attrName, unsigned int attrValue)
92 {
93  std::ostringstream valueStr;
94  valueStr << attrValue << ends;
95  this->AddAttribute(attrName, valueStr.str().c_str());
96 }
97 
98 //----------------------------------------------------------------------------
99 void vtkPVXMLElement::AddAttribute(const char* attrName, int attrValue)
100 {
101  std::ostringstream valueStr;
102  valueStr << attrValue << ends;
103  this->AddAttribute(attrName, valueStr.str().c_str());
104 }
105 
106 #if defined(VTK_USE_64BIT_IDS)
107 //----------------------------------------------------------------------------
108 void vtkPVXMLElement::AddAttribute(const char* attrName, vtkIdType attrValue)
109 {
110  std::ostringstream valueStr;
111  valueStr << attrValue << ends;
112  this->AddAttribute(attrName, valueStr.str().c_str());
113 }
114 #endif
115 
116 //----------------------------------------------------------------------------
117 void vtkPVXMLElement::AddAttribute(const char* attrName, double attrValue)
118 {
119  std::ostringstream valueStr;
120  valueStr << attrValue << ends;
121  this->AddAttribute(attrName, valueStr.str().c_str());
122 }
123 
124 //----------------------------------------------------------------------------
125 void vtkPVXMLElement::AddAttribute(const char* attrName, double attrValue, int precision)
126 {
127  if (precision <= 0)
128  {
129  this->AddAttribute(attrName, attrValue);
130  }
131  else
132  {
133  std::ostringstream valueStr;
134  valueStr << setprecision(precision) << attrValue << ends;
135  this->AddAttribute(attrName, valueStr.str().c_str());
136  }
137 }
138 
139 //----------------------------------------------------------------------------
140 void vtkPVXMLElement::AddAttribute(const char* attrName, const char* attrValue)
141 {
142  if (!attrName || !attrValue)
143  {
144  return;
145  }
146 
147  this->Internal->AttributeNames.push_back(attrName);
148  this->Internal->AttributeValues.push_back(attrValue);
149 }
150 
151 //----------------------------------------------------------------------------
152 void vtkPVXMLElement::SetAttribute(const char* attrName, const char* attrValue)
153 {
154  if (!attrName || !attrValue)
155  {
156  return;
157  }
158 
159  // iterate over the names, and find if the attribute name exists.
160  size_t numAttributes = this->Internal->AttributeNames.size();
161  size_t i;
162  for (i = 0; i < numAttributes; ++i)
163  {
164  if (strcmp(this->Internal->AttributeNames[i].c_str(), attrName) == 0)
165  {
166  this->Internal->AttributeValues[i] = attrValue;
167  return;
168  }
169  }
170  // add the attribute.
171  this->AddAttribute(attrName, attrValue);
172 }
173 
174 //----------------------------------------------------------------------------
175 void vtkPVXMLElement::ReadXMLAttributes(const char** atts)
176 {
177  this->Internal->AttributeNames.clear();
178  this->Internal->AttributeValues.clear();
179 
180  if (atts)
181  {
182  const char** attsIter = atts;
183  unsigned int count = 0;
184  while (*attsIter++)
185  {
186  ++count;
187  }
188  unsigned int numberOfAttributes = count / 2;
189 
190  unsigned int i;
191  for (i = 0; i < numberOfAttributes; ++i)
192  {
193  this->AddAttribute(atts[i * 2], atts[i * 2 + 1]);
194  }
195  }
196 }
197 
198 //----------------------------------------------------------------------------
200 {
201  this->Internal->NestedElements.clear();
202 }
203 
204 //----------------------------------------------------------------------------
206 {
207  std::vector<vtkSmartPointer<vtkPVXMLElement> >::iterator iter =
208  this->Internal->NestedElements.begin();
209  for (; iter != this->Internal->NestedElements.end(); ++iter)
210  {
211  if (iter->GetPointer() == element)
212  {
213  this->Internal->NestedElements.erase(iter);
214  break;
215  }
216  }
217 }
218 
219 //----------------------------------------------------------------------------
221  vtkPVXMLElement* elementToReplace, vtkPVXMLElement* element)
222 {
223  for (auto& elem : this->Internal->NestedElements)
224  {
225  if (elem.GetPointer() == elementToReplace)
226  {
227  elem = element;
228  break;
229  }
230  }
231 }
232 
233 //----------------------------------------------------------------------------
235 {
236  this->AddNestedElement(element, 1);
237 }
238 
239 //----------------------------------------------------------------------------
241 {
242  if (setParent)
243  {
244  element->SetParent(this);
245  }
246  this->Internal->NestedElements.push_back(element);
247 }
248 
249 //----------------------------------------------------------------------------
250 void vtkPVXMLElement::AddCharacterData(const char* data, int length)
251 {
252  this->Internal->CharacterData.append(data, length);
253 }
254 
255 //----------------------------------------------------------------------------
256 const char* vtkPVXMLElement::GetAttributeOrDefault(const char* name, const char* notFound)
257 {
258  size_t numAttributes = this->Internal->AttributeNames.size();
259  size_t i;
260  for (i = 0; i < numAttributes; ++i)
261  {
262  if (strcmp(this->Internal->AttributeNames[i].c_str(), name) == 0)
263  {
264  return this->Internal->AttributeValues[i].c_str();
265  }
266  }
267  return notFound;
268 }
269 //----------------------------------------------------------------------------
271 {
272  return this->Internal->CharacterData.c_str();
273 }
274 
275 //----------------------------------------------------------------------------
277 {
278  this->PrintXML(cout, vtkIndent());
279 }
280 
281 //----------------------------------------------------------------------------
282 void vtkPVXMLElement::PrintXML(ostream& os, vtkIndent indent)
283 {
284  os << indent << "<" << (this->Name ? this->Name : "NoName");
285  size_t numAttributes = this->Internal->AttributeNames.size();
286  size_t i;
287  for (i = 0; i < numAttributes; ++i)
288  {
289  const char* aName = this->Internal->AttributeNames[i].c_str();
290  const char* aValue = this->Internal->AttributeValues[i].c_str();
291 
292  // we always print the encoded value. The expat parser processes encoded
293  // values when reading them, hence we don't need any decoding when reading
294  // the values back.
295  const std::string& sanitizedValue = vtkPVXMLElement::Encode(aValue);
296  os << " " << (aName ? aName : "NoName") << "=\""
297  << (aValue ? sanitizedValue.c_str() : "NoValue") << "\"";
298  }
299  size_t numberOfNestedElements = this->Internal->NestedElements.size();
300  bool hasCdata = !vtkIsSpace(this->Internal->CharacterData);
301 
302  bool childlessNode = (numberOfNestedElements == 0) && (hasCdata == false);
303  if (childlessNode)
304  {
305  os << "/>\n";
306  return;
307  }
308  os << ">";
309  if (numberOfNestedElements > 0)
310  {
311  os << "\n";
312  for (i = 0; i < numberOfNestedElements; ++i)
313  {
314  vtkIndent nextIndent = indent.GetNextIndent();
315  this->Internal->NestedElements[i]->PrintXML(os, nextIndent);
316  }
317  }
318  if (hasCdata)
319  {
320  const std::string& encoded = vtkPVXMLElement::Encode(this->Internal->CharacterData.c_str());
321  os << encoded.c_str();
322  os << "</" << (this->Name ? this->Name : "NoName") << ">\n";
323  }
324  else
325  {
326  os << indent << "</" << (this->Name ? this->Name : "NoName") << ">\n";
327  }
328 }
329 
330 //----------------------------------------------------------------------------
332 {
333  this->Parent = parent;
334 }
335 
336 //----------------------------------------------------------------------------
338 {
339  return this->Parent;
340 }
341 
342 //----------------------------------------------------------------------------
344 {
345  return static_cast<unsigned int>(this->Internal->NestedElements.size());
346 }
347 
348 //----------------------------------------------------------------------------
350 {
351  if (index < this->Internal->NestedElements.size())
352  {
353  return this->Internal->NestedElements[index];
354  }
355  return 0;
356 }
357 
358 //----------------------------------------------------------------------------
360 {
361  return this->LookupElementUpScope(id);
362 }
363 
364 //----------------------------------------------------------------------------
366 {
367  size_t numberOfNestedElements = this->Internal->NestedElements.size();
368  size_t i;
369  for (i = 0; i < numberOfNestedElements; ++i)
370  {
371  const char* nid = this->Internal->NestedElements[i]->GetId();
372  if (nid && strcmp(nid, id) == 0)
373  {
374  return this->Internal->NestedElements[i];
375  }
376  }
377  return 0;
378 }
379 
380 //----------------------------------------------------------------------------
382 {
383  vtkPVXMLElementInternals::VectorOfElements::iterator iter =
384  this->Internal->NestedElements.begin();
385  for (; iter != this->Internal->NestedElements.end(); ++iter)
386  {
387  const char* cur_name = (*iter)->GetName();
388  if (name && cur_name && strcmp(cur_name, name) == 0)
389  {
390  return (*iter);
391  }
392  }
393  return 0;
394 }
395 
396 //----------------------------------------------------------------------------
397 void vtkPVXMLElement::FindNestedElementByName(const char* name, vtkCollection* elements)
398 {
399  // No more that the current children depth
400  this->GetElementsByName(name, elements, false);
401 }
402 
403 //----------------------------------------------------------------------------
405 {
406  // Pull off the first qualifier.
407  const char* end = id;
408  while (*end && (*end != '.'))
409  ++end;
410  unsigned int len = end - id;
411  char* name = new char[len + 1];
412  strncpy(name, id, len);
413  name[len] = '\0';
414 
415  // Find the qualifier in this scope.
416  vtkPVXMLElement* next = this->FindNestedElement(name);
417  if (next && (*end == '.'))
418  {
419  // Lookup rest of qualifiers in nested scope.
420  next = next->LookupElementInScope(end + 1);
421  }
422 
423  delete[] name;
424  return next;
425 }
426 
427 //----------------------------------------------------------------------------
429 {
430  // Pull off the first qualifier.
431  const char* end = id;
432  while (*end && (*end != '.'))
433  ++end;
434  unsigned int len = end - id;
435  char* name = new char[len + 1];
436  strncpy(name, id, len);
437  name[len] = '\0';
438 
439  // Find most closely nested occurrence of first qualifier.
440  vtkPVXMLElement* curScope = this;
441  vtkPVXMLElement* start = 0;
442  while (curScope && !start)
443  {
444  start = curScope->FindNestedElement(name);
445  curScope = curScope->GetParent();
446  }
447  if (start && (*end == '.'))
448  {
449  start = start->LookupElementInScope(end + 1);
450  }
451 
452  delete[] name;
453  return start;
454 }
455 
456 //----------------------------------------------------------------------------
457 int vtkPVXMLElement::GetScalarAttribute(const char* name, int* value)
458 {
459  return this->GetVectorAttribute(name, 1, value);
460 }
461 
462 //----------------------------------------------------------------------------
463 int vtkPVXMLElement::GetScalarAttribute(const char* name, float* value)
464 {
465  return this->GetVectorAttribute(name, 1, value);
466 }
467 
468 //----------------------------------------------------------------------------
469 int vtkPVXMLElement::GetScalarAttribute(const char* name, double* value)
470 {
471  return this->GetVectorAttribute(name, 1, value);
472 }
473 
474 #if defined(VTK_USE_64BIT_IDS)
475 //----------------------------------------------------------------------------
476 int vtkPVXMLElement::GetScalarAttribute(const char* name, vtkIdType* value)
477 {
478  return this->GetVectorAttribute(name, 1, value);
479 }
480 #endif
481 
482 //----------------------------------------------------------------------------
483 template <class T>
484 int vtkPVXMLVectorAttributeParse(const char* str, int length, T* data)
485 {
486  if (!str || !length)
487  {
488  return 0;
489  }
490  std::stringstream vstr;
491  vstr << str << ends;
492  int i;
493  for (i = 0; i < length; ++i)
494  {
495  vstr >> data[i];
496  if (!vstr)
497  {
498  return i;
499  }
500  }
501  return length;
502 }
503 
504 //----------------------------------------------------------------------------
505 int vtkPVXMLElement::GetVectorAttribute(const char* name, int length, int* data)
506 {
507  return vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data);
508 }
509 
510 //----------------------------------------------------------------------------
511 int vtkPVXMLElement::GetVectorAttribute(const char* name, int length, float* data)
512 {
513  return vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data);
514 }
515 
516 //----------------------------------------------------------------------------
517 int vtkPVXMLElement::GetVectorAttribute(const char* name, int length, double* data)
518 {
519  return vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data);
520 }
521 
522 #if defined(VTK_USE_64BIT_IDS)
523 //----------------------------------------------------------------------------
524 int vtkPVXMLElement::GetVectorAttribute(const char* name, int length, vtkIdType* data)
525 {
526  return vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data);
527 }
528 #endif
529 
530 //----------------------------------------------------------------------------
532 {
533  return vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data);
534 }
535 
536 //----------------------------------------------------------------------------
538 {
539  return vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data);
540 }
541 
542 //----------------------------------------------------------------------------
544 {
545  return vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data);
546 }
547 
548 //----------------------------------------------------------------------------
549 void vtkPVXMLElement::GetElementsByName(const char* name, vtkCollection* elements)
550 {
551  this->GetElementsByName(name, elements, true); // We go as deep as possible
552 }
553 
554 //----------------------------------------------------------------------------
555 void vtkPVXMLElement::GetElementsByName(const char* name, vtkCollection* elements, bool recursively)
556 {
557  if (!elements)
558  {
559  vtkErrorMacro("elements cannot be NULL.");
560  return;
561  }
562  if (!name)
563  {
564  vtkErrorMacro("name cannot be NULL.");
565  return;
566  }
567 
568  unsigned int numChildren = this->GetNumberOfNestedElements();
569  unsigned int cc;
570  for (cc = 0; cc < numChildren; cc++)
571  {
572  vtkPVXMLElement* child = this->GetNestedElement(cc);
573  if (child && child->GetName() && strcmp(child->GetName(), name) == 0)
574  {
575  elements->AddItem(child);
576  }
577  }
578 
579  if (recursively)
580  {
581  for (cc = 0; cc < numChildren; cc++)
582  {
583  vtkPVXMLElement* child = this->GetNestedElement(cc);
584  if (child)
585  {
586  child->GetElementsByName(name, elements, recursively);
587  }
588  }
589  }
590 }
591 
592 //----------------------------------------------------------------------------
593 std::string vtkPVXMLElement::Encode(const char* plaintext)
594 {
595  // escape any characters that are not allowed in XML
596  std::string sanitized = "";
597  if (!plaintext)
598  {
599  return sanitized;
600  }
601 
602  const char toescape[] = { '&', '\'', '<', '>', '\"', '\r', '\n', '\t', 0 };
603 
604  size_t pt_length = strlen(plaintext);
605  sanitized.reserve(pt_length);
606  for (size_t cc = 0; cc < pt_length; cc++)
607  {
608  const char* escape_char = toescape;
609  for (; *escape_char != 0; escape_char++)
610  {
611  if (plaintext[cc] == *escape_char)
612  {
613  break;
614  }
615  }
616 
617  if (*escape_char)
618  {
619  char temp[20];
620  SNPRINTF(temp, 20, "&#x%x;", static_cast<int>(*escape_char));
621  sanitized += temp;
622  }
623  else
624  {
625  sanitized += plaintext[cc];
626  }
627  }
628 
629  return sanitized;
630 }
631 
632 #if defined(VTK_USE_64BIT_IDS)
633 //----------------------------------------------------------------------------
634 int vtkPVXMLElement::GetCharacterDataAsVector(int length, vtkIdType* data)
635 {
636  return vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data);
637 }
638 #endif
639 
640 void vtkPVXMLElement::Merge(vtkPVXMLElement* element, const char* attributeName)
641 {
642  if (!element || 0 != strcmp(this->GetName(), element->GetName()))
643  {
644  return;
645  }
646  if (attributeName)
647  {
648  const char* attr1 = this->GetAttribute(attributeName);
649  const char* attr2 = element->GetAttribute(attributeName);
650  if (attr1 && attr2 && 0 != strcmp(attr1, attr2))
651  {
652  return;
653  }
654  }
655 
656  // override character data if there is some
657  if (!element->Internal->CharacterData.empty())
658  {
659  this->Internal->CharacterData = element->Internal->CharacterData;
660  }
661 
662  // add attributes from element to this, or override attribute values on this
663  size_t numAttributes = element->Internal->AttributeNames.size();
664  size_t numAttributes2 = this->Internal->AttributeNames.size();
665 
666  for (size_t i = 0; i < numAttributes; ++i)
667  {
668  bool found = false;
669  for (size_t j = 0; !found && j < numAttributes2; ++j)
670  {
671  if (element->Internal->AttributeNames[i] == this->Internal->AttributeNames[j])
672  {
673  this->Internal->AttributeValues[j] = element->Internal->AttributeValues[i];
674  found = true;
675  }
676  }
677  // if not found, add it
678  if (!found)
679  {
680  this->AddAttribute(element->Internal->AttributeNames[i].c_str(),
681  element->Internal->AttributeValues[i].c_str());
682  }
683  }
684 
685  // now recursively merge the children with the same names
686 
687  vtkPVXMLElementInternals::VectorOfElements::iterator iter;
688  vtkPVXMLElementInternals::VectorOfElements::iterator iter2;
689 
690  for (iter = element->Internal->NestedElements.begin();
691  iter != element->Internal->NestedElements.end(); ++iter)
692  {
693  bool found = false;
694  for (iter2 = this->Internal->NestedElements.begin();
695  iter2 != this->Internal->NestedElements.end(); ++iter2)
696  {
697  const char* attr1 = attributeName ? this->GetAttribute(attributeName) : NULL;
698  const char* attr2 = attributeName ? element->GetAttribute(attributeName) : NULL;
699  if (0 == strcmp((*iter)->Name, (*iter2)->Name) &&
700  (!attributeName || (!attr1 || !attr2 || 0 == strcmp(attr1, attr2))))
701  {
702  (*iter2)->Merge(*iter, attributeName);
703  found = true;
704  }
705  }
706  // if not found, add it
707  if (!found)
708  {
710  newElement->SetName((*iter)->GetName());
711  newElement->SetId((*iter)->GetId());
712  newElement->Internal->AttributeNames = (*iter)->Internal->AttributeNames;
713  newElement->Internal->AttributeValues = (*iter)->Internal->AttributeValues;
714  this->AddNestedElement(newElement);
715  newElement->Merge(*iter, attributeName);
716  }
717  }
718 }
719 
720 //----------------------------------------------------------------------------
722 {
723  other->SetName(GetName());
724  other->SetId(GetId());
725  other->Internal->AttributeNames = this->Internal->AttributeNames;
726  other->Internal->AttributeValues = this->Internal->AttributeValues;
727  other->AddCharacterData(
728  this->Internal->CharacterData.c_str(), static_cast<int>(this->Internal->CharacterData.size()));
729 
730  // Copy recursively
731  vtkPVXMLElementInternals::VectorOfElements::iterator iter;
732  for (iter = this->Internal->NestedElements.begin(); iter != this->Internal->NestedElements.end();
733  ++iter)
734  {
736  (*iter)->CopyTo(newElement);
737  other->AddNestedElement(newElement);
738  }
739 }
740 
741 //----------------------------------------------------------------------------
743 {
744  other->SetName(GetName());
745  other->SetId(GetId());
746  other->Internal->AttributeNames = this->Internal->AttributeNames;
747  other->Internal->AttributeValues = this->Internal->AttributeValues;
748  other->AddCharacterData(
749  this->Internal->CharacterData.c_str(), static_cast<int>(this->Internal->CharacterData.size()));
750 }
751 
752 //----------------------------------------------------------------------------
754 {
755  if (this == other)
756  {
757  return true;
758  }
759  if (!other)
760  {
761  return false;
762  }
763  std::ostringstream selfstream;
764  std::ostringstream otherstream;
765  this->PrintXML(selfstream, vtkIndent());
766  other->PrintXML(otherstream, vtkIndent());
767  return (selfstream.str() == otherstream.str());
768 }
769 
770 //----------------------------------------------------------------------------
772 {
773  std::vector<std::string>::iterator nameIterator = this->Internal->AttributeNames.begin();
774  std::vector<std::string>::iterator valueIterator = this->Internal->AttributeValues.begin();
775  while (nameIterator != this->Internal->AttributeNames.end())
776  {
777  if (strcmp(nameIterator->c_str(), name) == 0)
778  {
779  this->Internal->AttributeNames.erase(nameIterator);
780  this->Internal->AttributeValues.erase(valueIterator);
781  return;
782  }
783  nameIterator++;
784  valueIterator++;
785  }
786 }
787 
788 //----------------------------------------------------------------------------
std::string name
int count
math::float4 next
#define NULL
vtkPVXMLElement * GetParent()
unsigned int GetNumberOfNestedElements()
const char * GetCharacterData()
void PrintXML(ostream &os, vtkIndent indent)
int GetCharacterDataAsVector(int length, int *value)
void RemoveAllNestedElements()
void ReplaceNestedElement(vtkPVXMLElement *elementToReplace, vtkPVXMLElement *element)
int GetScalarAttribute(const char *name, int *value)
void PrintSelf(ostream &os, vtkIndent indent) override
~vtkPVXMLElement() override
vtkPVXMLElement * FindNestedElement(const char *id)
vtkPVXMLElement * LookupElementInScope(const char *id)
void AddNestedElement(vtkPVXMLElement *element, int setPrent)
const char * GetAttributeOrDefault(const char *name, const char *notFound)
void GetElementsByName(const char *name, vtkCollection *elements)
static std::string Encode(const char *plaintext)
void RemoveAttribute(const char *attrName)
vtkPVXMLElement * LookupElementUpScope(const char *id)
vtkPVXMLElement * LookupElement(const char *id)
vtkPVXMLElement * GetNestedElement(unsigned int index)
void AddCharacterData(const char *data, int length)
void ReadXMLAttributes(const char **atts)
bool Equals(vtkPVXMLElement *other)
vtkPVXMLElement * Parent
void SetParent(vtkPVXMLElement *parent)
void AddAttribute(const char *attrName, const char *attrValue)
const char * GetAttribute(const char *name)
vtkPVXMLElement * FindNestedElementByName(const char *name)
void RemoveNestedElement(vtkPVXMLElement *)
int GetVectorAttribute(const char *name, int length, int *value)
void CopyAttributesTo(vtkPVXMLElement *other)
void Merge(vtkPVXMLElement *element, const char *attributeName)
void SetAttribute(const char *attrName, const char *attrValue)
void CopyTo(vtkPVXMLElement *other)
GraphType data
Definition: graph_cut.cc:138
QTextStream & endl(QTextStream &stream)
Definition: QtCompat.h:718
static bool vtkIsSpace(const std::string &str)
vtkStandardNewMacro(vtkPVXMLElement)
#define SNPRINTF
int vtkPVXMLVectorAttributeParse(const char *str, int length, T *data)