blob: 98ba6e34bfb40542816b6bad021aaf2bbaf0a677 [file] [log] [blame]
Georges-Henri Baron326a31d2012-06-28 12:05:09 +02001/*
2 * INTEL CONFIDENTIAL
Georges-Henri Baroncec86c12012-09-04 17:30:28 +02003 * Copyright © 2013 Intel
Georges-Henri Baron326a31d2012-06-28 12:05:09 +02004 * Corporation All Rights Reserved.
5 *
6 * The source code contained or described herein and all documents related to
7 * the source code ("Material") are owned by Intel Corporation or its suppliers
8 * or licensors. Title to the Material remains with Intel Corporation or its
9 * suppliers and licensors. The Material contains trade secrets and proprietary
10 * and confidential information of Intel or its suppliers and licensors. The
11 * Material is protected by worldwide copyright and trade secret laws and
12 * treaty provisions. No part of the Material may be used, copied, reproduced,
13 * modified, published, uploaded, posted, transmitted, distributed, or
14 * disclosed in any way without Intel’s prior express written permission.
15 *
16 * No license under any patent, copyright, trade secret or other intellectual
17 * property right is granted to or conferred upon you by disclosure or delivery
18 * of the Materials, either expressly, by implication, inducement, estoppel or
19 * otherwise. Any license under such intellectual property rights must be
20 * express and approved by Intel in writing.
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020021 */
22
23#pragma once
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020024#include "XmlDocSource.h"
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020025#include <string>
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020026
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020027/**
28 * Source class that read a file to get an xml document.
29 * Its base class will validate the document.
30 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020031class CXmlFileDocSource : public CXmlDocSource
32{
33public:
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020034 /**
35 * Constructor
36 *
37 * @param[in] strXmlInstanceFile a string containing the path to the xml file
38 * @param[in] strXmlSchemaFile a string containing the path to the schema file
39 * @param[in] strRootElementType a string containing the root element type
40 * @param[in] strRootElementName a string containing the root element name
41 * @param[in] strNameAttributeName a string containing the name of the root name attribute
42 */
43 CXmlFileDocSource(const string& strXmlInstanceFile,
44 const string& strXmlSchemaFile,
45 const string& strRootElementType,
46 const string& strRootElementName,
47 const string& strNameAttrituteName);
48 /**
49 * Constructor
50 *
51 * @param[in] strXmlInstanceFile a string containing the path to the xml file
52 * @param[in] strXmlSchemaFile a string containing the path to the schema file
53 * @param[in] strRootElementType a string containing the root element type
54 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020055 CXmlFileDocSource(const string& strXmlInstanceFile, const string& strXmlSchemaFile, const string& strRootElementType);
56
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020057 /**
58 * CXmlDocSource method implementation.
59 *
60 * @param[out] serializingContext is used as error output
61 *
62 * @return false if any error occurs
63 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020064 virtual bool populate(CXmlSerializingContext& serializingContext);
65
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020066 /**
67 * Method that checks that the file exists and is readable.
68 *
69 * @param[out] serializingContext is used as error output
70 *
71 * @return false if any error occurs during the parsing
72 */
Frédéric Boisnarda409daa2012-10-18 18:20:03 +020073 virtual bool isParsable(CXmlSerializingContext& serializingContext) const;
74
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020075private:
76
Georges-Henri Baroncec86c12012-09-04 17:30:28 +020077 /**
78 * Instance file
79 */
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020080 string _strXmlInstanceFile;
Georges-Henri Baron326a31d2012-06-28 12:05:09 +020081};