ini.trakem2.tree
Class DTDParser

java.lang.Object
  extended by ini.trakem2.tree.DTDParser

public class DTDParser
extends java.lang.Object

Reads either a DOCTYPE chunk from an xml file or a .dtd file directly.


Method Summary
static TemplateThing[] extractTemplate(java.lang.String path)
          Extracts the template by reading the ELEMENT and ATTLIST tags from a .dtd file or the DOCTYPE of an .xml file.
static void main(java.lang.String[] args)
           
static TemplateThing[] parseDTD(java.lang.StringBuilder data)
          Parses a chunk of text into a hierarchy of TemplateThing instances, the roots of which are in the returned array.
static TemplateThing[] parseDTDFile(java.lang.String dtd_path)
          Parses the tags of a .dtd file.
static TemplateThing[] parseXMLFile(java.lang.String xml_path)
          Parses a !DOCTYPE chunk from an .xml file, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

extractTemplate

public static TemplateThing[] extractTemplate(java.lang.String path)
                                       throws java.lang.Exception
Extracts the template by reading the ELEMENT and ATTLIST tags from a .dtd file or the DOCTYPE of an .xml file.

Throws:
java.lang.Exception

parseDTDFile

public static TemplateThing[] parseDTDFile(java.lang.String dtd_path)
                                    throws java.lang.Exception
Parses the tags of a .dtd file. Returns the TemplateThing roots.

Throws:
java.lang.Exception

parseXMLFile

public static TemplateThing[] parseXMLFile(java.lang.String xml_path)
                                    throws java.lang.Exception
Parses a !DOCTYPE chunk from an .xml file, if any. Returns the TemplateThing roots. Assumes there is only one continuous DOCTYPE clause and the root template thing, the layer_set and the display are part of the project tag.

Throws:
java.lang.Exception

parseDTD

public static TemplateThing[] parseDTD(java.lang.StringBuilder data)
                                throws java.lang.Exception
Parses a chunk of text into a hierarchy of TemplateThing instances, the roots of which are in the returned array.

Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)