Class Schema

java.lang.Object
org.opentrafficsim.editor.Schema

public class Schema extends Object
Reads the XML Schema in XSD format for OTS. This class contains various methods that the editor can use to present relevant structure and information to the user.

Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Wouter Schakel
  • Constructor Details

    • Schema

      public Schema(Document document)
      Constructs the XML Schema information from a document.
      Parameters:
      document - Document; main document, other files may be included from within the file.
  • Method Details

    • getRoot

      public Node getRoot()
      Get the root node.
      Returns:
      Node; root node.
    • getElement

      public Node getElement(String path)
      Returns the node for the given path.
      Parameters:
      path - String; path.
      Returns:
      Node; type.
    • getType

      public Node getType(String base)
      Returns the type, as pointed to by base={base}.
      Parameters:
      base - String; type.
      Returns:
      String; type, as pointed to by base={base}.
    • keys

      public Map<String,Node> keys()
      Returns the xsd:key and the paths where they are defined.
      Returns:
      Map<String, Node>; xsd:key and the paths where they are defined.
    • keyrefs

      public Map<String,Node> keyrefs()
      Returns the xsd:keyref and the paths where they are defined.
      Returns:
      Map<String, Node>; xsd:keyref and the paths where they are defined.
    • uniques

      public Map<String,Node> uniques()
      Returns the xsd:unique and the paths where they are defined.
      Returns:
      Map<String, Node>; xsd:unique and the paths where they are defined.
    • isType

      public boolean isType(Node node, String path)
      Return whether the given node is of the type.
      Parameters:
      node - Node; node.
      path - String; path of the type in dotted xpath notation, e.g. "SignalGroup.TrafficLight".
      Returns:
      boolean; whether the given node is of the type.