문제

Is this possible? For example, if I run the jSoup Code:

Document source = Jsoup.connect("http://www.xmlFile.com/file.xml").get();
// Convert the Jsoup object to a w3c Document object with Apache.
return DOMBuilder.jsoup2DOM(source);

I now have a w3c Document object. Is there any way of getting file.xml from that object? I've not found anything online that informs me eitherway.

도움이 되었습니까?

해결책

There's a method Document called getDocumentUri() that might do what you want. It seems to depend on what way the Document was created whether the Uri is set to something or null. I don't know how JSoup creates the documents, so your mileage may vary.

http://docs.oracle.com/javase/6/docs/api/org/w3c/dom/Document.html#getDocumentURI()

If JSoup doesn't set it, you could call setDocumentUri() manually in your method, and then use getDocumentUri() where you needed it?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top