32#include <wx/xml/xml.h>
45 XNODE* iNode =
nullptr, *cNode =
nullptr;
46 wxString str, propValue, content;
47 wxCSConv conv( wxT(
"windows-1251" ) );
49 FILE* fp = wxFopen( aFileName, wxT(
"rt" ) );
55 if( !fgets( line,
sizeof( line ), fp )
61 fseek( fp, 0, SEEK_SET );
66 iNode =
new XNODE( wxXML_ELEMENT_NODE, wxT(
"www.lura.sk" ) );
82 cNode =
new XNODE( wxXML_ELEMENT_NODE, wxString( lexer.
CurText(), conv ) );
83 iNode->AddChild( cNode );
88 str = wxString( lexer.
CurText(), conv );
93 if( iNode->GetAttribute( wxT(
"Name" ), &propValue ) )
95 iNode->DeleteAttribute( wxT(
"Name" ) );
96 iNode->AddAttribute( wxT(
"Name" ), propValue + wxT(
' ' ) + str );
100 iNode->AddAttribute( wxT(
"Name" ), str );
103 else if( str != wxEmptyString )
106 content = cNode->GetNodeContent() + wxT(
' ' ) + str;
108 if( cNode->GetChildren() )
111 cNode->AddChild(
new wxXmlNode( wxXML_TEXT_NODE, wxEmptyString, content ) );
118 aXmlDoc->SetRoot( iNode );
Implement a lexical analyzer for the SPECCTRA DSN file format.
const char * CurText() const
Return a pointer to the current token's text.
int NextTok()
Return the next token found in the input file or DSN_EOF when reaching the end of file.
Hold an XML or S-expression element.
XNODE * GetParent() const
XNODE * GetChildren() const
#define THROW_IO_ERROR(msg)
This file contains miscellaneous commonly used macros and functions.
void LoadInputFile(const wxString &aFileName, wxXmlDocument *aXmlDoc)
static KEYWORD empty_keywords[1]
static const char ACCEL_ASCII_KEYWORD[]
Hold a keyword string and its unique integer token.