Community
Participate
Working Groups
Given the following object model: package forum21; import javax.xml.bind.annotation.XmlRootElement; import org.eclipse.persistence.oxm.annotations.XmlPath; @XmlRootElement(name="kml") public class Address { private String country; @XmlPath("Response/Placemark/AddressDetails/Country/CountryName/text()") public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } } and @javax.xml.bind.annotation.XmlSchema( namespace = "http://earth.google.com/kml/2.0", /* xmlns = { @javax.xml.bind.annotation.XmlNs(prefix = "ns", namespaceURI ="http://earth.google.com/kml/2.0"), },*/ elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package forum21; The following XML will not unmarshal: <?xml version="1.0" encoding="UTF-8" ?> <kml xmlns="http://earth.google.com/kml/2.0"> <Response> <name>98 St. Patrick St, Toronto</name> <Status> <code>200</code> <request>geocode</request> </Status> <Placemark id="p1"> <address>98 St Patrick St, Toronto, ON, Canada</address> <AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"> <Country> <CountryNameCode>CA</CountryNameCode> <CountryName>Canada</CountryName> <AdministrativeArea> <AdministrativeAreaName>ON</AdministrativeAreaName> <Locality> <LocalityName>Toronto</LocalityName> <Thoroughfare> <ThoroughfareName>98 St Patrick St</ThoroughfareName> </Thoroughfare> <PostalCode> <PostalCodeNumber>M5T</PostalCodeNumber> </PostalCode> </Locality> </AdministrativeArea> </Country> </AddressDetails> <ExtendedData> <LatLonBox north="43.6560378" south="43.6497426" east="-79.3864912" west="-79.3927864" /> </ExtendedData> <Point> <coordinates>-79.3896388,43.6528902,0</coordinates> </Point> </Placemark> </Response> </kml> but this will: <?xml version="1.0" encoding="UTF-8"?> <a:kml xmlns:a="http://earth.google.com/kml/2.0"> <a:Response> <a:Placemark> <a:AddressDetails> <a:Country> <a:CountryName>2</a:CountryName> </a:Country> </a:AddressDetails> </a:Placemark> </a:Response> </a:kml> See: http://stackoverflow.com/questions/906855/parse-google-geocode-with-xstream
Not a bug: I had the wrong mapping
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink