loci.formats.in.LeicaMicrosystemsMetadata

## Class LMSXmlDocument

- java.lang.Object
- - loci.formats.in.LeicaMicrosystemsMetadata.LMSXmlDocument

- Direct Known Subclasses:
    LMSCollectionXmlDocument, LMSImageXmlDocument

      public abstract class LMSXmlDocument
      extends java.lang.Object

  This class loads and represents a Leica Microsystems XML document (from file or xml string)
  Author:
    Constanze Wendlandt constanze.wendlandt at leica-microsystems.com

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `LMSXmlDocument.InitFrom`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `dir`
    `protected org.w3c.dom.Document` | `doc`
    `protected java.lang.String` | `filepath`
    `protected static org.slf4j.Logger` | `LOGGER`
    `(package private) LMSCollectionXmlDocument` | `parent`
    `protected javax.xml.xpath.XPath` | `xPath`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LMSXmlDocument(java.lang.String xml)`
    `LMSXmlDocument(java.lang.String filepath, LMSCollectionXmlDocument parent)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static java.lang.String` | `fileExists(java.lang.String path)` Checks if file at path exists and corrects paths to be case sensitive
    `protected java.lang.String` | `getAttr(org.w3c.dom.Node node, java.lang.String attrName)` Returns the value of an attribute of a node, if existing
    `protected org.w3c.dom.Node` | `GetChildWithName(org.w3c.dom.Node node, java.lang.String name)`
    `org.w3c.dom.Document` | `getDoc()`
    `java.lang.String` | `getFilepath()`
    `java.util.List<java.lang.String>` | `getParentFiles()` Returns all files which directly or indirectly reference this LMS xml file.
    `private void` | `initFromFilepath(java.lang.String filepath)`
    `private void` | `initFromXmlString(java.lang.String xml)`
    `java.lang.String` | `nodeToString(org.w3c.dom.Node node)`
    `protected java.lang.String` | `parseFilePath(java.lang.String refPath)` Translates Leica XML file paths to absolute url decoded paths
    `java.lang.String` | `toString()`
    `org.w3c.dom.NodeList` | `xPath(org.w3c.dom.Node node, java.lang.String expression)` Searches a node for expressions using xPath.
    `org.w3c.dom.NodeList` | `xPath(java.lang.String expression)` Searches the XML document for expressions using xPath.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### doc

          protected org.w3c.dom.Document doc

    - #### xPath

          protected javax.xml.xpath.XPath xPath

    - #### dir

          protected java.lang.String dir

    - #### filepath

          protected java.lang.String filepath

    - #### LOGGER

          protected static final org.slf4j.Logger LOGGER

    - #### parent

          LMSCollectionXmlDocument parent

  - ### Constructor Detail

    - #### LMSXmlDocument

          public LMSXmlDocument(java.lang.String xml)

    - #### LMSXmlDocument

          public LMSXmlDocument(java.lang.String filepath,
                                LMSCollectionXmlDocument parent)

  - ### Method Detail

    - #### getDoc

          public org.w3c.dom.Document getDoc()

    - #### getFilepath

          public java.lang.String getFilepath()

    - #### initFromXmlString

          private void initFromXmlString(java.lang.String xml)

    - #### initFromFilepath

          private void initFromFilepath(java.lang.String filepath)

    - #### xPath

          public org.w3c.dom.NodeList xPath(java.lang.String expression)

      Searches the XML document for expressions using xPath.
      Parameters:
        `expression` - expression in xPath syntax
      Returns:
        list of found nodes

    - #### xPath

          public org.w3c.dom.NodeList xPath(org.w3c.dom.Node node,
                                            java.lang.String expression)

      Searches a node for expressions using xPath.
      Parameters:
        `node` - node in which to search
        `expression` - expression in xPath syntax
      Returns:
        list of found nodes

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getAttr

          protected java.lang.String getAttr(org.w3c.dom.Node node,
                                             java.lang.String attrName)

      Returns the value of an attribute of a node, if existing
      Parameters:
        `node` - node in which to search for the attribute
        `attrName` - name of the attribute
      Returns:

    - #### parseFilePath

          protected java.lang.String parseFilePath(java.lang.String refPath)

      Translates Leica XML file paths to absolute url decoded paths
      Parameters:
        `refPath` - path string found in Leica XML reference
      Returns:
        absolute, url decoded path

    - #### nodeToString

          public java.lang.String nodeToString(org.w3c.dom.Node node)

    - #### GetChildWithName

          protected org.w3c.dom.Node GetChildWithName(org.w3c.dom.Node node,
                                                      java.lang.String name)

    - #### getParentFiles

          public java.util.List<java.lang.String> getParentFiles()

      Returns all files which directly or indirectly reference this LMS xml file.
      Returns:
        list of LMS xml documents (xlef and optionally xlcfs)

    - #### fileExists

          protected static java.lang.String fileExists(java.lang.String path)

      Checks if file at path exists and corrects paths to be case sensitive
      Parameters:
        `path` - whole file path

Copyright © 2026 Open Microscopy Environment