src/utilities/xml/XMLInitializer.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*********************************************************************************************************************** | ||
| 2 | * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC. | ||
| 3 | * See also https://openstudio.net/license | ||
| 4 | ***********************************************************************************************************************/ | ||
| 5 | |||
| 6 | #include "XMLInitializer.hpp" | ||
| 7 | #include <libxml/parser.h> | ||
| 8 | #include <libxslt/transform.h> | ||
| 9 | #include <libxslt/xslt.h> | ||
| 10 | |||
| 11 | namespace openstudio::detail { | ||
| 12 | |||
| 13 | 87 | XMLInitializer::XMLInitializer() { | |
| 14 | // Initialize on the first **Actual** usage | ||
| 15 | |||
| 16 | // init the parser (keeps libxml2 thread safe) | ||
| 17 | 87 | xmlInitParser(); | |
| 18 | |||
| 19 | // set some libxml global variables | ||
| 20 | 87 | xmlIndentTreeOutput = 1; | |
| 21 | 87 | xmlKeepBlanksDefaultValue = 0; | |
| 22 | 87 | xmlSubstituteEntitiesDefaultValue = 1; | |
| 23 | 87 | xmlLoadExtDtdDefaultValue = 1; | |
| 24 | 87 | xmlDoValidityCheckingDefaultValue = 0; | |
| 25 | |||
| 26 | 87 | xsltInit(); | |
| 27 | 87 | xsltSetXIncludeDefault(1); | |
| 28 | 87 | } | |
| 29 | |||
| 30 | 87 | XMLInitializer::~XMLInitializer() { | |
| 31 | // This should be done after we're totally done processing stuff... | ||
| 32 | // So that's why it's done by a static object... Note that no cleanup happens in case it was never used, because --reference_counter would be -1 | ||
| 33 | 87 | xsltCleanupGlobals(); | |
| 34 | 87 | xmlCleanupParser(); | |
| 35 | 87 | } | |
| 36 | |||
| 37 | } // namespace openstudio::detail | ||
| 38 |