3.4 Print Named XML Code

Prints the content of the named XML code. If a file name is not provided in the ‘file’ attribute, the stderr is assumed.

<print name="..." file="..." />

<..xtpipes entries..>+
 | print
 -_-_-

<..xtpipes.dtd..>+
 <!ELEMENT print EMPTY >
 <!ATTLIST print
           name CDATA #REQUIRED
           file CDATA #IMPLIED
 >
 -_-_-

<..execute print..>
 String name = node.getAttributes()
                  .getNamedItem( "name" ).getNodeValue();
 String xml = (String) map.get(name);
 if( node.getAttributes().getNamedItem( "file" )==null ){
    if( !Xtpipes.trace ){
       logWriter.println( "[##]  = xtpipes => print: " + scriptFile );
    }
    logWriter.println( XtpipesUni.toUni(xml, "") );
 } else {
    String file = node.getAttributes()
                  .getNamedItem( "file" ).getNodeValue();
    try{
        FileWriter fw = new FileWriter( file );
        XtpipesPrintWriter out = new XtpipesPrintWriter( fw );
        out.println( xml );
        out.close();
    } catch(Exception e){
        instructionErr( node, e.toString(),15 );
 }  }
 -_-_-