1 /************************************************************************
\r
3 ** Copyright (C) 2010 Strahinja Markovic
\r
5 ** This file is part of FlightCrew.
\r
7 ** FlightCrew is free software: you can redistribute it and/or modify
\r
8 ** it under the terms of the GNU Lesser General Public License as published
\r
9 ** by the Free Software Foundation, either version 3 of the License, or
\r
10 ** (at your option) any later version.
\r
12 ** FlightCrew is distributed in the hope that it will be useful,
\r
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 ** GNU Lesser General Public License for more details.
\r
17 ** You should have received a copy of the GNU Lesser General Public License
\r
18 ** along with FlightCrew. If not, see <http://www.gnu.org/licenses/>.
\r
20 *************************************************************************/
\r
23 #include "SatisfiesXhtmlSchema.h"
\r
24 #include "Misc/ErrorResultCollector.h"
\r
25 #include <ToXercesStringConverter.h>
\r
26 #include <XmlUtils.h>
\r
27 #include <LocationAwareDOMParser.h>
\r
28 #include <xercesc/sax/SAXException.hpp>
\r
30 namespace FlightCrew
\r
33 SatisfiesXhtmlSchema::SatisfiesXhtmlSchema()
\r
35 m_Dtd( XHTML11_FLAT_DTD,
\r
36 XHTML11_FLAT_DTD_LEN,
\r
37 toX( XHTML11_FLAT_DTD_ID ) ),
\r
38 m_OpsSchema( OPS201_XSD,
\r
40 toX( OPS201_XSD_ID ) ),
\r
41 m_OpsSwitchSchema( OPS_SWITCH_XSD,
\r
43 toX( OPS_SWITCH_XSD_ID ) ),
\r
44 m_SvgSchema( SVG11_XSD,
\r
46 toX( SVG11_XSD_ID ) ),
\r
47 m_XlinkSchema( XLINK_XSD,
\r
49 toX( XLINK_XSD_ID ) ),
\r
50 m_XmlSchema( XML_XSD,
\r
58 std::vector< Result > SatisfiesXhtmlSchema::ValidateFile( const fs::path &filepath )
\r
60 std::string location = std::string( OPS201_XSD_NS )
\r
62 .append( OPS201_XSD_ID );
\r
64 std::vector< const xc::MemBufInputSource* > schemas;
\r
65 schemas.push_back( &m_XmlSchema );
\r
66 schemas.push_back( &m_XlinkSchema );
\r
67 schemas.push_back( &m_SvgSchema );
\r
68 schemas.push_back( &m_OpsSwitchSchema );
\r
69 schemas.push_back( &m_OpsSchema );
\r
71 std::vector< const xc::MemBufInputSource* > dtds;
\r
72 dtds.push_back( &m_Dtd );
\r
74 return ValidateAgainstSchema( filepath, location, schemas, dtds );
\r
77 } //namespace FlightCrew
\r