/* * * ProLinga-Validate * * Copyright (C) 2002-2008 Xobas Software. * All rights reserved. * * This file is part of ProLinga-Validate. * * ProLinga-Validate is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ProLinga-Validate is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ProLinga-Validate. If not, see . * * More information is available at the following addresses: * * Website : http://www.prolinga.org * * Email : prolinga-list@prolinga.org * * */ #include "ValCommon.h" #include #include #include #include "SyntaxError.hpp" xmlDocPtr ValCreateErrorDoc(void) { xmlDocPtr docError; xmlNodePtr curError; /* Create empty error document */ docError = xmlNewDoc((const xmlChar *)"1.0"); docError->children = xmlNewDocNode(docError, NULL, (const xmlChar *)"ProLinga", NULL); curError = xmlDocGetRootElement(docError); curError = xmlNewTextChild (curError, NULL, (const xmlChar *)"Runner", (const xmlChar *)""); xmlNewProp (curError, (const xmlChar *)"Version", (const xmlChar *)"1.0"); curError = xmlNewTextChild (curError, NULL, (const xmlChar *)"ValidateErrors", (const xmlChar *)""); /* Return */ return docError; } void ValInsertError(const int lineno, const int argno, const int id, const char *severity, const char *description, const char *details, xmlDocPtr docError) { xmlNodePtr curError; char dummy[10]=""; /* Set Pointer */ curError = xmlDocGetRootElement(docError); curError = curError->xmlChildrenNode; curError = xmlGetLastChild(curError); /* Insert Error */ curError = xmlNewTextChild (curError, NULL, (const xmlChar *)"ValidateError", (const xmlChar *)""); sprintf(dummy, "%d", lineno); xmlNewProp (curError, (const xmlChar *)"LineNo", (const xmlChar *)dummy); sprintf(dummy, "%d", argno); xmlNewProp (curError, (const xmlChar *)"ArgumentNo", (const xmlChar *)dummy); xmlNewTextChild (curError, NULL, (const xmlChar *)"Severity", (const xmlChar *)severity); sprintf(dummy, "%d", id); xmlNewTextChild (curError, NULL, (const xmlChar *)"Id", (const xmlChar *)dummy); xmlNewTextChild (curError, NULL, (const xmlChar *)"Description", (const xmlChar *)description); xmlNewTextChild (curError, NULL, (const xmlChar *)"Details", (const xmlChar *)details); } void ValInsertPredefinedError(const int lineno, const int argno, const int id, const char *details, xmlDocPtr docError) { ValInsertError(lineno, argno, id, errorSyntaxSeverity[errorSyntaxTable40000[(id-40000)].severity], errorSyntaxTable40000[(id-40000)].description, details, docError); }