Class ResourceBuilder
java.lang.Object
de.wwu.scdh.annotation.selection.resource.ResourceBuilder
A
ResourceBuilder makes Resource from a URI.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumThere are some resource parsers available, that this class offers building resources with. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionResourceBuilder(net.sf.saxon.s9api.Processor processor) Makes a newResourceBuilderinstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic net.sf.saxon.s9api.XsltPackagecompileTracingPackage(net.sf.saxon.s9api.XsltCompiler compiler, ResourceBuilder.OutputMethod method) This compiles the XSLT tracing library for the given output method.static MappedDOMResourcemapWithXslTransformation(URI imageUri, DOMResource preimage, net.sf.saxon.s9api.Xslt30Transformer transformer, Class<? extends Point> imagePointClass) Derives aMappedDOMResourcefrom a preimage and an XSLT stylesheet.static MappedDOMResourcemapWithXsltTracePackage(DOMResource preimage, URI stylesheet, InputStream traceStream, String traceSystemId, Class<? extends Point> imagePointClass) Derives aMappedDOMResourcefrom a preimage and an XSLT stylesheet.static MappedDOMResourcemapWithXsltTracePackage(DOMResource preimage, URI stylesheet, Class<? extends Point> imagePointClass) Makes aMappedDOMResourcefrom a preimage and an XSLT stylesheet.static MappedDOMResourcemapWithXsltTracePackage(DOMResource preimage, URI stylesheet, URI tracePkg, Class<? extends Point> imagePointClass) Makes aMappedDOMResourcefrom a preimage and an XSLT stylesheet.Resource<?> parseResource(URI resource, ResourceBuilder.Parser parser) Parses the contents of a given URI with a givenResourceBuilder.Parser.Resource<?> parseResource(URI resource, InputStream inputStream, String systemId, ResourceBuilder.Parser parser) Parses the contents of a given URI with a givenResourceBuilder.Parser.pointerClassFromOutputMethod(String method) Returns the point class for the output method, i.e.pointerClassFromOutputMethod(net.sf.saxon.s9api.Xslt30Transformer transformer) Gets the default output method from the stylesheet and returns the point class for it.static net.sf.saxon.s9api.ProcessorprocessorFromModifiedConfig(Source config) Returns aProcessormade with the Saxon config given in as the second argument after modifying it following the internal requirements for the tracing package.
-
Field Details
-
MODIFY_CONFIG_XSL
- See Also:
-
LIBTRACE_XML
- See Also:
-
LIBTRACE_PARAM
- See Also:
-
TRACE_PKG_NAME
- See Also:
-
TRACE_PKG_PARAM
- See Also:
-
-
Constructor Details
-
ResourceBuilder
public ResourceBuilder(net.sf.saxon.s9api.Processor processor) Makes a newResourceBuilderinstance.
-
-
Method Details
-
parseResource
public Resource<?> parseResource(URI resource, ResourceBuilder.Parser parser) throws ResourceException Parses the contents of a given URI with a givenResourceBuilder.Parser.- Throws:
ResourceException
-
parseResource
public Resource<?> parseResource(URI resource, InputStream inputStream, String systemId, ResourceBuilder.Parser parser) throws ResourceException Parses the contents of a given URI with a givenResourceBuilder.Parser.- Throws:
ResourceException
-
mapWithXslTransformation
public static MappedDOMResource mapWithXslTransformation(URI imageUri, DOMResource preimage, net.sf.saxon.s9api.Xslt30Transformer transformer, Class<? extends Point> imagePointClass) throws ResourceException Derives aMappedDOMResourcefrom a preimage and an XSLT stylesheet.Note: When a saxon config file with XSLT packages is used (by reading it when constructing the
Processor), only compiling the right XSLT tracing package is not enough. Transforming the config file and changing theresourceLocationis required.processorFromModifiedConfig(Source)has a solution.- Parameters:
imageUri- - theURIof the imagepreimage- - the resource deriving fromtransformer- - anXslt30Transformerto derive the image withimagePointClass- - the class of the point used for the image, ornullfor concluding from the stylesheet's default output method- Throws:
ResourceException
-
mapWithXsltTracePackage
public static MappedDOMResource mapWithXsltTracePackage(DOMResource preimage, URI stylesheet, InputStream traceStream, String traceSystemId, Class<? extends Point> imagePointClass) throws ResourceException Derives aMappedDOMResourcefrom a preimage and an XSLT stylesheet.Note: When a saxon config file with XSLT packages is used (by reading it when constructing the
Processor), only compiling the right XSLT tracing package is not enough. Transforming the config file and changing theresourceLocationis required.processorFromModifiedConfig(Source)has a solution.- Parameters:
preimage- - the resource deriving fromstylesheet- -URIof the XSLT stylesheet used for derivingtraceStream- - an input stream made of the the XSLT package for adding the mapping informationtraceSystemId- - the path of the XSLT package for adding the mapping informationimagePointClass- - the class of the point used for the image, ornullfor concluding from the stylesheet's default output method- Throws:
ResourceException
-
mapWithXsltTracePackage
public static MappedDOMResource mapWithXsltTracePackage(DOMResource preimage, URI stylesheet, URI tracePkg, Class<? extends Point> imagePointClass) throws ResourceException Makes aMappedDOMResourcefrom a preimage and an XSLT stylesheet.- Parameters:
preimage- - the resource deriving fromstylesheet- -URIof the XSLT stylesheet used for derivingtracePkg- -URIof the the XSLT package for adding the mapping informationimagePointClass- - the class of the point used for the image, ornullfor concluding from the stylesheet's default output method- Throws:
ResourceException
-
mapWithXsltTracePackage
public static MappedDOMResource mapWithXsltTracePackage(DOMResource preimage, URI stylesheet, Class<? extends Point> imagePointClass) throws ResourceException Makes aMappedDOMResourcefrom a preimage and an XSLT stylesheet. This method uses the internal XSLT package for adding mapping information.- Parameters:
preimage- - the resource deriving fromstylesheet- -URIof the XSLT stylesheet used for derivingimagePointClass- - the class of the point used for the image, ornullfor concluding from the stylesheet's default output method- Throws:
ResourceException
-
pointerClassFromOutputMethod
public static Class<? extends Point> pointerClassFromOutputMethod(String method) throws ResourceException Returns the point class for the output method, i.e. the serialization method. In XSLT, the output method is set byxsl:output/@method.- Throws:
ResourceException
-
pointerClassFromOutputMethod
public static Class<? extends Point> pointerClassFromOutputMethod(net.sf.saxon.s9api.Xslt30Transformer transformer) throws ResourceException Gets the default output method from the stylesheet and returns the point class for it. The output method is set byxsl:output/@methodor isxmlif this declaration is missing.- Throws:
ResourceException
-
processorFromModifiedConfig
public static net.sf.saxon.s9api.Processor processorFromModifiedConfig(Source config) throws ResourceException Returns aProcessormade with the Saxon config given in as the second argument after modifying it following the internal requirements for the tracing package.- Parameters:
config- - a saxon config file asSource- Throws:
ResourceException
-
compileTracingPackage
public static net.sf.saxon.s9api.XsltPackage compileTracingPackage(net.sf.saxon.s9api.XsltCompiler compiler, ResourceBuilder.OutputMethod method) throws net.sf.saxon.s9api.SaxonApiException, ResourceException This compiles the XSLT tracing library for the given output method.- Parameters:
compiler- - anXsltCompilerfor compiling the tracing librarymethod- - the output methodxsl:output/@methodof the stylesheet- Returns:
- the compiled package
- Throws:
net.sf.saxon.s9api.SaxonApiException- when a compilation error occurredResourceException- e.g. when the requested output method is not supported
-