Class TextFileHeader

java.lang.Object
eu.bandm.tools.d2d2.base.TextFileHeader

public class TextFileHeader extends Object
Parser for the header of a d2d text input file. Sets modname==null and toplevelelementname==null => xsltMode=true Generates warnings/errors.
  • Constructor Details

  • Method Details

    • getModuleName

      @Opt public @Opt String getModuleName()
      The recognized top-most module name. Null only for xslt code for unstructured target.
    • getToplevelElementName

      @Opt public @Opt String getToplevelElementName()
      The recognized top-most element name. Null only for xslt code for unstructured target.
    • getXsltMode

      public boolean getXsltMode()
      Whether xslt mode has been specified.
    • getFromTdom

      public boolean getFromTdom()
      Whether a tdom has been sepecified as source.
    • getXsltInputNamespaces

      public Map<String,String> getXsltInputNamespaces()
      All explicitly specified namespaces on the xslt input side.
    • logStart

      protected void logStart(String text, Object... args)
      Evident.
    • logEnd

      protected void logEnd(String text, Object... args)
      Evident.
    • warning

      protected void warning(Location<String> loc, String text, Object... args)
      Evident.
    • error

      protected void error(Location<String> loc, String text, Object... args)
    • errorX

      protected void errorX(Location<String> loc, String missing)
    • warnOrError_incompleteHeader

      protected void warnOrError_incompleteHeader(Location<String> loc, String missing)
      Emits an error or a warning, depending on sloppyHeaderSyntax. If error, an IllegalArgumentException it thrown.
    • parse

      protected boolean parse(MemScanner<String> scanner, String toplevel_fileLocation, ModuleRegistry moduleRegistry)
      Parse the head of an input file. Accepts a (possibly empty) sequence of local module delcarations followed by the doc type declaration. Example:
         foo bar #d2d 2.0 text using mod.submod : element
         <-------- parsing stops here, rest returned to the main parser in "Text2Udom"a
         
      Or if there are local modules:
         foo bar #d2d module localmodule ......
            end // module
      
         #d2d 2.0 text using localmodule.submod : element
         <-------- parsing stops here, rest returned to the main parser in "Text2Udom"a
         
      or, in case of an xslt source text:
         foo bar #d2d 2.0 xslt text producing xhtml_1_0 : html 
         <-------- parsing stops here, rest returned to the main parser in "Text2Udom"a
         
      Returns:
      false in case of errors. All parsing results are stored internally and accessible by getter methods.