44 XNODE* iNode = NULL, *cNode = NULL;
45 wxString
str, propValue, content;
46 wxCSConv conv( wxT(
"windows-1251" ) );
48 FILE* fp = wxFopen( aFileName, wxT(
"rt" ) );
54 if( !fgets( line,
sizeof( line ), fp )
56 || memcmp( line, ACCEL_ASCII_KEYWORD,
sizeof(ACCEL_ASCII_KEYWORD)-1 ) )
60 fseek( fp, 0, SEEK_SET );
63 DSNLEXER lexer( empty_keywords, 0, fp, aFileName );
65 iNode =
new XNODE( wxXML_ELEMENT_NODE, wxT(
"www.lura.sk" ) );
77 cNode =
new XNODE( wxXML_ELEMENT_NODE, wxString( lexer.
CurText(), conv ) );
78 iNode->AddChild( cNode );
83 str = wxString( lexer.
CurText(), conv );
87 if( iNode->GetAttribute( wxT(
"Name" ), &propValue ) )
89 iNode->DeleteAttribute( wxT(
"Name" ) );
90 iNode->AddAttribute( wxT(
"Name" ), propValue + wxT(
' ' ) + str );
93 iNode->AddAttribute( wxT(
"Name" ), str );
95 else if( str != wxEmptyString )
98 content = cNode->GetNodeContent() + wxT(
' ' ) +
str;
100 if( cNode->GetChildren() )
101 cNode->GetChildren()->SetContent( content );
103 cNode->AddChild(
new wxXmlNode( wxXML_TEXT_NODE,
112 aXmlDoc->SetRoot( iNode );
void LoadInputFile(const wxString &aFileName, wxXmlDocument *aXmlDoc)
This file contains miscellaneous commonly used macros and functions.
XNODE * GetParent() const
static KEYWORD empty_keywords[1]
Class XNODE holds an XML or S-expression element.
static const char ACCEL_ASCII_KEYWORD[]
int NextTok()
Function NextTok returns the next token found in the input file or DSN_EOF when reaching the end of f...
Struct KEYWORD holds a keyword string and its unique integer token.
const char * CurText()
Function CurText returns a pointer to the current token's text.
#define THROW_IO_ERROR(msg)
Class DSNLEXER implements a lexical analyzer for the SPECCTRA DSN file format.