Class XStreamAttributeCopier
java.lang.Object
org.codice.ddf.spatial.ogc.csw.catalog.converter.XStreamAttributeCopier
XStream tool to copy the contents of a HierarchicalStreamReader into another container.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.thoughtworks.xstream.io.HierarchicalStreamReadercopyXml(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, StringWriter writer, Map<String, String> attributeMap) Copies the entire XML elementreaderis currently at intowriterand returns a new reader ready to read the copied element.static voidcopyXmlNamespaceDeclarationsIntoContext(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context) Copies the namespace declarations on the XML elementreaderis currently at intocontext.
-
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 elementreaderis currently at intowriterand returns a new reader ready to read the copied element. After the call,readerwill be at the end of the element that was copied.If
attributeMapis provided, the attributes will be added to the copy.- Parameters:
reader- the reader currently at the XML element you want to copywriter- the writer that the element will be copied intoattributeMap- 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 elementreaderis currently at intocontext. The namespace declarations will be available incontextat the keyCswConstants.NAMESPACE_DECLARATIONS. The new namespace declarations will be added to any existing ones already incontext.- Parameters:
reader- the reader currently at the XML element with namespace declarations you want to copycontext- theUnmarshallingContextthat the namespace declarations will be copied to
-