Reputation: 27346
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.
Upvotes: 1
Views: 269
Reputation: 7459
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?
Upvotes: 1