• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1syntax = "proto2";
2package protobuf_mutator.xml;
3
4// Simplified definition of XML formant according https://www.w3.org/TR/xml/
5// Not all features are implemented and some rules are flattened.
6
7// There are no required fields to allow backward compatibility with older
8// corpus.
9
10// document ::= prolog element Misc*
11// prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
12// XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
13// doctypedecl ::=
14//    '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'
15message Document {
16  // XMLDecl
17  optional string version = 1;
18  optional string encoding = 2;
19  optional bool standalone = 3;
20
21  repeated Misk misk1 = 4;
22  optional DoctypeDecl doctype = 5;
23  optional Element element = 6;
24  repeated Misk misk2 = 7;
25}
26
27message DoctypeDecl {
28  optional string name = 1;
29  optional string external_id = 2;
30  optional string int_subset = 3;
31  repeated Misk misk = 4;
32}
33
34message Misk {
35  oneof _ {
36    Pi pi = 1;
37    string comment = 2;
38  }
39}
40
41// element ::= EmptyElemTag | STag content ETag
42message Element {
43  optional Tag tag = 1;
44  // Use EmptyElemTag tag if missing, or STag and ETag otherwise.
45  repeated Content content = 2;
46}
47
48// EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
49// STag ::= '<' Name (S Attribute)* S? '>'
50// ETag ::= '</' Name S? '>'
51message Tag {
52  optional string name = 1;
53  repeated Attribute attribute = 2;
54}
55
56message Reference {
57  optional string name = 1;
58  optional bool entry = 2;
59}
60
61message Pi {
62  optional string target = 1;
63  optional string data = 2;
64}
65
66// content ::=
67//    CharData? ((element | Reference | CDSect | PI | Comment) CharData?)*
68message Content {
69  oneof _ {
70    string char_data = 1;
71    Element element = 2;
72    Reference reference = 3;
73    string cdsect = 4;
74    Misk misk = 5;
75  }
76}
77
78// Attribute ::=  Name Eq AttValue
79message Attribute {
80  optional string name = 1;
81  optional string value = 2;
82}
83
84message Input {
85  optional Document document = 1;
86
87  // Option will be sent into libxml2 parser.
88  // TODO(vitalybuka): Use proto extension. Options is libxml2 specific,
89  // other libs may need different data. At the moment mutator does not support
90  // extensions.
91  optional uint32 options = 2;
92}
93