List of usage examples for org.dom4j Document getEntityResolver
EntityResolver getEntityResolver();
From source file:org.opencms.xml.CmsXmlContentDefinition.java
License:Open Source License
/** * Factory method to unmarshal (read) a XML content definition instance from a XML document.<p> * //from w w w .j a va2 s . c om * This method does additional validation to ensure the document has the required * XML structure for a OpenCms content definition schema.<p> * * @param document the XML document to generate a XML content definition from * @param schemaLocation the location from which the XML schema was read (system id) * * @return a XML content definition instance unmarshalled from the XML document * * @throws CmsXmlException if something goes wrong */ public static CmsXmlContentDefinition unmarshal(Document document, String schemaLocation) throws CmsXmlException { schemaLocation = translateSchema(schemaLocation); EntityResolver resolver = document.getEntityResolver(); CmsXmlContentDefinition result = getCachedContentDefinition(schemaLocation, resolver); if (result == null) { // content definition was not found in the cache, unmarshal the XML document result = unmarshalInternal(document, schemaLocation, resolver); } return result; }