Class XmlParserHelper
- java.lang.Object
-
- org.hibernate.validator.internal.xml.XmlParserHelper
-
public class XmlParserHelper extends Object
Provides common functionality used within the different XML descriptor parsers.- Author:
- Gunnar Morling
-
-
Constructor Summary
Constructors Constructor Description XmlParserHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XMLEventReadercreateXmlEventReader(String resourceName, InputStream xmlStream)SchemagetSchema(String schemaResource)Returns the XML schema identified by the given resource name.StringgetSchemaVersion(String resourceName, XMLEventReader xmlEventReader)Retrieves the schema version applying for the given XML input stream as represented by the "version" attribute of the root element of the stream.
-
-
-
Method Detail
-
getSchemaVersion
public String getSchemaVersion(String resourceName, XMLEventReader xmlEventReader)
Retrieves the schema version applying for the given XML input stream as represented by the "version" attribute of the root element of the stream.The given reader will be advanced to the root element of the given XML structure. It can be used for unmarshalling from there.
- Parameters:
resourceName- The name of the represented XML resource.xmlEventReader- An STAX event reader- Returns:
- The value of the "version" attribute. For compatibility with BV 1.0, "1.0" will be returned if the given stream doesn't have a "version" attribute.
-
createXmlEventReader
public XMLEventReader createXmlEventReader(String resourceName, InputStream xmlStream)
-
getSchema
public Schema getSchema(String schemaResource)
Returns the XML schema identified by the given resource name.- Parameters:
schemaResource- the resource name identifying the schema.- Returns:
- the schema identified by the given resource name or
nullif the resource was not found or could not be loaded.
-
-