Class XmlDocumentProperties

  • public abstract class XmlDocumentProperties
    extends Object
    This class is used to attach arbitrary information to an XML document. It also defines several well-known types of information that can be attached or found on a document.

    For example, suppose you wanted to associate a filename with the document containing an xml object "xobj". This could be done via the following code:

    tokenSource.documentProperties().set(XmlDocumentProperties.NAME, "MyFilename.xml");

    To fetch the filename later, given an xobj2 anywhere in the same document, you can write:

    filename = (String)tokenSource.documentProperties().get(XmlDocumentProperties.NAME);

    • Field Detail


        public static final Object SOURCE_NAME
        Used to store the original name (a String) for the source from which the XML document was loaded. This name, if present, is used to identify the document when reporting validation or comilation errors. XmlObject.Factory.parse(File) and SchemaTypeLoader.loadInstance(File) both automatically set this value to the filename.
      • ENCODING

        public static final Object ENCODING
        Document encoding
      • VERSION

        public static final Object VERSION
        Document version

        public static final Object STANDALONE
        Document standlone

        public static final Object DOCTYPE_NAME
        Doc type name

        public static final Object DOCTYPE_PUBLIC_ID
        Doc type public id

        public static final Object DOCTYPE_SYSTEM_ID
        Doc type system id

        public static final Object MESSAGE_DIGEST
        SHA message digest
    • Constructor Detail

      • XmlDocumentProperties

        public XmlDocumentProperties()
    • Method Detail

      • setVersion

        public void setVersion​(String version)
        Sets the XML version string to use in the <?xml?> declaration. (The XML specification is quite stable at "1.0".)
        version - the XML version string
      • getVersion

        public String getVersion()
        Returns the XML version string used in the <?xml?> declaration.
      • setStandalone

        public void setStandalone​(boolean standalone)
        Sets the standalone property.
        standalone - whether standalone is true or not
      • getStandalone

        public boolean getStandalone()
        Returns the standalone property
      • setDoctypeName

        public void setDoctypeName​(String doctypename)
        Sets the DOCTYPE name use in the <!DOCTYPE> declaration.
        doctypename - the doctypename
      • getDoctypeName

        public String getDoctypeName()
        Returns the DOCTYPE name used in the <!DOCTYPE> declaration.
      • setDoctypePublicId

        public void setDoctypePublicId​(String publicid)
        Sets the DOCTYPE public ID to use in the <!DOCTYPE> declaration.
        publicid - the public ID
      • getDoctypePublicId

        public String getDoctypePublicId()
        Returns the DOCTYPE public ID used in the <!DOCTYPE> declaration.
      • setDoctypeSystemId

        public void setDoctypeSystemId​(String systemid)
        Sets the DOCTYPE system ID to use in the <!DOCTYPE> declaration.
        systemid - the system ID
      • getDoctypeSystemId

        public String getDoctypeSystemId()
        Returns the DOCTYPE system ID used in the <!DOCTYPE> declaration.
      • setMessageDigest

        public void setMessageDigest​(byte[] digest)
        Sets the message digest used to summarize the document.
        digest - the bytes of the digest
        See Also:
      • put

        public abstract Object put​(Object key,
                                   Object value)
        Attaches a value to the root of the document containing the given token source.
        key - The key: there can be one value for each key.
        value - The value to attach to the document.
      • get

        public abstract Object get​(Object key)
        Returns a value previously attached to a document using set.
        key - The key: this is the key that was previously passed to set to store the value.
        The saved value, or null if none is found.
      • remove

        public abstract Object remove​(Object key)
        Removes a value previously attached to a document using set.
        key - The key: this is the key that was previously passed to set to store the value.