FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
libxml_wrapper.cpp File Reference

Wrapper for managing XML documents and elements using libxml2. More...

#include "libxml_wrapper.h"
#include <array>
#include <cctype>
#include <cstdarg>
#include <cstdio>
#include <format>
#include <limits>
#include <string>
#include "libxml/encoding.h"
#include "libxml/parser.h"
#include "libxml/valid.h"
#include "libxml/xmlIO.h"
#include "libxml/xmlerror.h"
#include "libxml/xmlschemas.h"
+ Include dependency graph for libxml_wrapper.cpp:

Go to the source code of this file.

Functions

void mergeXmlDocuments (const XmlDocument &mainDoc, const XmlDocument &includedDoc)
 Merge two XML documents.
 
void removeIncludeElements (const XmlDocument &doc)
 Remove "include" elements from the XML document.
 

Detailed Description

Wrapper for managing XML documents and elements using libxml2.

Definition in file libxml_wrapper.cpp.

Function Documentation

◆ mergeXmlDocuments()

void mergeXmlDocuments ( const XmlDocument mainDoc,
const XmlDocument includedDoc 
)

Merge two XML documents.

Parameters
mainDocThe main XML document.
includedDocThe XML document to include.

Definition at line 214 of file libxml_wrapper.cpp.

215{
216 const XmlElement main_root = mainDoc.getRootElement();
217 const XmlElement included_root = includedDoc.getRootElement();
218
219 for (xmlNodePtr child = included_root.getNode()->children; child != nullptr; child = child->next)
220 {
221 if (child->type == XML_ELEMENT_NODE)
222 {
224 xmlAddChild(main_root.getNode(), new_node);
225 }
226 }
227}
Class representing a node in an XML document.
math::Vec3 max

References max.

Referenced by serial::xml_parser_utils::addIncludeFilesToMainDocument().

+ Here is the caller graph for this function:

◆ removeIncludeElements()

void removeIncludeElements ( const XmlDocument doc)

Remove "include" elements from the XML document.

Parameters
docThe XML document from which to remove the "include" elements.

Definition at line 229 of file libxml_wrapper.cpp.

230{
231 const XmlElement root = doc.getRootElement();
232
233 while (true)
234 {
235 if (const XmlElement include_element = root.childElement("include", 0); include_element.isValid())
236 {
238 xmlFreeNode(include_element.getNode());
239 }
240 else
241 {
242 break;
243 }
244 }
245}

References max.

Referenced by serial::xml_parser_utils::addIncludeFilesToMainDocument().

+ Here is the caller graph for this function: