/* * * 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 "ValConfig.hpp" #include #include #include "VCDocumentParse.hpp" #include "ValMain.hpp" #include void Usage(const char *progName) { printf("Usage : %s [ [--version] || [--config file_name] --in input_VC_file_name --out output_VC_file_name ] \n", progName); } int main(int argc, char *argv[]) { xmlDocPtr docIn, docOut; int i, status; char *configFileName = DEF_CONFIG_FILE, *inFileName = NULL, *outFileName = NULL; PlValidate val; /* Process command line arguments */ if (argc <= 1) { Usage(argv[0]); return 0; } for (i=1;i= argc) { Usage(argv[0]); return 0; } i++; configFileName = argv[i]; } else if ((!strcmp(argv[i], "-in")) || (!strcmp(argv[i], "--in"))) { if ((i+1) >= argc) { Usage(argv[0]); return 0; } i++; inFileName = argv[i]; } else if ((!strcmp(argv[i], "-out")) || (!strcmp(argv[i], "--out"))) { if ((i+1) >= argc) { Usage(argv[0]); return 0; } i++; outFileName = argv[i]; } } /* Check if file names have values */ if (inFileName == NULL || outFileName == NULL) { Usage(argv[0]); return 0; } /* Parse file */ status = VCDocumentParse(inFileName, PARSE_FILE, &docIn); if (status != 0) { /* Error handling */ VCParseErrorResponse(status, &docOut); } else { /* Open validate environment */ val.validateOpen(configFileName); /* Process and return XML command */ xmlSaveFile(outFileName, val.executeCommand(docIn)); /* Close validate environment */ val.validateClose(); } /* Return */ return 0; }