Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::DocumentStorage Class Reference

A container for parsed XML documents. More...

#include <xml.hh>

Collaboration diagram for ghidra::DocumentStorage:
[legend]

Public Member Functions

 ~DocumentStorage (void)
 Destructor.
 
DocumentparseDocument (istream &s)
 Parse an XML document from the given stream.
 
DocumentopenDocument (const string &filename)
 Open and parse an XML file.
 
void registerTag (const Element *el)
 Register the given XML Element object under its tag name.
 
const ElementgetTag (const string &nm) const
 Retrieve a registered XML Element by name.
 

Private Attributes

vector< Document * > doclist
 The list of documents held by this container.
 
map< string, const Element * > tagmap
 The map from name to registered XML elements.
 

Detailed Description

A container for parsed XML documents.

This holds multiple XML documents that have already been parsed. Documents can be put in this container, either by handing it a stream via parseDocument() or a filename via openDocument(). If they are explicitly registered, specific XML Elements can be looked up by name via getTag().

Member Function Documentation

◆ getTag()

const Element * ghidra::DocumentStorage::getTag ( const string &  nm) const

◆ openDocument()

Document * ghidra::DocumentStorage::openDocument ( const string &  filename)

Open and parse an XML file.

The given filename is opened on the local filesystem and an attempt is made to parse its contents into an in-memory DOM tree. An XmlException is thrown for any parsing error.

Parameters
filenameis the name of the XML document file
Returns
the in-memory DOM tree

References parseDocument().

◆ parseDocument()

Document * ghidra::DocumentStorage::parseDocument ( istream &  s)

Parse an XML document from the given stream.

Parsing starts immediately on the stream, attempting to make an in-memory DOM tree. An XmlException is thrown for any parsing error.

Parameters
sis the given stream to parse
Returns
the in-memory DOM tree

References doclist.

Referenced by ghidra::ArchitectureGhidra::buildSpecFile(), and openDocument().

◆ registerTag()

void ghidra::DocumentStorage::registerTag ( const Element el)

Register the given XML Element object under its tag name.

Only one Element can be stored on this object per tag name.

Parameters
elis the given XML element

References ghidra::Element::getName(), and tagmap.

Referenced by ghidra::ArchitectureGhidra::buildSpecFile(), and ghidra::Architecture::parseProcessorConfig().


The documentation for this class was generated from the following files: