java.lang.Object
com.idmedia.translationstudio.impl.util.XmlUtil

public class XmlUtil extends Object
Util Class
Author:
I-D Media AG
  • Method Details

    • isElementNode

      public static boolean isElementNode(@Nullable @Nullable Node pNode)
    • findFirstNodeTypes

      @Nullable public static @Nullable Element findFirstNodeTypes(@Nullable @Nullable Node pElement, @NotNull @NotNull String sNodeType)
      Find the very first (and only) LANG node
      Parameters:
      pElement - Root node
      sNodeType - TAG name to search
      Returns:
    • findFirstNodesByType

      @NotNull public static @NotNull List<Element> findFirstNodesByType(Node pElement, @NotNull @NotNull String sNodeType)
      Find the very first (and only) LANG node
      Parameters:
      pElement - Root node
      sNodeType - TAG name to search
      Returns:
    • findFirstNodesByType

      @Nullable public static void findFirstNodesByType(Node pElement, @NotNull @NotNull String sNodeType, @NotNull @NotNull List<Element> vpList)
      Find the very first (and only) LANG node
      Parameters:
      pElement - Root node
      sNodeType - TAG name to search
      vpList -
    • findFirstChildNode

      @Nullable public static @Nullable Element findFirstChildNode(@Nullable @Nullable Node pElement)
      Find the very first element child node
      Parameters:
      pElement - Root node
      Returns:
    • getFirstChildElement

      @Nullable public static @Nullable Element getFirstChildElement(Element pElement)
      Find the very first (and only) LANG node
      Parameters:
      pElement -
      Returns:
    • findFirstCDataChildNode

      @Nullable public static @Nullable CDATASection findFirstCDataChildNode(@Nullable @Nullable Node pElement)
      Find the very first element child node
      Parameters:
      pElement - Root node
      Returns:
    • findLanguageNode

      @Nullable public static @Nullable Element findLanguageNode(Element pElement)
      Find the very first (and only) LANG node
      Parameters:
      pElement -
      Returns:
    • removeChildNodes

      public static void removeChildNodes(Node node)
      remove all children of a given node
      Parameters:
      node - Node to be cleared
    • extractNodeContentList

      public static List<String> extractNodeContentList(String sXml, String sListableNodeName)
    • extractNodeContent

      @NotNull public static @NotNull String extractNodeContent(String sXml, String sTag, int nOffset)
    • extractNodeContent

      @NotNull public static @NotNull String extractNodeContent(String sXml, String sTag)
    • addTag

      public static void addTag(@NotNull @NotNull StringBuilder psXml, @NotNull @NotNull String sNodeName, @Nullable @Nullable String sValue)
      Add an XML Node
      Parameters:
      psXml - Target XML
      sNodeName - Node Name
      sValue - Value
    • addTag

      public static void addTag(@NotNull @NotNull StringBuilder psXml, @NotNull @NotNull String sNodeName, @Nullable @Nullable Date plValue)
      Add an XML Node
      Parameters:
      psXml - Target XML
      sNodeName - Node Name
      plValue - Value
    • addTag

      public static void addTag(@NotNull @NotNull StringBuilder psXml, @NotNull @NotNull String sNodeName, @Nullable @Nullable Long plValue)
      Add an XML Node
      Parameters:
      psXml - Target XML
      sNodeName - Node Name
      plValue - Value
    • addTagList

      public static void addTagList(@NotNull @NotNull StringBuilder psXml, @NotNull @NotNull String sNodeWrapper, @NotNull @NotNull String sNodeEntry, @Nullable @Nullable Collection<String> vsListable, boolean bEncodeContent)
      Add an XML List
      Parameters:
      psXml - Target XML
      sNodeWrapper - Wrapper Node Name
      sNodeEntry - List Entry Node Name
      vsListable - Listable
      bEncodeContent - Encode listable entry
    • addTagList

      public static void addTagList(@NotNull @NotNull StringBuilder psXml, @NotNull @NotNull String sNodeWrapper, @NotNull @NotNull String sNodeEntry, @Nullable @Nullable Collection<String> vsListable)
      Add an XML List
      Parameters:
      psXml - Target XML
      sNodeWrapper - Wrapper Node Name
      sNodeEntry - List Entry Node Name
      vsListable - Listable
    • convert2Long

      public static long convert2Long(String sVal)
    • extractNodeContentWithAttributeSpace

      @Nullable public static @Nullable String extractNodeContentWithAttributeSpace(@NotNull @NotNull String sXml, @NotNull @NotNull String sTag)
      Extract the given node and expect at least one attribute in it
      Parameters:
      sXml -
      sTag -
      Returns: