1   /* Copyright 2002-2021 CS GROUP
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.orekit.files.ccsds.utils.lexical;
18  
19  import java.util.List;
20  
21  import org.xml.sax.Attributes;
22  
23  /** Builder for building {@link ParseToken} from XML elements.
24   * <p>
25   * The regular handling of regular XML elements is to used the element
26   * name as the token name, the element content as the token content and
27   * the "units" attribute for the units. In some cases however the token
28   * name should be extracted from attributes, and sometimes even the
29   * content. This interface allows to define all these behaviors, by
30   * providing specialized builders to the lexical analyzer when it calls
31   * their {@link MessageParser#getSpecialXmlElementsBuilders()
32   * getSpecialXmlElementsHandlers} method.
33   * </p>
34   * @author Luc Maisonobe
35   * @since 11.0
36   */
37  public interface XmlTokenBuilder {
38  
39  
40      /** Create a list of parse tokens.
41       * @param startTag if true we are parsing the start tag from an XML element
42       * @param qName element qualified name
43       * @param content element content
44       * @param attributes element attributes
45       * @param lineNumber number of the line in the CCSDS data message
46       * @param fileName name of the file
47       * @return list of parse tokens
48       */
49      List<ParseToken> buildTokens(boolean startTag, String qName,
50                                   String content, Attributes attributes,
51                                   int lineNumber, String fileName);
52  
53  }