1   /* Copyright 2002-2025 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  import java.util.Map;
21  
22  /** Builder for building {@link ParseToken} from XML elements.
23   * <p>
24   * The regular handling of regular XML elements is to used the element
25   * name as the token name, the element content as the token content and
26   * the "units" attribute for the units. In some cases however the token
27   * name should be extracted from attributes, and sometimes even the
28   * content. This interface allows to define all these behaviors, by
29   * providing specialized builders to the lexical analyzer when it calls
30   * their {@link MessageParser#getSpecialXmlElementsBuilders()
31   * getSpecialXmlElementsHandlers} method.
32   * </p>
33   * @author Luc Maisonobe
34   * @since 11.0
35   */
36  public interface XmlTokenBuilder {
37  
38  
39      /** Create a list of parse tokens.
40       * @param startTag if true we are parsing the start tag from an XML element
41       * @param isLeaf if true and startTag is false, we are processing the end tag of a leaf 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       * @since 12.0
49       */
50      List<ParseToken> buildTokens(boolean startTag, boolean isLeaf, String qName,
51                                   String content, Map<String, String> attributes,
52                                   int lineNumber, String fileName);
53  
54  }