Class Def2Dtd


public class Def2Dtd extends SinglePhase
Implements the translation of a d2d definition module (imported from .ddf/.umod/.dtd/ad lib) into a Dtd object. After construction of an instance (always anew, no re-usage) the main method convert(eu.bandm.tools.message.MessageReceiver<eu.bandm.tools.message.SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>>,eu.bandm.tools.d2d2.model.Module,eu.bandm.tools.util.xml.XMLDocumentIdentifier,boolean,@eu.bandm.tools.annotations.Opt java.lang.String) is called.

FIXME D2d insertions could be mapped to dtd "parsed entity" definitions and references.
  • Field Details

  • Constructor Details

    • Def2Dtd

      public Def2Dtd()
  • Method Details

    • convert

      public DTD.Dtd convert(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, Module module, XMLDocumentIdentifier newId, boolean tdom_mode, @Opt @Opt String tdom_doc_language)
      Central working method for transformation to dtd.
      Parameters:
      msg - target for warning messages (CURRENTLY no errors).
      module - what to translate
      newId - what is entered into the Dtd object as its ID.
      tdom_mode - whether tdom processing instructions (w.r.t public and private) shall be generated
      tdom_doc_language - the language code to filter the documentation entries. Must be the complete code, like "tdom" or "user_en".
    • convertNeeded

      protected void convertNeeded()
    • normalize

      protected NamespaceName normalize(NamespaceName nn, boolean isAttribute)
    • getDocu

      @Opt protected @Opt String getDocu(SourceItem item)
    • markNeeded

      protected void markNeeded(Definition def)
    • translate

      protected void translate(Definition def)
      Treat tags regexp and chars regexp differently. The following call to "match()" sets the global register variables of the visitor and allows different reactions:
         tags (a?, (b|c)*, #chars)  ---> haspcdata true
                                      ---> iscomplex true --> (#PCDATA|a|b|c)*
                                                               + warning 
         tags ( a | b |c | #chars)*  ---> haspcdata true
                                     ---> iscomplex false --> (#PCDATA|a|b)*
       
         tags ( a?, (b|c)*, x)       ---> haspcdata false
                                                          --> (a?, (b|c)*, x)
      
         chars ( a?, (b|"XX"), "))")           ---> a?, b? //ignore all char data
         chars ( [a b*,c],"XX",d,"XX")?        ---> (a, d)?  //ignore all char data
       
         chars ('a'~ 'b'~ 'c')       ---> null            --> #PCDATA
        
    • addAtt

      void addAtt(DTD.Attlist attlist, String qname, boolean isOptional)
      allows multiple occurences of d2d refs to one ddf-element, like in {xslt}template = ((name, match?)|(match,name?)), etc !!! Optional wins!
    • action

      public void action(Empty x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(Subst x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(Reference x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(Insertion x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(ParseParticle x)
      ParseParticles are currently kept as local defs in local scope (THIS SHOULD CHANGE / FIXME) never mixed content / either structured or chars-only.


      (( when GLOBAL, this does nolonger hold!
             a = [p "ABC"]
             b = [p [q "ABC"]]
           ==> 
             p = #chars | q
        
      CURRENTLY xml kind cannot be specified / is == element
      CURRENTLY xml tag cannot be specified / is == the d2d tag
      Overrides:
      action in class SinglePhase
    • charsFound

      protected void charsFound()
    • action

      public void action(StringConst x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(CharExpr x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(Pcdata x)
      Overrides:
      action in class SinglePhase
    • translatesubs

      protected CheckedList<DTD.CP> translatesubs(Collection<Expression> subs)
    • makeSeq

      protected void makeSeq(CheckedList<Expression> on)
    • action

      public void action(Perm x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(Seq x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(Alt x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(Opt x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(Star x)
      Overrides:
      action in class SinglePhase
    • action

      public void action(Plus x)
      Overrides:
      action in class SinglePhase