Class XMLParser


  • public class XMLParser
    extends java.lang.Object
    This class parses a XML string token to a DOM document.
    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    Yang Zhao
    Pt.AcceptedRating:
    Yellow (yuhong)
    Pt.ProposedRating:
    Yellow (nsmyth)
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  XMLParser.EntityResolver
      The entity resolver that tries to first load a DTD file locally, and if it is not found, looks for it on the Internet using the DTD file's system ID.
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLParser()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.w3c.dom.Document parser​(java.io.InputStream is)
      Generate the document tree for the specified input stream.
      org.w3c.dom.Document parser​(java.lang.String str)
      Generate the document tree for the specified XML string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XMLParser

        public XMLParser()
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • parser

        public org.w3c.dom.Document parser​(java.lang.String str)
                                    throws java.lang.Exception
        Generate the document tree for the specified XML string. The Document (the root of the document tree) is returned. An exception will be thrown if the parse fails.
        Parameters:
        str - The XML string to be parsed.
        Returns:
        The document for the parse tree.
        Throws:
        java.lang.Exception - If the parse fails.
      • parser

        public org.w3c.dom.Document parser​(java.io.InputStream is)
                                    throws java.lang.Exception
        Generate the document tree for the specified input stream. The Document (the root of the document tree) is returned. An exception will be thrown if the parse fails.
        Parameters:
        is - The input steam to be parsed.
        Returns:
        The document for the parse tree.
        Throws:
        java.lang.Exception - If the parse fails.