The intermediary document : Links (understanding warnings)

When using links, you may come across only one warning :

    BoxLink not added: Box whose id is 'some_id' doesn't exist.
  

It simply means that you tried to link 2 boxes with a link, but, either the parent box's id or the child box id cannot be found. Nonetheless, the SVG graphic is generated, but it is incorrect since a link is missing.

1. Producing warning

Save the code below under editor/XML/Examples/linksWarning.grp :

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE grp SYSTEM "../grp.dtd">
    <grp>
      <hbox>
        <tbox background="text" fontSize="20">node a</tbox>

        <spring minSize="40"/>

        <tbox id="tbox2" background="text" fontSize="20">node b</tbox>
      </hbox>

      <boxLink parentBox="tbox1" parentAnchor="middleRight"
               childBox="tbox2" childAnchor="middleLeft"/>
    </grp>
  

In a console, change to directory editor/XML/Examples (if not already done), and then type :

    java -cp ../../lib/taxi.jar fr.loria.taxi.transformer.TransformerGRPToSVG -grp_in linksWarning.grp -defs examples.def -svg_dtd ../svg.dtd
  

You should see the following output :

    Parsing file examples.def
    Parsing file linksWarning.grp
    BoxLink not added: Box whose id is 'tbox1' doesn't exist.
    Creating SVG document
    Generating SVG file linksWarning.svg
  

And this graphic :

2. Explaining cause

No box has the value tbox1 as identifier.

3. Solving the problem

Not to get this warning again :

Modify editor/XML/Examples/linksWarning.grp (changes are indicated in bold) :

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE grp SYSTEM "../grp.dtd">
    <grp>
      <hbox>
        <tbox id="tbox1" background="text" fontSize="20">node a</tbox>

        <spring minSize="40"/>

        <tbox id="tbox2" background="text" fontSize="20">node b</tbox>
      </hbox>

      <boxLink parentBox="tbox1" parentAnchor="middleRight"
               childBox="tbox2" childAnchor="middleLeft"/>
    </grp>
  

Transform :

    java -cp ../../lib/taxi.jar fr.loria.taxi.transformer.TransformerGRPToSVG -grp_in linksWarning.grp -defs examples.def -svg_dtd ../svg.dtd
  

You should get a clear output (no warning) :

    Parsing file examples.def
    Parsing file linksWarning.grp
    Creating SVG document
    Generating SVG file linksWarning.svg
  

And a correct graphic :