2011-01-20 4 views
0

doc의 키를 사용하여 특정 문서를 가져 오려고합니다. 여기의 지침에 따라 해요 :Feed를받을 때 Java GData Spreadsheets API가 실패합니다.

Exception in thread "main" com.google.gdata.util.ParseException: [Line 1, Column 165] 
Invalid root element, expected (namespace uri:local name) of (http://www.w3.org/2005/Atom:feed), 
    found (http://www.w3.org/2005/Atom:entry 

하는 예외 정말하지 않습니다 https://spreadsheets.google.com/ccc?key=0Aoz...mcmc&hl=en#gid=0

URL feedUrl = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full/0Aoz...mcmc"); 
SpreadsheetFeed feed = _service.getFeed(feedUrl, SpreadsheetFeed.class); 
_entry = feed.getEntries().get(0); 

그것은 나에게 다음과 같은 예외를 제공합니다 https://code.google.com/apis/spreadsheets/data/3.0/reference.html#ConstructingURIs

나는 URL에서 키를 얻을 아주 많은 의미. 나는 그 태그가 뿌리가되기를 원하지만 추측하고있다. feedUrl에 사용하고있는 URL로 이동하면 원하는 XML 문서를 얻을 수 있습니다 (원하는 모든 문서의 이름이 있습니다). 나는 여기서 내가 잘못하고있는 것을 보지 못했고, 나를 도울 수 있었던 온라인을 찾을 수 없다.

누구나 내가 뭘 잘못하고 있는지 알아?

감사

답변

0

나는 그것이 더러운 해킹 작업을 알고,하지만 난 com.google.gdata.wireformats.input.AtomDataParser의 소스를 다운로드 결국 다른 솔루션 Reader 오브젝트를 작성을 찾을 수 있기 때문에 래퍼 (wrapper). 예상되는 태그를 파싱 중이던 스트림에 삽입했다.

feedResult.parseAtom(inProps.getExtensionProfile(), inputReader); 

에 : 나는 AtomDataParser 코드에서이 줄을 변경

if(feedResult instanceof SpreadsheetFeed) { 
    feedResult.parseAtom(inProps.getExtensionProfile(), new utils.ReaderWrapper(inputReader)); 
} else { 
    feedResult.parseAtom(inProps.getExtensionProfile(), inputReader); 
} 

혹시 다른 URL을 함께 SpreadsheetFeed을 사용한다면 이것은 분명히 작동하지 않을 것입니다,하지만 난 무엇을 위해 작동 하기.

1

반송 피드 유형에 대해서는 feedUrl이 "https://spreadsheets.google.com/feeds/spreadsheets/private/full/"이어야합니다.