XML File. More...
#include <rxmlfile.h>
Public Member Functions | |
RXMLFile (void) | |
RXMLFile (const RURI &uri, RXMLStruct *xmlstruct, const RCString &encoding="UTF-8") | |
RXMLFile (RIOFile &file, RXMLStruct *xmlstruct, const RCString &encoding="UTF-8") | |
bool | MustCompressTags (void) const |
void | SetCompressTags (bool compress) |
void | SetEncoding (const RCString &name) |
virtual void | Open (RIO::ModeType mode=RIO::Read) |
void | Open (const RURI &uri, RXMLStruct *xmlstruct, RIO::ModeType mode=RIO::Read, const RCString &encoding="UTF-8") |
virtual void | Close (void) |
virtual | ~RXMLFile (void) |
Public Member Functions inherited from RXMLParser | |
RXMLParser (void) | |
RXMLParser (const RURI &uri, const RCString &encoding="UTF-8") | |
RXMLParser (RIOFile &file, const RCString &encoding="UTF-8") | |
void | StopAnalysis (void) |
void | SetAvoidSpaces (bool as) |
size_t | GetCurrentDepth (void) const |
size_t | GetLastTokenPos (void) const |
void | SetHTMLMode (bool html) |
void | Open (const RURI &uri, RIO::ModeType mode=RIO::Read, const RCString &encoding="UTF-8") |
SectionType | GetSection (void) const |
HeaderAttributeType | GetHeaderAttribute (void) const |
bool | AcceptHTMLCodes (void) |
void | SetAcceptHTMLCodes (bool accepted) |
virtual | ~RXMLParser (void) |
void | InitParser (void) |
void | SetSection (SectionType section) |
void | ResetDepth (void) |
bool | MustAvoidSpaces (void) const |
bool | HasFoundClosingHTML (void) const |
RString | GetDocType (void) const |
virtual void | SetDocType (const RString &docType) |
virtual void | HeaderAttribute (const RString &namespaceURI, const RString &lName, const RString &name) |
virtual void | BeginTagParsed (const RString &namespaceURI, const RString &lName, const RString &name) |
virtual bool | OnlyQuote (void) |
Public Member Functions inherited from RTextFile | |
RTextFile (void) | |
RTextFile (const RURI &uri, const RCString &encoding="Latin1") | |
RTextFile (RIOFile &file, const RCString &encoding="Latin1") | |
void | Open (const RURI &uri, RIO::ModeType mode=RIO::Read, const RCString &encoding="Latin1") |
virtual void | Seek (off_t pos) |
virtual void | SeekRel (off_t pos) |
RChar | GetNextChar (void) const |
RChar | GetChar (void) |
const RChar | GetCur (void) const |
RString | GetChars (size_t size) |
RString | GetUntilEnd (void) |
void | SkipEol (void) |
bool | CurString (const RString &str, bool CaseSensitive=true, bool skip=true) |
void | SkipComments (void) |
void | SkipSpaces (void) |
size_t | SkipCountSpaces (RChar car) |
RCString | GetEncoding (void) const |
void | SetRemStyle (RemType style) |
void | SetParseSpace (ParseSpaceType parse) |
ParseSpaceType | GetParseSpace (void) const |
void | SetRem (const RString &c) |
void | SetRem (const RString &b, const RString &e) |
bool | MustAddSeparator (void) const |
void | SetAddSeparator (bool add) |
RString | GetWord (void) |
RString | GetToken (const RString &endingchar) |
RString | GetTokenString (const RString &endingstr) |
RString | GetLine (bool skipempty=true) |
long | GetInt (void) |
unsigned long | GetUInt (void) |
RTextFile & | operator>> (RString &str) |
RTextFile & | operator>> (char &nb) |
RTextFile & | operator>> (unsigned char &nb) |
RTextFile & | operator>> (short &nb) |
RTextFile & | operator>> (unsigned short &nb) |
RTextFile & | operator>> (int &nb) |
RTextFile & | operator>> (unsigned int &nb) |
RTextFile & | operator>> (long &nb) |
RTextFile & | operator>> (unsigned long &nb) |
RTextFile & | operator>> (float &nb) |
RTextFile & | operator>> (double &nb) |
RTextFile & | operator>> (long double &nb) |
void | WriteLine (void) |
void | WriteStr (const RString &str, bool invalid=false) |
void | WriteStr (const char *c, bool invalid=false) |
void | WriteStr (const char *c, size_t l, bool invalid=false) |
RTextFile & | operator<< (const char *c) |
RTextFile & | operator<< (const RString &str) |
void | WriteLong (const long nb) |
RTextFile & | operator<< (const char nb) |
RTextFile & | operator<< (const short nb) |
RTextFile & | operator<< (const int nb) |
RTextFile & | operator<< (const long nb) |
void | WriteULong (const unsigned long nb) |
RTextFile & | operator<< (const unsigned char nb) |
RTextFile & | operator<< (const unsigned int nb) |
RTextFile & | operator<< (const unsigned long nb) |
void | WriteBool (const bool b) |
RTextFile & | operator<< (const bool b) |
void | WriteChar (const char c) |
void | WriteFloat (const float nb) |
RTextFile & | operator<< (const float nb) |
void | WriteDouble (const double nb) |
RTextFile & | operator<< (const double nb) |
void | WriteLongDouble (const long double nb) |
RTextFile & | operator<< (const long double nb) |
void | WriteTime (void) |
void | WriteLog (const RString &entry, bool invalid) |
unsigned long | GetLineNb (void) const |
unsigned long | GetLastLine (void) const |
void | SetSeparator (const RString &str) |
void | SetSeparator (const char *str) |
virtual | ~RTextFile (void) |
Public Member Functions inherited from RIOFile | |
RIOFile (void) | |
RIOFile (const RURI &uri) | |
RIOFile (RIOFile &file) | |
RURI | GetRealName (void) const |
void | Open (const RURI &uri, RIO::ModeType mode) |
bool | IsOpen (void) const |
size_t | Read (char *buffer, size_t nb, bool move=true) |
void | Write (const char *buffer, size_t nb) |
virtual void | SeekToEnd (void) |
void | Truncate (off_t newsize) |
bool | End (void) const |
off_t | GetSize (void) const |
off_t | GetPos (void) const |
virtual | ~RIOFile (void) |
Public Member Functions inherited from RFile | |
RFile (void) | |
RFile (const RURI &uri) | |
RFile (const RFile &file) | |
void | Open (const RURI &uri, RIO::ModeType mode) |
int | Compare (const RFile &file) const |
int | Compare (const RFile *file) const |
int | Compare (const RString &uri) const |
const RURI & | GetURI (void) const |
void | SetURI (const RURI &uri) |
const RString | GetFileName (void) const |
virtual | ~RFile (void) |
Protected Member Functions | |
virtual void | AddEntity (const RString &name, const RString &value) |
virtual void | HeaderValue (const RString &value) |
virtual void | BeginTag (const RString &namespaceURI, const RString &lName, const RString &name) |
virtual void | ResolveNamespace (const RString &namespaceURI) |
virtual void | AddAttribute (const RString &namespaceURI, const RString &lName, const RString &name) |
virtual void | Value (const RString &value) |
virtual void | EndTag (const RString &namespaceURI, const RString &lName, const RString &name) |
virtual void | Text (const RString &text) |
virtual void | SetDTD (const RString &dtd) |
Protected Member Functions inherited from RXMLParser | |
RString | XMLToString (const RString &str) |
const HTMLTag * | GetCurHTMLTag (void) const |
const HTMLTag * | GetHTMLTag (const RString &name) const |
bool | IsCurTagClosing (void) const |
Protected Member Functions inherited from RTextFile | |
void | Next (void) |
RString | GetRealNb (void) |
void | WriteSeparator (void) |
Protected Attributes | |
RXMLStruct * | XMLStruct |
bool | NewStruct |
RXMLTag * | CurTag |
RXMLAttr * | CurAttr |
RString | AttrName |
bool | CompressTags |
Protected Attributes inherited from RIOFile | |
bool | CanWrite |
bool | CanRead |
Protected Attributes inherited from RFile | |
RIO::ModeType | Mode |
RURI | URI |
Private Member Functions | |
void | SaveNextTag (int depth) |
Additional Inherited Members | |
Public Types inherited from RXMLParser | |
enum | SectionType { Header, StyleSheet, DOCTYPE, Body } |
enum | HeaderAttributeType { Encoding, Version, Unknown } |
Public Types inherited from RTextFile | |
enum | RemType { NoComment, SingleLineComment, MultiLineComment, SingleMultiLineComment } |
enum | ParseSpaceType { LeaveSpaces, SkipAllSpaces } |
Static Public Member Functions inherited from RXMLParser | |
static RChar | CodeToChar (const RString &code, bool html) |
static RString | CharToCode (RChar car, bool strict=true) |
static RString | XMLToString (const RString &str, bool html) |
static RString | StringToXML (const RString &str, bool strict=true) |
Static Public Member Functions inherited from RTextFile | |
static bool | Eol (RChar car) |
Static Public Member Functions inherited from RFile | |
static RChar | GetDirSeparator (void) |
static void | RemoveFile (const RURI &uri) |
static void | RenameFile (const RURI &olduri, const RURI &newuri) |
static RURI | GetTempFile (void) |
static bool | Exists (const RURI &uri) |
static bool | IsDir (const RURI &uri) |
Detailed Description
XML File.
This class represents a XML file.
Constructor & Destructor Documentation
RXMLFile | ( | void | ) |
Default constructor.
RXMLFile | ( | const RURI & | uri, |
RXMLStruct * | xmlstruct, | ||
const RCString & | encoding = "UTF-8" |
||
) |
Construct a XML file. If the pointer to the XML structure is null, a default structure is created and destroy when the file is closed.
- Parameters
-
uri URI of the file. xmlstruct The XML tree associated with the file encoding The encoding scheme of the file.
RXMLFile | ( | RIOFile & | file, |
RXMLStruct * | xmlstruct, | ||
const RCString & | encoding = "UTF-8" |
||
) |
Construct a XML file.
- Parameters
-
file A generic input/output file that should be treated as XML file. xmlstruct The XML tree associated with the file encoding The encoding scheme of the file.
|
virtual |
Destruct the XML file.
Member Function Documentation
bool MustCompressTags | ( | void | ) | const |
Look if the tags must be compressed or not.
- Returns
- true if yes.
void SetCompressTags | ( | bool | compress | ) |
Specify if the tags must be compressed. If yes, when a tag is written in a file, when it has no child tags, the content is written on the same line as the tag. If no, the content is written on a separate line.
- Parameters
-
compress Must the tags be compressed?
|
virtual |
Set the encoding of the XML document.
- Parameters
-
name Name of the encoding.
Reimplemented from RTextFile.
|
virtual |
Open the file.
- Parameters
-
mode The open mode for the file.
Reimplemented from RXMLParser.
Reimplemented in RHTMLFile.
void Open | ( | const RURI & | uri, |
RXMLStruct * | xmlstruct, | ||
RIO::ModeType | mode = RIO::Read , |
||
const RCString & | encoding = "UTF-8" |
||
) |
Open the file
- Parameters
-
uri URI of the file. xmlstruct The XML tree associated with the file mode The open mode for the file. encoding The encoding scheme of the file.
|
virtual |
Close the file. If the XML structure was created by the file, it is deleted.
Reimplemented from RTextFile.
|
private |
Save the next XML tag into the XML file.
- Parameters
-
depth The depth of the tag in the XML structure.
Add a entity found.
- Parameters
-
name Name of the entity. value Corresponding value.
Reimplemented from RXMLParser.
|
protectedvirtual |
Method called each time some attribute value elements (words or spaces) are parsed when reading the XML header. In practice, it sets the version if found.
- Parameters
-
value Value processed.
Reimplemented from RXMLParser.
|
protectedvirtual |
Method called each time a tag will be treated when reading a XML file. Actually, a XMLTag is created and inserted as child of the current tag. At the end, the current tag is set to the new created one.
- Parameters
-
namespaceURI Name of the namespace (if any). lName Local name of the tag. name Complete name of the tag.
Reimplemented from RXMLParser.
Reimplemented in RHTMLFile.
|
protectedvirtual |
Method called each time a tag defines a unknown namespace which is resolved by one of its attributes.
- Parameters
-
namespaceURI Namespace to assign to the current tag.
Reimplemented from RXMLParser.
|
protectedvirtual |
Method called each time an attribute will be treated when reading a XML file. Actually, the attribute is added to the current tag if one is defined or to an internal container.
- Parameters
-
namespaceURI Name of the namespace (if any). lName Local name of the attribute. name Complete name of the attribute.
Reimplemented from RXMLParser.
|
protectedvirtual |
Method called each time some attribute value elements (words or spaces) are parsed when reading a XML file. Actually, the text is added as content to value of the current attribute.
- Parameters
-
value Value processed.
Reimplemented from RXMLParser.
|
protectedvirtual |
Method called each time a tag was treated when reading a XML file. Actually, the current tag is set its parent.
- Parameters
-
namespaceURI Name of the namespace (if any). lName Local name of the tag. name Complete name of the tag.
Reimplemented from RXMLParser.
Reimplemented in RHTMLFile.
|
protectedvirtual |
Method called each time some text elements (words or spaces) are parsed when reading a XML file. Actually, the text is added as content to the current tag.
- Parameters
-
text Text processed.
Reimplemented from RXMLParser.
Reimplemented in RHTMLFile.
|
protectedvirtual |
Field Documentation
|
protected |
The structure associated with the XML file.
|
protected |
The XML Structure was created by RXMLFile.
|
protected |
Current tag treated.
|
protected |
Current attribute treated.
|
protected |
Name of an attribute in the headers.
|
protected |
Try to compress tags.