protected void loadSchema(Document document, String schemaInstanceURI) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } }
protected void loadSchema(Document document, String schemaInstanceURI, Namespace namespace) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument, namespace); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } } }
String inclSchemaInstanceURI = includeElement .attributeValue("schemaLocation"); EntityResolver resolver = schemaDocument.getEntityResolver();
public EntityResolver getEntityResolver() { return getWrapped().getEntityResolver(); }
/** * Factory method to unmarshal (read) a XML content definition instance from a XML document.<p> * * 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 { 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; }
protected void loadSchema(Document document, String schemaInstanceURI) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } }
protected void loadSchema(Document document, String schemaInstanceURI) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } }
protected void loadSchema(Document document, String schemaInstanceURI) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } }
protected void loadSchema(Document document, String schemaInstanceURI, Namespace namespace) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument, namespace); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } } }
protected void loadSchema(Document document, String schemaInstanceURI, Namespace namespace) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument, namespace); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } } }
protected void loadSchema(Document document, String schemaInstanceURI, Namespace namespace) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument, namespace); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } } }
protected void loadSchema(Document document, String schemaInstanceURI) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } }
protected void loadSchema(Document document, String schemaInstanceURI) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } }
protected void loadSchema(Document document, String schemaInstanceURI) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } }
protected void loadSchema(Document document, String schemaInstanceURI, Namespace namespace) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument, namespace); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } } }
protected void loadSchema(Document document, String schemaInstanceURI, Namespace namespace) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument, namespace); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } } }
protected void loadSchema(Document document, String schemaInstanceURI, Namespace namespace) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument, namespace); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } } }
protected void loadSchema(Document document, String schemaInstanceURI) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } }
protected void loadSchema(Document document, String schemaInstanceURI) { try { EntityResolver resolver = document.getEntityResolver(); if (resolver == null) { String msg = "No EntityResolver available for resolving URI: "; throw new InvalidSchemaException(msg + schemaInstanceURI); } InputSource inputSource = resolver.resolveEntity(null, schemaInstanceURI); if (resolver == null) { throw new InvalidSchemaException("Could not resolve the URI: " + schemaInstanceURI); } Document schemaDocument = xmlSchemaReader.read(inputSource); loadSchema(schemaDocument); } catch (Exception e) { System.out.println("Failed to load schema: " + schemaInstanceURI); System.out.println("Caught: " + e); e.printStackTrace(); throw new InvalidSchemaException("Failed to load schema: " + schemaInstanceURI); } }
/** * Factory method to unmarshal (read) a XML content definition instance from a XML document.<p> * * 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; }