Hello again!
I'm wrapping up my work on xee-extract, and turning my attention to my next usecase need - automatic URL fetching in Documents.
My use case is I have a large set (about a million) of XML documents in a datastore that are accessible via http.
I would like to run XML extractions against this entire datastore. Any given extraction might only touch a few documents, but I dont necessarily know which documents an extraction will touch ahead of time, so I can't pre-load them.
What I'd like to do is open a PR where I add a feature-gated feature to xee_xpath::Documents. The idea would be someting like this:
let policy = HttpPolicy::new()
.whitelist("https://store.myxmlstore.com/*")
.header("https://*.myxmlstore.com/*", "User-Agent", "my-agent/1.0")
.header("https://*.myxmlstore.com/*", "Authorization", "my-secret-auth-code")
.relative_base("https://store.myxmlstore.com")
.connect_timeout(Duration::from_secs(5))
.total_timeout(Duration::from_secs(15))
.max_response_size(10 * 1024 * 1024)
.max_retries(3)
.retry_on_status(vec![429, 503])
let mut documents = Documents::new();
documents.enable_doc_fetch(policy);
// Add our default document, which I've pre-loaded
let user_doc = documents
.add_string(
"http://example.com/user/1.xml".try_into().unwrap(),
r#"<users>
<user id="user123">
<name>John Doe</name>
<email>john@example.com</email>
<organization xlink:type="simple" xlink:href="/orgs/acme.xml" />
</user>
</users>"#,
)
.unwrap();
let extractor = Extractor::new();
let user: UserWithOrg = extractor.extract_from_docs(&mut documents, &user_doc).unwrap();
This would obviously introduce a bunch of dependencies, so it would need to be feature-gated (default disabled).
Thoughts?
Hello again!
I'm wrapping up my work on xee-extract, and turning my attention to my next usecase need - automatic URL fetching in Documents.
My use case is I have a large set (about a million) of XML documents in a datastore that are accessible via http.
I would like to run XML extractions against this entire datastore. Any given extraction might only touch a few documents, but I dont necessarily know which documents an extraction will touch ahead of time, so I can't pre-load them.
What I'd like to do is open a PR where I add a feature-gated feature to
xee_xpath::Documents. The idea would be someting like this:This would obviously introduce a bunch of dependencies, so it would need to be feature-gated (default disabled).
Thoughts?