diff --git a/core/src/main/java/org/jclouds/http/functions/ParseXMLWithJAXB.java b/core/src/main/java/org/jclouds/http/functions/ParseXMLWithJAXB.java index 8320931f8c..6e9dbf9478 100644 --- a/core/src/main/java/org/jclouds/http/functions/ParseXMLWithJAXB.java +++ b/core/src/main/java/org/jclouds/http/functions/ParseXMLWithJAXB.java @@ -23,10 +23,12 @@ import static org.jclouds.http.HttpUtils.releasePayload; import java.io.IOException; import java.io.InputStream; +import java.lang.reflect.Type; import javax.annotation.Resource; import javax.inject.Inject; import javax.inject.Singleton; +import javax.xml.bind.JAXBContext; import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponseException; @@ -40,6 +42,12 @@ import com.google.inject.TypeLiteral; /** * This object will parse the body of an HttpResponse and return the result of type back to the * caller. + *

+ * {@link JAXBContext} works with {@link Class} objects instead of {@link Type}. This could be a + * limitation if we are trying to parse typed collections of objects. However, when using JAXB we + * expect to have well formed XML documents with one single root element, so the objects to parse + * should not be collections but objects that wrap collections of elements, and that should work + * fine. * * @author Ignasi Barrera */ diff --git a/core/src/main/java/org/jclouds/xml/internal/JAXBParser.java b/core/src/main/java/org/jclouds/xml/internal/JAXBParser.java index f3851acbb4..d7facb8269 100644 --- a/core/src/main/java/org/jclouds/xml/internal/JAXBParser.java +++ b/core/src/main/java/org/jclouds/xml/internal/JAXBParser.java @@ -29,12 +29,14 @@ import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; +import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.xml.XMLParser; /** * Parses XML documents using JAXB. * * @author Ignasi Barrera + * @see ParseXMLWithJAXB */ @Singleton public class JAXBParser implements XMLParser