@Override public Reference getIdentifier() { return getWrappedRepresentation().getIdentifier(); }
/** * Returns a SAX source. * * @param xmlRepresentation * The XML representation to wrap. * @return A SAX source. * @throws IOException */ public static SAXSource getSaxSource(Representation xmlRepresentation) throws IOException { SAXSource result = null; if (xmlRepresentation != null) { result = new SAXSource(new InputSource(xmlRepresentation .getStream())); if (xmlRepresentation.getIdentifier() != null) { result.setSystemId(xmlRepresentation.getIdentifier() .getTargetRef().toString()); } } return result; }
/** * Constructor. * * @param xmlRepresentation * A source XML representation to parse. * @throws IOException */ public SaxRepresentation(Representation xmlRepresentation) { super(xmlRepresentation.getMediaType()); try { if (xmlRepresentation instanceof XmlRepresentation) { this.source = ((XmlRepresentation) xmlRepresentation) .getSaxSource(); } else { this.source = new SAXSource(new InputSource(xmlRepresentation .getStream())); } if (xmlRepresentation.getIdentifier() != null) { this.source.setSystemId(xmlRepresentation.getIdentifier() .getTargetRef().toString()); } } catch (IOException ioe) { ioe.printStackTrace(); } }
getTransformSheet().getStream()); if (getTransformSheet().getIdentifier() != null) { transformSource.setSystemId(getTransformSheet() .getIdentifier().getTargetRef().toString());
if (getSourceRepresentation().getIdentifier() != null) { result.setSystemId(getSourceRepresentation().getIdentifier() .getTargetRef().toString());
/** * Returns a FreeMarker template from a representation and a configuration. * * @param templateRepresentation * The template representation. * @param config * The FreeMarker configuration. * @return The template or null if not found. */ private static Template getTemplate(Representation templateRepresentation, Configuration config) { try { // Instantiate the template with the character set of the template // representation if it has been set, otherwise use UTF-8. if (templateRepresentation.getCharacterSet() != null) { return new Template("template", templateRepresentation .getReader(), config, templateRepresentation .getCharacterSet().getName()); } else { return new Template("template", templateRepresentation .getReader(), config, CharacterSet.UTF_8.getName()); } } catch (IOException e) { Context.getCurrentLogger().warning( "Unable to get the template from the representation " + templateRepresentation.getIdentifier() + ". Error message: " + e.getMessage()); return null; } }