Class XStreamAttributeCopier

java.lang.Object
org.codice.ddf.spatial.ogc.csw.catalog.converter.XStreamAttributeCopier

public class XStreamAttributeCopier extends Object
XStream tool to copy the contents of a HierarchicalStreamReader into another container.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.thoughtworks.xstream.io.HierarchicalStreamReader
    copyXml(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, StringWriter writer, Map<String,String> attributeMap)
    Copies the entire XML element reader is currently at into writer and returns a new reader ready to read the copied element.
    static void
    copyXmlNamespaceDeclarationsIntoContext(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
    Copies the namespace declarations on the XML element reader is currently at into context.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • copyXml

      public static com.thoughtworks.xstream.io.HierarchicalStreamReader copyXml(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, StringWriter writer, Map<String,String> attributeMap)
      Copies the entire XML element reader is currently at into writer and returns a new reader ready to read the copied element. After the call, reader will be at the end of the element that was copied.

      If attributeMap is provided, the attributes will be added to the copy.

      Parameters:
      reader - the reader currently at the XML element you want to copy
      writer - the writer that the element will be copied into
      attributeMap - the map of attribute names to values that will be added as attributes of the copy, may be null
      Returns:
      a new reader ready to read the copied element
      Throws:
      com.thoughtworks.xstream.converters.ConversionException - if a parser to use for the new reader can't be created
    • copyXmlNamespaceDeclarationsIntoContext

      public static void copyXmlNamespaceDeclarationsIntoContext(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
      Copies the namespace declarations on the XML element reader is currently at into context. The namespace declarations will be available in context at the key CswConstants.NAMESPACE_DECLARATIONS. The new namespace declarations will be added to any existing ones already in context.
      Parameters:
      reader - the reader currently at the XML element with namespace declarations you want to copy
      context - the UnmarshallingContext that the namespace declarations will be copied to