Search in sources :

Example 16 with QNameMap

use of com.thoughtworks.xstream.io.xml.QNameMap in project ddf by codice.

the class XstreamPathConverterTest method testGetFirstNodeValue.

@Test
public void testGetFirstNodeValue() throws XMLStreamException {
    XMLStreamReader streamReader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(GML_XML));
    HierarchicalStreamReader reader = new StaxReader(new QNameMap(), streamReader);
    XstreamPathValueTracker pathValueTracker = (XstreamPathValueTracker) xstream.unmarshal(reader, null, argumentHolder);
    assertThat(pathValueTracker.getFirstValue(POLYGON_POS_PATH), is("-180.000000 90.000000"));
}
Also used : StaxReader(com.thoughtworks.xstream.io.xml.StaxReader) XMLStreamReader(javax.xml.stream.XMLStreamReader) StringReader(java.io.StringReader) HierarchicalStreamReader(com.thoughtworks.xstream.io.HierarchicalStreamReader) QNameMap(com.thoughtworks.xstream.io.xml.QNameMap) Test(org.junit.Test)

Example 17 with QNameMap

use of com.thoughtworks.xstream.io.xml.QNameMap in project ddf by codice.

the class XstreamPathConverterTest method testNestedOfficeInfo.

@Test
public void testNestedOfficeInfo() throws XMLStreamException {
    XMLStreamReader streamReader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(TEST2_XML));
    HierarchicalStreamReader reader = new StaxReader(new QNameMap(), streamReader);
    XstreamPathValueTracker pathValueTracker = (XstreamPathValueTracker) xstream.unmarshal(reader, null, argumentHolder);
    assertThat(pathValueTracker.getAllValues(POC_PATH), hasItem(" Phone: 123-456-7890"));
}
Also used : StaxReader(com.thoughtworks.xstream.io.xml.StaxReader) XMLStreamReader(javax.xml.stream.XMLStreamReader) StringReader(java.io.StringReader) HierarchicalStreamReader(com.thoughtworks.xstream.io.HierarchicalStreamReader) QNameMap(com.thoughtworks.xstream.io.xml.QNameMap) Test(org.junit.Test)

Aggregations

QNameMap (com.thoughtworks.xstream.io.xml.QNameMap)17 StaxReader (com.thoughtworks.xstream.io.xml.StaxReader)13 XMLStreamReader (javax.xml.stream.XMLStreamReader)13 HierarchicalStreamReader (com.thoughtworks.xstream.io.HierarchicalStreamReader)12 StringReader (java.io.StringReader)10 Test (org.junit.Test)8 StaxDriver (com.thoughtworks.xstream.io.xml.StaxDriver)4 XStream (com.thoughtworks.xstream.XStream)3 Path (com.thoughtworks.xstream.io.path.Path)3 InputStream (java.io.InputStream)3 LinkedHashSet (java.util.LinkedHashSet)3 XMLStreamException (javax.xml.stream.XMLStreamException)3 XStreamException (com.thoughtworks.xstream.XStreamException)2 IOException (java.io.IOException)2 InputStreamReader (java.io.InputStreamReader)2 XMLInputFactory (javax.xml.stream.XMLInputFactory)2 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)2 Before (org.junit.Before)2 StaxWriter (com.thoughtworks.xstream.io.xml.StaxWriter)1 XStream11NameCoder (com.thoughtworks.xstream.io.xml.XStream11NameCoder)1