Statistics
| Branch: | Revision:

root / src / nedxml / neddtdvalidatorbase.h @ 68da4f12

History | View | Annotate | Download (1.79 KB)

1 01873262 Georg Kunz
//==========================================================================
2
// neddtdvalidatorbase.h -
3
//
4
//                     OMNeT++/OMNEST
5
//            Discrete System Simulation in C++
6
//
7
//==========================================================================
8
9
/*--------------------------------------------------------------*
10
  Copyright (C) 2002-2008 Andras Varga
11
  Copyright (C) 2006-2008 OpenSim Ltd.
12

13
  This file is distributed WITHOUT ANY WARRANTY. See the file
14
  `license' for details on this and other legal matters.
15
*--------------------------------------------------------------*/
16
17
18
#ifndef __NEDDTDVALIDATORBASE_H
19
#define __NEDDTDVALIDATORBASE_H
20
21
#include "nedvalidator.h"
22
23
NAMESPACE_BEGIN
24
25
/**
26
 * Adds utility methods for DTD validation to NEDValidatorBase.
27
 *
28
 * @ingroup Validation
29
 */
30
class NEDXML_API NEDDTDValidatorBase : public NEDValidatorBase
31
{
32
  protected:
33
    struct Choice {
34
        int tags[20]; // array terminated by NED_NULL (increase size if needed)
35
        char mult;
36
    };
37
38
    // helper function
39
    void tryCheckChoice(NEDElement *node, NEDElement *&curchild, int tags[], char mult);
40
41
    /** @name Utility functions */
42
    //@{
43
    void checkSequence(NEDElement *node, int tags[], char mult[]);
44
    void checkChoice(NEDElement *node, int tags[], char mult);
45
    void checkSeqOfChoices(NEDElement *node, Choice choices[], int n);
46
    void checkEmpty(NEDElement *node);
47
    void checkRequiredAttribute(NEDElement *node, const char *attr);
48
    void checkEnumeratedAttribute(NEDElement *node, const char *attr, const char *vals[], int n);
49
    void checkNameAttribute(NEDElement *node, const char *attr);
50
    void checkCommentAttribute(NEDElement *node, const char *attr);
51
    //@}
52
  public:
53
    NEDDTDValidatorBase(NEDErrorStore *e) : NEDValidatorBase(e) {}
54
};
55
56
NAMESPACE_END
57
58
59
#endif