Added XSD element inspection

This commit is contained in:
Gerald Schmidt 2008-01-21 23:06:36 +00:00
parent 4bef2eea7e
commit 9ef9fd5dea
13 changed files with 238 additions and 81 deletions

View File

@ -16,7 +16,7 @@ applicationsdir = /usr/share/applications
xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \ xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
contexthandler.cpp globalreplacedialog.cpp housestyle.cpp \ contexthandler.cpp globalreplacedialog.cpp housestyle.cpp \
housestylereader.cpp myhtmlpane.cpp nocasecompare.cpp readfile.cpp \ housestylereader.cpp myhtmlpane.cpp nocasecompare.cpp readfile.cpp \
replace.cpp spellcheck.cpp styledialog.cpp wraplibxml.cpp \ replace.cpp styledialog.cpp wraplibxml.cpp \
wrapregex.cpp wraptempfilename.cpp xmlassociatedtd.cpp xmlassociatexsd.cpp \ wrapregex.cpp wraptempfilename.cpp xmlassociatedtd.cpp xmlassociatexsd.cpp \
xmlassociatexsl.cpp xmlctrl.cpp xmldoc.cpp xmlencodinghandler.cpp xmlfilterreader.cpp \ xmlassociatexsl.cpp xmlctrl.cpp xmldoc.cpp xmlencodinghandler.cpp xmlfilterreader.cpp \
xmlpromptgenerator.cpp xmlrulereader.cpp xmlschemalocator.cpp xmlutf8reader.cpp xsllocator.cpp \ xmlpromptgenerator.cpp xmlrulereader.cpp xmlschemalocator.cpp xmlutf8reader.cpp xsllocator.cpp \
@ -24,12 +24,12 @@ xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
insertpanel.cpp xmlwordcount.cpp getword.cpp locationpanel.cpp catalogresolver.cpp getlinuxappdir.cpp \ insertpanel.cpp xmlwordcount.cpp getword.cpp locationpanel.cpp catalogresolver.cpp getlinuxappdir.cpp \
xmlparseschemans.cpp xmlshallowvalidator.cpp wrapxerces.cpp \ xmlparseschemans.cpp xmlshallowvalidator.cpp wrapxerces.cpp \
findreplacepanel.cpp commandpanel.cpp \ findreplacepanel.cpp commandpanel.cpp \
binaryfile.cpp xmlencodingspy.cpp \ binaryfile.cpp xmlencodingspy.cpp wrapaspell.cpp \
rulesets filters png rng xpm templates copying help po \ rulesets filters png rng xpm templates copying help po \
docbook xmlcopyeditor.spec xmlcopyeditor.png custom.xpm \ docbook xmlcopyeditor.spec xmlcopyeditor.png custom.xpm \
xmlcopyeditor.desktop xmlcopyeditor.desktop
xmlcopyeditor_LDFLAGS = $(WX_LIBS) \ xmlcopyeditor_LDFLAGS = $(WX_LIBS) \
-lexpat -lxslt -lxml2 -lpcre -lxerces-c -lexpat -lxslt -lxml2 -lpcre -lxerces-c -laspell
nobase_xmlcopyeditor_DATA = png/*.png \ nobase_xmlcopyeditor_DATA = png/*.png \
rulesets/*.* \ rulesets/*.* \
@ -57,6 +57,7 @@ nobase_xmlcopyeditor_DATA = png/*.png \
copying/wxStyledTextCtrl/* copying/ximian/* \ copying/wxStyledTextCtrl/* copying/ximian/* \
copying/wxStEditor/* \ copying/wxStEditor/* \
copying/xmlcopyeditor/* \ copying/xmlcopyeditor/* \
copying/Aspell/* \
copying/Apache/LICENSE-2.0 \ copying/Apache/LICENSE-2.0 \
copying/Apache/LICENSE-2_files/* \ copying/Apache/LICENSE-2_files/* \
po/sk/messages.mo \ po/sk/messages.mo \

View File

@ -57,7 +57,7 @@ am_xmlcopyeditor_OBJECTS = xmlcopyeditor.$(OBJEXT) \
contexthandler.$(OBJEXT) globalreplacedialog.$(OBJEXT) \ contexthandler.$(OBJEXT) globalreplacedialog.$(OBJEXT) \
housestyle.$(OBJEXT) housestylereader.$(OBJEXT) \ housestyle.$(OBJEXT) housestylereader.$(OBJEXT) \
myhtmlpane.$(OBJEXT) nocasecompare.$(OBJEXT) \ myhtmlpane.$(OBJEXT) nocasecompare.$(OBJEXT) \
readfile.$(OBJEXT) replace.$(OBJEXT) spellcheck.$(OBJEXT) \ readfile.$(OBJEXT) replace.$(OBJEXT) \
styledialog.$(OBJEXT) wraplibxml.$(OBJEXT) wrapregex.$(OBJEXT) \ styledialog.$(OBJEXT) wraplibxml.$(OBJEXT) wrapregex.$(OBJEXT) \
wraptempfilename.$(OBJEXT) xmlassociatedtd.$(OBJEXT) \ wraptempfilename.$(OBJEXT) xmlassociatedtd.$(OBJEXT) \
xmlassociatexsd.$(OBJEXT) xmlassociatexsl.$(OBJEXT) \ xmlassociatexsd.$(OBJEXT) xmlassociatexsl.$(OBJEXT) \
@ -74,7 +74,7 @@ am_xmlcopyeditor_OBJECTS = xmlcopyeditor.$(OBJEXT) \
locationpanel.$(OBJEXT) catalogresolver.$(OBJEXT) \ locationpanel.$(OBJEXT) catalogresolver.$(OBJEXT) \
getlinuxappdir.$(OBJEXT) xmlparseschemans.$(OBJEXT) \ getlinuxappdir.$(OBJEXT) xmlparseschemans.$(OBJEXT) \
xmlshallowvalidator.$(OBJEXT) wrapxerces.$(OBJEXT) \ xmlshallowvalidator.$(OBJEXT) wrapxerces.$(OBJEXT) \
findreplacepanel.$(OBJEXT) \ findreplacepanel.$(OBJEXT) wrapaspell.$(OBJEXT) \
commandpanel.$(OBJEXT) binaryfile.$(OBJEXT) \ commandpanel.$(OBJEXT) binaryfile.$(OBJEXT) \
xmlencodingspy.$(OBJEXT) xmlencodingspy.$(OBJEXT)
xmlcopyeditor_OBJECTS = $(am_xmlcopyeditor_OBJECTS) xmlcopyeditor_OBJECTS = $(am_xmlcopyeditor_OBJECTS)
@ -216,7 +216,7 @@ applicationsdir = /usr/share/applications
xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \ xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
contexthandler.cpp globalreplacedialog.cpp housestyle.cpp \ contexthandler.cpp globalreplacedialog.cpp housestyle.cpp \
housestylereader.cpp myhtmlpane.cpp nocasecompare.cpp readfile.cpp \ housestylereader.cpp myhtmlpane.cpp nocasecompare.cpp readfile.cpp \
replace.cpp spellcheck.cpp styledialog.cpp wraplibxml.cpp \ replace.cpp styledialog.cpp wraplibxml.cpp \
wrapregex.cpp wraptempfilename.cpp xmlassociatedtd.cpp xmlassociatexsd.cpp \ wrapregex.cpp wraptempfilename.cpp xmlassociatedtd.cpp xmlassociatexsd.cpp \
xmlassociatexsl.cpp xmlctrl.cpp xmldoc.cpp xmlencodinghandler.cpp xmlfilterreader.cpp \ xmlassociatexsl.cpp xmlctrl.cpp xmldoc.cpp xmlencodinghandler.cpp xmlfilterreader.cpp \
xmlpromptgenerator.cpp xmlrulereader.cpp xmlschemalocator.cpp xmlutf8reader.cpp xsllocator.cpp \ xmlpromptgenerator.cpp xmlrulereader.cpp xmlschemalocator.cpp xmlutf8reader.cpp xsllocator.cpp \
@ -224,13 +224,13 @@ xmlcopyeditor_SOURCES = xmlcopyeditor.cpp associatedialog.cpp casehandler.cpp \
insertpanel.cpp xmlwordcount.cpp getword.cpp locationpanel.cpp catalogresolver.cpp getlinuxappdir.cpp \ insertpanel.cpp xmlwordcount.cpp getword.cpp locationpanel.cpp catalogresolver.cpp getlinuxappdir.cpp \
xmlparseschemans.cpp xmlshallowvalidator.cpp wrapxerces.cpp \ xmlparseschemans.cpp xmlshallowvalidator.cpp wrapxerces.cpp \
findreplacepanel.cpp commandpanel.cpp \ findreplacepanel.cpp commandpanel.cpp \
binaryfile.cpp xmlencodingspy.cpp \ binaryfile.cpp xmlencodingspy.cpp wrapaspell.cpp \
rulesets filters png rng xpm templates copying help po \ rulesets filters png rng xpm templates copying help po \
xmlcopyeditor.spec xmlcopyeditor.png custom.xpm \ xmlcopyeditor.spec xmlcopyeditor.png custom.xpm \
xmlcopyeditor.desktop xmlcopyeditor.desktop
xmlcopyeditor_LDFLAGS = $(WX_LIBS) \ xmlcopyeditor_LDFLAGS = $(WX_LIBS) \
-lexpat -lxslt -lxml2 -lpcre -lxerces-c -lexpat -lxslt -lxml2 -lpcre -lxerces-c -laspell
nobase_xmlcopyeditor_DATA = png/*.png \ nobase_xmlcopyeditor_DATA = png/*.png \
rulesets/*.* \ rulesets/*.* \
@ -249,6 +249,7 @@ nobase_xmlcopyeditor_DATA = png/*.png \
copying/wxStyledTextCtrl/* copying/ximian/* \ copying/wxStyledTextCtrl/* copying/ximian/* \
copying/wxStEditor/* \ copying/wxStEditor/* \
copying/xmlcopyeditor/* \ copying/xmlcopyeditor/* \
copying/Aspell/* \
copying/Apache/LICENSE-2.0 \ copying/Apache/LICENSE-2.0 \
copying/Apache/LICENSE-2_files/* \ copying/Apache/LICENSE-2_files/* \
po/sk/messages.mo \ po/sk/messages.mo \
@ -358,7 +359,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replace.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replace.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rule.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rule.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spellcheck.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/styledialog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/styledialog.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrapexpat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wrapexpat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wraplibxml.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wraplibxml.Po@am__quote@

View File

@ -101,6 +101,7 @@ void InsertPanel::update (
list->Clear(); list->Clear();
lastDoc = doc; lastDoc = doc;
std::set<std::string> entitySet = doc->getEntitySet(); std::set<std::string> entitySet = doc->getEntitySet();
entitySet.insert ( "amp" );
entitySet.insert ( "apos" ); entitySet.insert ( "apos" );
entitySet.insert ( "gt" ); entitySet.insert ( "gt" );
entitySet.insert ( "lt" ); entitySet.insert ( "lt" );

View File

@ -47,28 +47,23 @@ LocationPanel::LocationPanel ( wxWindow *parentWindowParameter, int id ) :
boldFont.SetWeight ( wxFONTWEIGHT_BOLD ); boldFont.SetWeight ( wxFONTWEIGHT_BOLD );
edit->SetFont ( boldFont ); edit->SetFont ( boldFont );
/* structureEdit = new wxStyledTextCtrl (
wxStaticText *label = new wxStaticText(
this, this,
wxID_ANY, wxID_ANY,
_("Attributes"),
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize); wxDefaultSize);
for (int i = 0 ; i < 3; i++ )
list = new wxListBox( structureEdit->SetMarginWidth ( i, 0 );
this, structureEdit->SetReadOnly ( true );
wxID_ANY, //structureEdit->SetWrapMode ( wxSTC_WRAP_WORD );
wxDefaultPosition, //structureEdit->SetWrapVisualFlags ( wxSTC_WRAPVISUALFLAG_START );
wxDefaultSize, structureEdit->SetTabWidth ( 2 );
0, structureEdit->SetIndentationGuides ( true );
NULL,
wxLB_SORT | wxLB_HSCROLL);
*/
sizer->Add ( edit, 0, wxGROW | wxTOP, 0 ); sizer->Add ( edit, 0, wxGROW | wxTOP, 0 );
//sizer->Add(label, 0, wxGROW | wxTOP, 10); sizer->Add ( structureEdit, 0, wxGROW | wxTOP, 0 );
//sizer->Add(list, 0, wxGROW | wxTOP, 0);
sizer->Layout(); sizer->Layout();
structureEdit->Show ( false );
} }
void LocationPanel::update ( void LocationPanel::update (
@ -78,8 +73,109 @@ void LocationPanel::update (
doc = docParameter; doc = docParameter;
parent = parentParameter; parent = parentParameter;
wxString previous = edit->GetValue(); wxString previous = edit->GetValue();
if ( !doc )
{
edit->SetValue ( wxEmptyString );
structureEdit->Show ( false );
return;
}
else
{
std::string structure = doc->getElementStructure ( parent );
if (!structure.empty () )
{
indentStructure( structure );
structureEdit->Show ( true );
wxString wideStructure = wxString ( structure.c_str(), wxConvUTF8, structure.size() );
structureEdit->SetReadOnly ( false );
structureEdit->SetText ( wideStructure );
structureEdit->SetReadOnly ( true );
wxSize clientSize = GetClientSize();
wxSize editSize = edit->GetSize();
wxSize structureSize =
wxSize ( clientSize.GetWidth(), clientSize.GetHeight() - editSize.GetHeight() );
if ( clientSize.IsFullySpecified() && editSize.IsFullySpecified() )
structureEdit->SetSize ( structureSize );
structureEdit->Update();
}
else
{
structureEdit->Show ( false );
}
}
if ( parentParameter == previous ) if ( parentParameter == previous )
return; return;
previous = parentParameter; previous = parentParameter;
edit->SetValue ( parent ); edit->SetValue ( parent );
}
void LocationPanel::indentStructure ( std::string& structure )
{
std::string indented;
char *s = (char *) structure.c_str();
int indent = 0;
char *indentMark = "\t";
int count = 0;
bool justSeenContent = false;
for ( ; *s; s++, count++)
{
if (*s == '(')
{
if ( count && justSeenContent )
{
indented += '\n';
}
else if (!justSeenContent)
indented += *s;
for ( int i = 0; i < indent; i++ )
{
indented += indentMark;
}
if (justSeenContent)
indented += *s;
indent++;
indented += '\n';
for (int i = 0; indent && i < indent; i++)
indented += indentMark;
justSeenContent = false;
}
else if (*s == ')')
{
if ( justSeenContent )
{
indented += '\n';
}
indent--;
for (int i = 0; indent && i < indent; i++)
indented += indentMark;
indented += *s;
indented += '\n';
if (*( s + 1 ) && *(s + 1) != ')' )
{
for (int i = 0; i < indent; i++)
indented += indentMark;
}
justSeenContent = false;
}
else
{
if ( *s == '|' && justSeenContent)
indented += ' ';
indented += *s;
if ( *s == ',' || *s == '|' )
indented += ' ';
justSeenContent = true;
}
}
structure = indented;
} }

View File

@ -34,11 +34,12 @@ class LocationPanel : public wxPanel
XmlDoc *docParameter = NULL, XmlDoc *docParameter = NULL,
const wxString& parent = wxEmptyString ); const wxString& parent = wxEmptyString );
private: private:
void indentStructure ( std::string& structure );
MyFrame *parentWindow; MyFrame *parentWindow;
XmlDoc *doc; XmlDoc *doc;
wxBoxSizer *sizer; wxBoxSizer *sizer;
wxTextCtrl *edit; wxTextCtrl *edit;
//wxListBox *list; wxStyledTextCtrl *structureEdit;
wxString parent; wxString parent;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -115,13 +115,13 @@ BEGIN_EVENT_TABLE ( MyFrame, wxFrame )
EVT_MENU ( ID_REPLACE, MyFrame::OnFindReplace ) EVT_MENU ( ID_REPLACE, MyFrame::OnFindReplace )
EVT_MENU ( ID_GLOBAL_REPLACE, MyFrame::OnGlobalReplace ) EVT_MENU ( ID_GLOBAL_REPLACE, MyFrame::OnGlobalReplace )
EVT_MENU ( ID_CHECK_WELLFORMED, MyFrame::OnCheckWellformedness ) EVT_MENU ( ID_CHECK_WELLFORMED, MyFrame::OnCheckWellformedness )
//EVT_MENU ( ID_VALIDATE_DTD, MyFrame::OnValidateDTD )
EVT_MENU ( ID_VALIDATE_RELAX_NG, MyFrame::OnValidateRelaxNG ) EVT_MENU ( ID_VALIDATE_RELAX_NG, MyFrame::OnValidateRelaxNG )
EVT_MENU ( ID_VALIDATE_W3C_SCHEMA, MyFrame::OnValidateSchema ) EVT_MENU ( ID_VALIDATE_W3C_SCHEMA, MyFrame::OnValidateSchema )
EVT_MENU ( ID_XPATH, MyFrame::OnXPath ) EVT_MENU ( ID_XPATH, MyFrame::OnXPath )
EVT_MENU_RANGE ( ID_XSLT, ID_XSLT_WORDML_DOCBOOK, MyFrame::OnXslt ) EVT_MENU_RANGE ( ID_XSLT, ID_XSLT_WORDML_DOCBOOK, MyFrame::OnXslt )
EVT_MENU ( ID_PRETTYPRINT, MyFrame::OnPrettyPrint ) EVT_MENU ( ID_PRETTYPRINT, MyFrame::OnPrettyPrint )
EVT_MENU ( ID_ENCODING, MyFrame::OnEncoding ) EVT_MENU ( ID_ENCODING, MyFrame::OnEncoding )
EVT_MENU ( ID_STYLE, MyFrame::OnSpelling )
EVT_MENU ( ID_SPELL, MyFrame::OnSpelling ) EVT_MENU ( ID_SPELL, MyFrame::OnSpelling )
EVT_MENU ( ID_FONT_SMALLER, MyFrame::OnFontSmaller ) EVT_MENU ( ID_FONT_SMALLER, MyFrame::OnFontSmaller )
EVT_MENU ( ID_FONT_NORMAL, MyFrame::OnFontMedium ) EVT_MENU ( ID_FONT_NORMAL, MyFrame::OnFontMedium )
@ -280,7 +280,7 @@ MyApp::MyApp() : checker ( NULL ), server ( NULL ), connection ( NULL ),
wxLocale::AddCatalogLookupPathPrefix ( wxT ( ".." ) ); wxLocale::AddCatalogLookupPathPrefix ( wxT ( ".." ) );
#ifndef __WXMSW__ #ifndef __WXMSW__
wxString poDir = GetLinuxAppDir::run() + wxFileName::GetPathSeparator() + _T ( "po" ); wxString poDir = GetLinuxAppDir::run() + wxFileName::GetPathSeparator() + _T ( "po" ) + wxFileName::GetPathSeparator();
wxLocale::AddCatalogLookupPathPrefix ( poDir ); wxLocale::AddCatalogLookupPathPrefix ( poDir );
#endif #endif
@ -642,7 +642,10 @@ MyFrame::MyFrame (
commandString = config->Read ( _T ( "commandString" ), wxEmptyString ); commandString = config->Read ( _T ( "commandString" ), wxEmptyString );
ruleSetPreset = ruleSetPreset =
config->Read ( _T ( "ruleSetPreset" ), _ ( "Default dictionary and style" ) ); config->Read ( _T ( "ruleSetPreset" ), _ ( "Default style" ) );
dictionaryPreset =
config->Read ( _T ( "dictionaryPreset" ), _ ( "en_US" ) );
filterPreset = filterPreset =
config->Read ( _T ( "filterPreset" ), _ ( "(No filter)" ) ); config->Read ( _T ( "filterPreset" ), _ ( "(No filter)" ) );
findData.SetFindString ( config->Read ( _T ( "findReplaceFind" ), _T ( "" ) ) ); findData.SetFindString ( config->Read ( _T ( "findReplaceFind" ), _T ( "" ) ) );
@ -691,7 +694,8 @@ MyFrame::MyFrame (
#else #else
applicationDir = GetLinuxAppDir::run();//getLinuxApplicationDir(); applicationDir = GetLinuxAppDir::run();//getLinuxApplicationDir();
#endif #endif
ruleSetPreset = _ ( "Default dictionary and style" ); ruleSetPreset = _ ( "Default style" );
dictionaryPreset = _ ( "en_US" );
filterPreset = _ ( "No filter" ); filterPreset = _ ( "No filter" );
xpathExpression = lastXslStylesheet = lastRelaxNGSchema = wxEmptyString; xpathExpression = lastXslStylesheet = lastRelaxNGSchema = wxEmptyString;
findRegex = true; findRegex = true;
@ -960,6 +964,7 @@ MyFrame::~MyFrame()
config->Write ( _T ( "highlightSyntax" ), properties.highlightSyntax ); config->Write ( _T ( "highlightSyntax" ), properties.highlightSyntax );
config->Write ( _T ( "applicationDir" ), applicationDir ); config->Write ( _T ( "applicationDir" ), applicationDir );
config->Write ( _T ( "ruleSetPreset" ), ruleSetPreset ); config->Write ( _T ( "ruleSetPreset" ), ruleSetPreset );
config->Write ( _T ( "dictionaryPreset" ), dictionaryPreset );
config->Write ( _T ( "filterPreset" ), filterPreset ); config->Write ( _T ( "filterPreset" ), filterPreset );
config->Write ( _T ( "xpathExpression" ), xpathExpression ); config->Write ( _T ( "xpathExpression" ), xpathExpression );
config->Write ( _T ( "findReplaceFind" ), findData.GetFindString() ); config->Write ( _T ( "findReplaceFind" ), findData.GetFindString() );
@ -1799,17 +1804,11 @@ void MyFrame::OnDialogReplace ( wxFindDialogEvent& event )
if ( findReplacePanel->getRegex() ) if ( findReplacePanel->getRegex() )
{ {
regexWidth = doc->ReplaceTargetRE ( event.GetReplaceString() ); regexWidth = doc->ReplaceTargetRE ( event.GetReplaceString() );
//doc->SetTargetStart(newLocation + regexWidth);
} }
else else
{ {
doc->ReplaceTarget ( event.GetReplaceString() ); doc->ReplaceTarget ( event.GetReplaceString() );
//doc->SetTargetStart(newLocation + event.GetReplaceString().size());
} }
/*
if (doc->GetSelectionStart() != doc->GetSelectionEnd())
doc->ReplaceSelection(event.GetReplaceString());
*/
OnDialogFind ( event ); OnDialogFind ( event );
} }
@ -1943,7 +1942,7 @@ wxString MyFrame::getHtmlBuffer()
startOfLine = true; startOfLine = true;
break; break;
case L'&': case L'&':
htmlBuffer + _T ( "&amp" ); htmlBuffer + _T ( "&amp;" );
startOfLine = false; startOfLine = false;
break; break;
default: default:
@ -3214,7 +3213,7 @@ void MyFrame::OnRevert ( wxCommandEvent& WXUNUSED ( event ) )
doc->SetFocus(); doc->SetFocus();
} }
void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) ) void MyFrame::OnSpelling ( wxCommandEvent& event )
{ {
XmlDoc *doc; XmlDoc *doc;
if ( ( doc = getActiveDocument() ) == NULL ) if ( ( doc = getActiveDocument() ) == NULL )
@ -3228,6 +3227,10 @@ void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) )
doc->SetUndoCollection ( true ); doc->SetUndoCollection ( true );
#endif #endif
int id, type;
id = event.GetId();
type = (id == ID_STYLE) ? ID_TYPE_STYLE : ID_TYPE_SPELL;
std::string rawBufferUtf8; std::string rawBufferUtf8;
getRawText ( doc, rawBufferUtf8 ); getRawText ( doc, rawBufferUtf8 );
@ -3259,7 +3262,7 @@ void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) )
statusProgress ( wxEmptyString ); statusProgress ( wxEmptyString );
std::string error = wl->getLastError(); std::string error = wl->getLastError();
wxString wideError = wxString ( error.c_str(), wxConvUTF8, error.size() ); wxString wideError = wxString ( error.c_str(), wxConvUTF8, error.size() );
wideError.Prepend ( _ ( "Opening spelling and style check in read-only mode: " ) ); wideError.Prepend ( _ ( "Checking document in read-only mode: " ) );
messagePane ( wideError, CONST_WARNING ); messagePane ( wideError, CONST_WARNING );
if ( !ReadFile::run ( tempFileName.name(), bufferParameterUtf8 ) ) if ( !ReadFile::run ( tempFileName.name(), bufferParameterUtf8 ) )
@ -3282,8 +3285,9 @@ void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) )
ruleSetDir, ruleSetDir,
filterDir, filterDir,
browserCommand, browserCommand,
ruleSetPreset, ( type == ID_TYPE_SPELL ) ? dictionaryPreset : ruleSetPreset,
filterPreset, filterPreset,
type,
( success ) ? false : true, ( success ) ? false : true,
stylePosition, stylePosition,
styleSize ) ); styleSize ) );
@ -3296,9 +3300,15 @@ void MyFrame::OnSpelling ( wxCommandEvent& WXUNUSED ( event ) )
else else
doc->SetTextRaw ( bufferUtf8.c_str() ); doc->SetTextRaw ( bufferUtf8.c_str() );
} }
// update presets if report has been created (even if followed by cancel) // update presets if report has been created (even if followed by cancel)
if (type == ID_TYPE_STYLE)
{
ruleSetPreset = sd->getRuleSetPreset(); ruleSetPreset = sd->getRuleSetPreset();
filterPreset = sd->getFilterPreset(); filterPreset = sd->getFilterPreset();
}
else
dictionaryPreset = sd->getRuleSetPreset();
#ifdef __WXMSW__ #ifdef __WXMSW__
stylePosition = sd->getPosition(); stylePosition = sd->getPosition();
@ -5087,6 +5097,7 @@ wxMenuBar *MyFrame::getMenuBar()
} }
// xsl menu // xsl menu
/*
wxMenu *xslMenu = new wxMenu; wxMenu *xslMenu = new wxMenu;
xslMenu->Append ( ID_XSLT, _ ( "&XSL Transform...\tF8" ), xslMenu->Append ( ID_XSLT, _ ( "&XSL Transform...\tF8" ),
_ ( "XSL Transform..." ) ); _ ( "XSL Transform..." ) );
@ -5112,6 +5123,7 @@ wxMenuBar *MyFrame::getMenuBar()
xslMenu->Append ( xslMenu->Append (
ID_XSLT_TEI_FO, ID_XSLT_TEI_FO,
_ ( "TEI to &XSL-FO\tAlt+7" ), _ ( "TEI to XSL-FO" ) ); _ ( "TEI to &XSL-FO\tAlt+7" ), _ ( "TEI to XSL-FO" ) );
*/
// xml menu // xml menu
xmlMenu = new wxMenu; // use class-wide data member xmlMenu = new wxMenu; // use class-wide data member
@ -5128,7 +5140,8 @@ wxMenuBar *MyFrame::getMenuBar()
_ ( "&Associate" ), _ ( "&Associate" ),
associateMenu ); associateMenu );
xmlMenu->AppendSeparator(); xmlMenu->AppendSeparator();
xmlMenu->Append ( wxID_ANY, _ ( "&XSLT" ), xslMenu ); xmlMenu->Append ( ID_XSLT, _ ( "&XSL Transform...\tF8" ),
_ ( "XSL Transform..." ) );
xmlMenu->Append ( xmlMenu->Append (
ID_XPATH, ID_XPATH,
_ ( "&Evaluate XPath...\tF9" ), _ ( "&Evaluate XPath...\tF9" ),
@ -5156,10 +5169,18 @@ wxMenuBar *MyFrame::getMenuBar()
new wxMenuItem ( new wxMenuItem (
NULL, NULL,
ID_SPELL, ID_SPELL,
_ ( "&Spelling and Style...\tF7" ), _ ( "&Spelling...\tF7" ),
_ ( "Spelling and Style..." ) ); _ ( "Spelling..." ) );
spellingItem->SetBitmap ( spelling16Bitmap ); spellingItem->SetBitmap ( spelling16Bitmap );
wxMenuItem *styleItem =
new wxMenuItem (
NULL,
ID_STYLE,
_ ( "&Style...\tShift+F7" ),
_ ( "Style..." ) );
styleItem->SetBitmap ( wxNullBitmap );
wxMenuItem *wordCountItem = wxMenuItem *wordCountItem =
new wxMenuItem ( new wxMenuItem (
NULL, NULL,
@ -5177,6 +5198,7 @@ wxMenuBar *MyFrame::getMenuBar()
commandItem->SetBitmap ( wxNullBitmap ); commandItem->SetBitmap ( wxNullBitmap );
toolsMenu->Append ( spellingItem ); toolsMenu->Append ( spellingItem );
toolsMenu->Append ( styleItem );
toolsMenu->Append ( wordCountItem ); toolsMenu->Append ( wordCountItem );
toolsMenu->AppendSeparator(); toolsMenu->AppendSeparator();
toolsMenu->Append ( commandItem ); toolsMenu->Append ( commandItem );
@ -5386,11 +5408,11 @@ wxToolBar *MyFrame::getToolBar()
_ ( "Browser" ) ); _ ( "Browser" ) );
toolBar->AddTool ( toolBar->AddTool (
ID_SPELL, ID_SPELL,
_ ( "Spelling and Style" ), _ ( "Spelling" ),
spellingBitmap, spellingBitmap,
wxNullBitmap, wxNullBitmap,
wxITEM_NORMAL, wxITEM_NORMAL,
_ ( "Spelling and Style" ) ); _ ( "Spelling" ) );
toolBar->AddCheckTool ( toolBar->AddCheckTool (
ID_PROTECT_TAGS, ID_PROTECT_TAGS,

View File

@ -139,6 +139,7 @@ enum
ID_PRETTYPRINT, ID_PRETTYPRINT,
ID_ENCODING, ID_ENCODING,
ID_SPELL, ID_SPELL,
ID_STYLE,
ID_FONT_SMALLER, ID_FONT_SMALLER,
ID_FONT_NORMAL, ID_FONT_NORMAL,
ID_FONT_LARGER, ID_FONT_LARGER,
@ -253,6 +254,7 @@ class MyFrame : public wxFrame
void OnUndo ( wxCommandEvent& event ); void OnUndo ( wxCommandEvent& event );
void OnRedo ( wxCommandEvent& event ); void OnRedo ( wxCommandEvent& event );
void OnSpelling ( wxCommandEvent& event ); void OnSpelling ( wxCommandEvent& event );
//void OnStyle ( wxCommandEvent& event );
void OnPreviousDocument ( wxCommandEvent& event ); void OnPreviousDocument ( wxCommandEvent& event );
void OnNextDocument ( wxCommandEvent& event ); void OnNextDocument ( wxCommandEvent& event );
void OnOptions ( wxCommandEvent& event ); void OnOptions ( wxCommandEvent& event );
@ -384,6 +386,7 @@ class MyFrame : public wxFrame
wxSize styleSize; wxSize styleSize;
wxString applicationDir, wxString applicationDir,
ruleSetPreset, ruleSetPreset,
dictionaryPreset,
filterPreset, filterPreset,
ruleSetDir, ruleSetDir,
filterDir, filterDir,

View File

@ -1,5 +1,5 @@
%define name xmlcopyeditor %define name xmlcopyeditor
%define version 1.1.0.5 %define version 1.1.0.6
%define release 1 %define release 1
%define author Gerald Schmidt <gnschmidt@users.sourceforge.net> %define author Gerald Schmidt <gnschmidt@users.sourceforge.net>
%define prefix /usr/local %define prefix /usr/local

View File

@ -41,5 +41,5 @@
"License along with this program; if not, write to the Free\n"\ "License along with this program; if not, write to the Free\n"\
"Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\ "Software Foundation, Inc., 59 Temple Place, Suite 330,\n"\
"Boston, MA 02111-1307 USA.") "Boston, MA 02111-1307 USA.")
#define ABOUT_VERSION _T("1.1.0.5") #define ABOUT_VERSION _T("1.1.0.6")
#define XMLCE_VAR _T("XMLCE_VAR") #define XMLCE_VAR _T("XMLCE_VAR")

View File

@ -59,9 +59,6 @@ XmlCtrl::XmlCtrl (
basePath ( basePathParameter ), basePath ( basePathParameter ),
auxPath ( auxPathParameter ) auxPath ( auxPathParameter )
{ {
//SetEOLMode ( wxSTC_EOL_LF );
//SetPasteConvertEndings ( true );
currentMaxLine = 1; currentMaxLine = 1;
validationRequired = grammarFound = false; validationRequired = grammarFound = false;
@ -107,7 +104,7 @@ XmlCtrl::XmlCtrl (
applyVisibilityState ( visibilityState ); applyVisibilityState ( visibilityState );
lineBackgroundState = BACKGROUND_STATE_NORMAL; lineBackgroundState = BACKGROUND_STATE_NORMAL;
for ( int i = 0; i < wxSTC_INDIC_MAX; ++i ) // start from 1 to disable faulty default indication for ( int i = 0; i < wxSTC_INDIC_MAX; ++i )
IndicatorSetStyle ( i, wxSTC_INDIC_HIDDEN ); IndicatorSetStyle ( i, wxSTC_INDIC_HIDDEN );
IndicatorSetStyle ( 2, wxSTC_INDIC_SQUIGGLE ); IndicatorSetStyle ( 2, wxSTC_INDIC_SQUIGGLE );
IndicatorSetForeground ( 0, *wxRED ); IndicatorSetForeground ( 0, *wxRED );
@ -202,7 +199,6 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event )
// tag // tag
int limitStyle = getLexerStyleAt ( limitPos ); int limitStyle = getLexerStyleAt ( limitPos );
//limitStyle &= ~wxSTC_INDIC2_MASK;
if ( GetCharAt ( limitPos ) == '>' && if ( GetCharAt ( limitPos ) == '>' &&
( limitStyle == wxSTC_H_TAG || ( limitStyle == wxSTC_H_TAG ||
limitStyle == wxSTC_H_TAGUNKNOWN || limitStyle == wxSTC_H_TAGUNKNOWN ||
@ -230,7 +226,7 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event )
GetCharAt ( limitPos ) != '<'; GetCharAt ( limitPos ) != '<';
limitPos-- ) limitPos-- )
; ;
SetSelection ( currentPos, limitPos );//(limitPos, currentPos); SetSelection ( currentPos, limitPos );
if ( *protectTags ) if ( *protectTags )
{ {
SetReadOnly ( true ); // needed to prevent erroneous BS insertion by control SetReadOnly ( true ); // needed to prevent erroneous BS insertion by control
@ -250,8 +246,8 @@ void XmlCtrl::handleBackspace ( wxKeyEvent& event )
DeleteBack(); DeleteBack();
return; return;
} }
// entity reference
// entity reference
else if ( GetCharAt ( limitPos ) == ';' && getLexerStyleAt ( limitPos ) == wxSTC_H_ENTITY ) else if ( GetCharAt ( limitPos ) == ';' && getLexerStyleAt ( limitPos ) == wxSTC_H_ENTITY )
{ {
// delete entity to left of caret // delete entity to left of caret
@ -437,7 +433,6 @@ void XmlCtrl::handleOpenAngleBracket ( wxKeyEvent& event )
// exit conditions based on style // exit conditions based on style
int style = getLexerStyleAt ( pos ); int style = getLexerStyleAt ( pos );
//style &= ~wxSTC_INDIC2_MASK;
switch ( style ) switch ( style )
{ {
case wxSTC_H_DOUBLESTRING: case wxSTC_H_DOUBLESTRING:
@ -611,7 +606,6 @@ void XmlCtrl::handleSpace ( wxKeyEvent& event )
} }
int style = getLexerStyleAt ( pos - 1 ); int style = getLexerStyleAt ( pos - 1 );
//style &= ~wxSTC_INDIC2_MASK;
char c = GetCharAt ( pos - 1 ); char c = GetCharAt ( pos - 1 );
@ -748,8 +742,7 @@ void XmlCtrl::OnKeyPressed ( wxKeyEvent& event )
if ( *protectTags ) if ( *protectTags )
SetOvertype ( false ); SetOvertype ( false );
//bool autoindent; int pos, iteratorPos, maxPos;
int pos, iteratorPos, maxPos; // omitted startPos, line, newPos
char c; char c;
wxString s; wxString s;
switch ( event.GetKeyCode() ) switch ( event.GetKeyCode() )
@ -995,7 +988,6 @@ int XmlCtrl::getParentCloseAngleBracket ( int pos, int range )
{ {
int type, style; int type, style;
style = getLexerStyleAt ( iteratorPos ); style = getLexerStyleAt ( iteratorPos );
//style &= ~wxSTC_INDIC2_MASK;
if ( GetCharAt ( iteratorPos ) == '>' && if ( GetCharAt ( iteratorPos ) == '>' &&
( style == wxSTC_H_TAG || ( style == wxSTC_H_TAG ||
@ -1015,7 +1007,6 @@ int XmlCtrl::getParentCloseAngleBracket ( int pos, int range )
case ( TAG_TYPE_ERROR ) : case ( TAG_TYPE_ERROR ) :
break; break;
} }
//(isCloseTag(iteratorPos)) ? ++depth : --depth;
if ( !depth ) if ( !depth )
return iteratorPos; return iteratorPos;
} }
@ -1058,6 +1049,7 @@ void XmlCtrl::updatePromptMaps ( const char *buffer, size_t bufferLen )
{ {
attributeMap.clear(); attributeMap.clear();
elementMap.clear(); elementMap.clear();
elementStructureMap.clear();
std::auto_ptr<XmlPromptGenerator> xpg ( new XmlPromptGenerator ( std::auto_ptr<XmlPromptGenerator> xpg ( new XmlPromptGenerator (
catalogPath, catalogPath,
basePath, basePath,
@ -1066,8 +1058,10 @@ void XmlCtrl::updatePromptMaps ( const char *buffer, size_t bufferLen )
xpg->getAttributeMap ( attributeMap ); xpg->getAttributeMap ( attributeMap );
xpg->getRequiredAttributeMap ( requiredAttributeMap ); xpg->getRequiredAttributeMap ( requiredAttributeMap );
xpg->getElementMap ( elementMap ); xpg->getElementMap ( elementMap );
xpg->getElementStructureMap ( elementStructureMap );
xpg->getEntitySet ( entitySet ); xpg->getEntitySet ( entitySet );
grammarFound = xpg->getGrammarFound(); grammarFound = xpg->getGrammarFound();
entitySet.insert ( "amp" );
entitySet.insert ( "apos" ); entitySet.insert ( "apos" );
entitySet.insert ( "quot" ); entitySet.insert ( "quot" );
entitySet.insert ( "lt" ); entitySet.insert ( "lt" );
@ -1264,7 +1258,6 @@ bool XmlCtrl::canInsertAt ( int pos )
return false; return false;
int style = getLexerStyleAt ( pos ); int style = getLexerStyleAt ( pos );
//style &= ~wxSTC_INDIC2_MASK;
switch ( style ) switch ( style )
{ {
case wxSTC_H_TAG: case wxSTC_H_TAG:
@ -1285,7 +1278,6 @@ bool XmlCtrl::canInsertAt ( int pos )
bool XmlCtrl::canMoveRightAt ( int pos ) bool XmlCtrl::canMoveRightAt ( int pos )
{ {
int style = getLexerStyleAt ( pos ); int style = getLexerStyleAt ( pos );
//style &= ~wxSTC_INDIC2_MASK;
switch ( style ) switch ( style )
{ {
case wxSTC_H_DEFAULT: case wxSTC_H_DEFAULT:
@ -1300,7 +1292,6 @@ bool XmlCtrl::canMoveLeftAt ( int pos )
return false; return false;
int style = getLexerStyleAt ( pos - 1 ); int style = getLexerStyleAt ( pos - 1 );
//style &= ~wxSTC_INDIC2_MASK;
switch ( style ) switch ( style )
{ {
case wxSTC_H_DEFAULT: case wxSTC_H_DEFAULT:
@ -1743,10 +1734,6 @@ void XmlCtrl::toggleFold()
break; break;
} }
} }
// was previously (changed so cursor doesn't have to be in headline):
// if ( XMLCTRL_HASBIT ( level, wxSTC_FOLDLEVELHEADERFLAG ) )
// ToggleFold ( line );
} }
// adapted from wxSTEdit (c) 2005 John Labenski, Otto Wyss // adapted from wxSTEdit (c) 2005 John Labenski, Otto Wyss
@ -1835,7 +1822,6 @@ bool XmlCtrl::insertChild ( const wxString& child )
{ {
if ( !canInsertAt ( start ) ) if ( !canInsertAt ( start ) )
return false; return false;
//tag = _T("<") + child + _T(">");
offset = openTag.Length(); offset = openTag.Length();
wxString tag; wxString tag;
@ -1847,9 +1833,6 @@ bool XmlCtrl::insertChild ( const wxString& child )
} }
if ( *protectTags ) if ( *protectTags )
adjustSelection(); adjustSelection();
//wxString openTag, closeTag;
//openTag = _T("<") + child + _T(">");
//closeTag = _T("</") + child + _T(">");
offset = openTag.Length(); offset = openTag.Length();
if ( start > end ) if ( start > end )
{ {
@ -1958,6 +1941,28 @@ std::set<std::string> XmlCtrl::getEntitySet()
return entitySet; return entitySet;
} }
std::set<std::string> XmlCtrl::getAttributes ( const wxString& parent )
{
std::set<std::string> retVal;
return retVal;
}
std::string XmlCtrl::getElementStructure ( const wxString& element )
{
std::string stdElement, ret;
stdElement = element.mb_str ( wxConvUTF8);
if ( elementStructureMap.find ( stdElement ) == elementStructureMap.end() )
{
ret = "";
}
else
{
ret = elementStructureMap[stdElement];
}
return ret;
}
bool XmlCtrl::shallowValidate ( int maxLine, bool segmentOnly ) bool XmlCtrl::shallowValidate ( int maxLine, bool segmentOnly )
{ {
if ( !properties.validateAsYouType || type != FILE_TYPE_XML ) if ( !properties.validateAsYouType || type != FILE_TYPE_XML )

View File

@ -98,7 +98,6 @@ class XmlCtrl: public wxStyledTextCtrl
int visibilityStateParameter = SHOW_TAGS, int visibilityStateParameter = SHOW_TAGS,
int typeParameter = FILE_TYPE_XML, int typeParameter = FILE_TYPE_XML,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
//const std::string& buffer = DEFAULT_XML_DECLARATION_UTF8,
const char *buffer = NULL, const char *buffer = NULL,
size_t bufferLen = 0, size_t bufferLen = 0,
const std::string& catalogPath = "", const std::string& catalogPath = "",
@ -136,6 +135,8 @@ class XmlCtrl: public wxStyledTextCtrl
wxString getLastElementName ( int pos ); wxString getLastElementName ( int pos );
std::set<wxString> getChildren ( const wxString& parent ); std::set<wxString> getChildren ( const wxString& parent );
std::set<std::string> getEntitySet(); std::set<std::string> getEntitySet();
std::set<std::string> getAttributes ( const wxString& parent );
std::string getElementStructure ( const wxString& parent );
bool canInsertAt ( int pos ); bool canInsertAt ( int pos );
int getTagStartPos ( int pos ); int getTagStartPos ( int pos );
void toggleLineBackground(); void toggleLineBackground();
@ -162,6 +163,7 @@ class XmlCtrl: public wxStyledTextCtrl
std::map<std::string, std::set<std::string> > requiredAttributeMap; std::map<std::string, std::set<std::string> > requiredAttributeMap;
std::map<std::string, std::set<std::string> > elementMap; std::map<std::string, std::set<std::string> > elementMap;
std::set<std::string> entitySet; std::set<std::string> entitySet;
std::map<std::string, std::string> elementStructureMap;
std::string catalogPath, basePath, auxPath; std::string catalogPath, basePath, auxPath;
XmlCtrlProperties properties; XmlCtrlProperties properties;
wxString getLastAttributeName ( int pos ); wxString getLastAttributeName ( int pos );

View File

@ -50,6 +50,7 @@ XmlPromptGenerator::XmlPromptGenerator (
XML_SetUserData ( p, d.get() ); XML_SetUserData ( p, d.get() );
d->p = p; d->p = p;
d->catalogPath = catalogPath; d->catalogPath = catalogPath;
d->basePath = basePath;
d->auxPath = auxPath; d->auxPath = auxPath;
d->elementDeclRecurseLevel = 0; d->elementDeclRecurseLevel = 0;
d->isRootElement = true; d->isRootElement = true;
@ -166,6 +167,12 @@ void XmlPromptGenerator::getEntitySet (
entitySet = d->entitySet; entitySet = d->entitySet;
} }
void XmlPromptGenerator::getElementStructureMap (
std::map<std::string, std::string> &elementStructureMap )
{
elementStructureMap = d->elementStructureMap;
}
// handlers for DOCTYPE handling // handlers for DOCTYPE handling
void XMLCALL XmlPromptGenerator::doctypedeclstarthandler ( void XMLCALL XmlPromptGenerator::doctypedeclstarthandler (
@ -303,6 +310,11 @@ int XMLCALL XmlPromptGenerator::externalentityrefhandler (
{ {
Replace::run ( stdSystemId, "file://", "", false ); Replace::run ( stdSystemId, "file://", "", false );
Replace::run ( stdSystemId, "%20", " ", false ); Replace::run ( stdSystemId, "%20", " ", false );
#ifdef __WXMSW__
Replace::run ( stdSystemId, "/C:/", "C:\\", false );
Replace::run ( stdSystemId, "/", "\\", false );
#endif
} }
else else
{ {
@ -396,7 +408,10 @@ void XmlPromptGenerator::handleSchema (
{ {
return; return;
} }
std::string schemaPath = PathResolver::run ( path, d->auxPath );
std::string schemaPath = PathResolver::run ( path, ( d->auxPath.empty() ) ? d->basePath : d->auxPath);
try try
{ {
@ -417,6 +432,7 @@ void XmlPromptGenerator::handleSchema (
if ( !rootGrammar ) if ( !rootGrammar )
{ {
delete parser; delete parser;
XMLPlatformUtils::Terminate();
return; return;
} }
@ -427,7 +443,7 @@ void XmlPromptGenerator::handleSchema (
{ {
delete grammar; delete grammar;
delete parser; delete parser;
XMLPlatformUtils::Terminate();
return; return;
} }
@ -451,8 +467,12 @@ void XmlPromptGenerator::handleSchema (
{ {
size_t len; size_t len;
char *s, *word; char *s, *word;
std::string structure;
s = ( char * ) XMLString::transcode ( fmtCntModel ); s = ( char * ) XMLString::transcode ( fmtCntModel );
structure = s;
d->elementStructureMap.insert ( make_pair ( element, structure ) );
while ( ( word = GetWord::run ( &s, &len ) ) != NULL ) while ( ( word = GetWord::run ( &s, &len ) ) != NULL )
{ {
std::string currentValue ( word, len ); std::string currentValue ( word, len );
@ -500,6 +520,9 @@ void XmlPromptGenerator::handleSchema (
d->attributeMap.insert( make_pair ( element, attributeMap ) ); d->attributeMap.insert( make_pair ( element, attributeMap ) );
} }
} }
delete parser;
XMLPlatformUtils::Terminate();
} }

View File

@ -32,8 +32,9 @@ struct PromptGeneratorData : public ParserData
attributeMap; attributeMap;
std::map<std::string, std::set<std::string> > elementMap; std::map<std::string, std::set<std::string> > elementMap;
std::map<std::string, std::set<std::string> > requiredAttributeMap; std::map<std::string, std::set<std::string> > requiredAttributeMap;
std::map<std::string, std::string> elementStructureMap;
std::set<std::string> entitySet; std::set<std::string> entitySet;
std::string catalogPath, auxPath, rootElement; std::string catalogPath, basePath, auxPath, rootElement;
int elementDeclRecurseLevel; int elementDeclRecurseLevel;
bool isRootElement, grammarFound; bool isRootElement, grammarFound;
unsigned attributeValueCutoff; unsigned attributeValueCutoff;
@ -58,6 +59,8 @@ class XmlPromptGenerator : public WrapExpat
void getEntitySet ( void getEntitySet (
std::set<std::string> &entitySet ); std::set<std::string> &entitySet );
bool getGrammarFound(); bool getGrammarFound();
void getElementStructureMap (
std::map<std::string, std::string> &elementStructureMap );
private: private:
std::auto_ptr<PromptGeneratorData> d; std::auto_ptr<PromptGeneratorData> d;
static void XMLCALL starthandler ( static void XMLCALL starthandler (