public class XmlMetadataParser<T extends GenericXmlMetadata> extends Object
| Modifier and Type | Class and Description | 
|---|---|
protected class  | 
XmlMetadataParser.MetadataHandler
Actual document handler implementation 
 | 
protected class  | 
XmlMetadataParser.SimpleMetadataHandler  | 
| Modifier and Type | Field and Description | 
|---|---|
protected Class | 
fileClass  | 
protected String | 
schemaBasePath  | 
protected String[] | 
schemaLocations  | 
| Constructor and Description | 
|---|
XmlMetadataParser(Class metadataClass)
Constructs an instance of  
XmlMetadataParser for the given metadata class. | 
| Modifier and Type | Method and Description | 
|---|---|
protected ProductData | 
inferType(String elementName,
         String value)
Tries to infer the type of the element, based on the available XSD schema definition. 
 | 
T | 
parse(InputStream inputStream)
Tries to parse the given  
InputStream (which may be a string or a stream over a file). | 
MetadataElement | 
parse(Path file,
     Set<String> excludes)  | 
protected void | 
setSchemaBasePath(String schemaBasePath)
Sets the location of the schema base path that should be used for XSD
 schema validation. 
 | 
protected void | 
setSchemaLocations(String[] schemaLocations)
Sets the location(s) of the XSD schema(s) that should be used for XSD
 schema validation. 
 | 
protected boolean | 
shouldValidateSchema()
Indicates if the XSD validation should be performed. 
 | 
protected Class fileClass
protected String[] schemaLocations
protected String schemaBasePath
public XmlMetadataParser(Class metadataClass)
XmlMetadataParser for the given metadata class.metadataClass - The class of metadata (it should be derived from XmlMetadata).protected ProductData inferType(String elementName, String value)
ProductData.ASCII.elementName - The name of the XML element.value - The value of the XML element.ProductData wrapping the element value.public T parse(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException
InputStream (which may be a string or a stream over a file).inputStream - The input streamXmlMetadata.ParserConfigurationException - Exception is thrown by the underlying SAX mechanism.SAXException - Exception is thrown if the XML is not well formed.IOException - Exception is thrown if there is a problem reading the input stream.public MetadataElement parse(Path file, Set<String> excludes) throws ParserConfigurationException, SAXException, IOException
protected boolean shouldValidateSchema()
false.
          In a derived class, true would mean that the XML
          schema validation should be performed.protected void setSchemaBasePath(String schemaBasePath)
schemaBasePath - The schema base path.protected void setSchemaLocations(String[] schemaLocations)
schemaLocations - An array of schema locations.Copyright © 2014–2022 European Space Agency (ESA). All rights reserved.