OpenShot Audio Library | OpenShotAudio 0.3.2
|
#include <juce_XmlDocument.h>
Public Member Functions | |
XmlDocument (const String &documentText) | |
XmlDocument (const File &file) | |
~XmlDocument () | |
std::unique_ptr< XmlElement > | getDocumentElement (bool onlyReadOuterDocumentElement=false) |
std::unique_ptr< XmlElement > | getDocumentElementIfTagMatches (StringRef requiredTag) |
const String & | getLastParseError () const noexcept |
void | setInputSource (InputSource *newSource) noexcept |
void | setEmptyTextElementsIgnored (bool shouldBeIgnored) noexcept |
Static Public Member Functions | |
static std::unique_ptr< XmlElement > | parse (const File &file) |
static std::unique_ptr< XmlElement > | parse (const String &xmlData) |
Parses a text-based XML document and creates an XmlElement object from it.
The parser will parse DTDs to load external entities but won't check the document for validity against the DTD.
e.g.
Or you can use the helper functions for much less verbose parsing..
Definition at line 63 of file juce_XmlDocument.h.
Creates an XmlDocument from the xml text. The text doesn't actually get parsed until the getDocumentElement() method is called.
Definition at line 26 of file juce_XmlDocument.cpp.
Creates an XmlDocument from a file. The text doesn't actually get parsed until the getDocumentElement() method is called.
Definition at line 27 of file juce_XmlDocument.cpp.
juce::XmlDocument::~XmlDocument | ( | ) |
Destructor.
Definition at line 29 of file juce_XmlDocument.cpp.
std::unique_ptr< XmlElement > juce::XmlDocument::getDocumentElement | ( | bool | onlyReadOuterDocumentElement = false | ) |
Creates an XmlElement object to represent the main document node.
This method will do the actual parsing of the text, and if there's a parse error, it may returns nullptr (and you can find out the error using the getLastParseError() method).
See also the parse() methods, which provide a shorthand way to quickly parse a file or string.
onlyReadOuterDocumentElement | if true, the parser will only read the first section of the file, and will only return the outer document element - this allows quick checking of large files to see if they contain the correct type of tag, without having to parse the entire file |
Definition at line 110 of file juce_XmlDocument.cpp.
Referenced by getDocumentElementIfTagMatches(), parse(), and parse().
std::unique_ptr< XmlElement > juce::XmlDocument::getDocumentElementIfTagMatches | ( | StringRef | requiredTag | ) |
Does an inexpensive check to see whether the outer element has the given tag name, and then does a full parse if it matches. If the tag is different, or the XML parse fails, this will return nullptr.
Definition at line 150 of file juce_XmlDocument.cpp.
Returns the parsing error that occurred the last time getDocumentElement was called.
Definition at line 159 of file juce_XmlDocument.cpp.
|
static |
A handy static method that parses a file. This is a shortcut for creating an XmlDocument object and calling getDocumentElement() on it. An even better shortcut is the juce::parseXML() function, which returns a std::unique_ptr<XmlElement>!
Definition at line 31 of file juce_XmlDocument.cpp.
|
static |
A handy static method that parses some XML data. This is a shortcut for creating an XmlDocument object and calling getDocumentElement() on it. An even better shortcut is the juce::parseXML() function, which returns a std::unique_ptr<XmlElement>!
Definition at line 36 of file juce_XmlDocument.cpp.
Sets a flag to change the treatment of empty text elements.
If this is true (the default state), then any text elements that contain only whitespace characters will be ingored during parsing. If you need to catch whitespace-only text, then you should set this to false before calling the getDocumentElement() method.
Definition at line 66 of file juce_XmlDocument.cpp.
|
noexcept |
Sets an input source object to use for parsing documents that reference external entities.
If the document has been created from a file, this probably won't be needed, but if you're parsing some text and there might be a DTD that references external files, you may need to create a custom input source that can retrieve the other files it needs.
The object that is passed-in will be deleted automatically when no longer needed.
Definition at line 61 of file juce_XmlDocument.cpp.