edu.ucsb.nceas.metacat.service

## Class XMLSchemaParser

- java.lang.Object
- - org.xml.sax.helpers.DefaultHandler
  - - edu.ucsb.nceas.metacat.service.XMLSchemaParser

- All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

      public class XMLSchemaParser
      extends org.xml.sax.helpers.DefaultHandler

  A class will parse an schema file to get information - such as included xsd files in this schema
  Author:
    tao

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLSchemaParser(java.io.InputStream schemaIn)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Vector<java.lang.String>` | `getIncludedSchemaFilePathes()` Get the included schema file paths in this schema
    `void` | `parse()` Parse the schema file
    `void` | `startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)` SAX Handler that is called at the start of each XML element

    - ### Methods inherited from class org.xml.sax.helpers.DefaultHandler

      `characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XMLSchemaParser

          public XMLSchemaParser(java.io.InputStream schemaIn)
                          throws org.xml.sax.SAXException,
                                 edu.ucsb.nceas.utilities.PropertyNotFoundException

      Constructor
      Parameters:
        `schemaIn` - the schema content as an InputStream object
      Throws:
        `org.xml.sax.SAXException`
        `edu.ucsb.nceas.utilities.PropertyNotFoundException`

  - ### Method Detail

    - #### parse

          public void parse()
                     throws org.xml.sax.SAXException,
                            java.io.IOException

      Parse the schema file
      Throws:
        `org.xml.sax.SAXException` - if some sax related exception happens
        `java.io.IOException` - if the schema content couldn't be found

    - #### getIncludedSchemaFilePathes

          public java.util.Vector<java.lang.String> getIncludedSchemaFilePathes()

      Get the included schema file paths in this schema
      Returns:
        the included schema file paths

    - #### startElement

          public void startElement(java.lang.String uri,
                                   java.lang.String localName,
                                   java.lang.String qName,
                                   org.xml.sax.Attributes atts)
                            throws org.xml.sax.SAXException

      SAX Handler that is called at the start of each XML element
      Specified by:
        `startElement` in interface `org.xml.sax.ContentHandler`
      Overrides:
        `startElement` in class `org.xml.sax.helpers.DefaultHandler`
      Throws:
        `org.xml.sax.SAXException`

Copyright © 2020 Regents of the University of California. All Rights Reserved.