Class XmlResource

  • All Implemented Interfaces:

    public class XmlResource
    extends java.lang.Object
    implements Resource
    The class is an implementation of the generic Resource object (typically an item in a collection) representing an XML document
    • Constructor Detail

      • XmlResource

        public XmlResource​(NodeInfo doc)
        Create an XML resource using a specific node
        doc - the node in question (usually but not necessarily a document node)
      • XmlResource

        public XmlResource​(XPathContext context,
                           NodeInfo doc)
        Create an XML resource using a specific node. (Method retained for backwards compatibility).
        context - the Saxon evaluation context. This must belong to the configuration to which the node belongs.
        doc - the node in question (usually but not necessarily a document node)
    • Method Detail

      • getResourceURI

        public java.lang.String getResourceURI()
        Description copied from interface: Resource
        Get a URI that identifies this resource
        Specified by:
        getResourceURI in interface Resource
        a URI identifying this resource
      • getItem

        public Item getItem()
                     throws XPathException
        Get an item representing the resource: in this case a document node for the XML document.
        Specified by:
        getItem in interface Resource
        the document; or null if there is an error and the error is to be ignored
        XPathException - if (for example) XML parsing fails
      • getContentType

        public java.lang.String getContentType()
        Get the media type (MIME type) of the resource if known
        Specified by:
        getContentType in interface Resource
        the string "application/xml"