use of com.google.cloud.documentai.v1beta2.Document in project aws-doc-sdk-examples by awsdocs.
the class SendNotifications method handleVoiceMessage.
public String handleVoiceMessage(String myDom) throws JDOMException, IOException {
String mobileNum = "";
List<String> listVal = new ArrayList<>();
listVal.add("application/json");
Map<String, List<String>> values = new HashMap<>();
values.put("Content-Type", listVal);
ClientOverrideConfiguration config2 = ClientOverrideConfiguration.builder().headers(values).build();
PinpointSmsVoiceClient client = PinpointSmsVoiceClient.builder().overrideConfiguration(config2).region(Region.US_EAST_1).build();
SAXBuilder builder = new SAXBuilder();
Document jdomDocument = builder.build(new InputSource(new StringReader(myDom)));
org.jdom2.Element root = jdomDocument.getRootElement();
// get a list of children elements.
List<org.jdom2.Element> students = root.getChildren("Student");
for (org.jdom2.Element element : students) {
mobileNum = element.getChildText("Phone");
sendVoiceMsg(client, mobileNum);
}
client.close();
return mobileNum;
}
use of com.google.cloud.documentai.v1beta2.Document in project aws-doc-sdk-examples by awsdocs.
the class DynamoDBService method injectETLData.
public void injectETLData(String myDom) throws JDOMException, IOException {
SAXBuilder builder = new SAXBuilder();
Document jdomDocument = builder.build(new InputSource(new StringReader(myDom)));
org.jdom2.Element root = ((org.jdom2.Document) jdomDocument).getRootElement();
PopData pop = new PopData();
List<org.jdom2.Element> items = root.getChildren("Item");
for (org.jdom2.Element element : items) {
pop.setName(element.getChildText("Name"));
pop.setCode(element.getChildText("Code"));
pop.set2010(element.getChildText("Date2010"));
pop.set2011(element.getChildText("Date2011"));
pop.set2012(element.getChildText("Date2012"));
pop.set2013(element.getChildText("Date2013"));
pop.set2014(element.getChildText("Date2014"));
pop.set2015(element.getChildText("Date2015"));
pop.set2016(element.getChildText("Date2016"));
pop.set2017(element.getChildText("Date2017"));
pop.set2018(element.getChildText("Date2018"));
pop.set2019(element.getChildText("Date2019"));
setItem(pop);
}
}
use of com.google.cloud.documentai.v1beta2.Document in project jena by apache.
the class GMLReader method extract.
public static GMLReader extract(String gmlText) throws JDOMException, IOException {
if (gmlText.isEmpty()) {
gmlText = EMPTY_GML_TEXT;
}
SAXBuilder jdomBuilder = newSAXBuilder();
InputStream stream = new ByteArrayInputStream(gmlText.getBytes(StandardCharsets.UTF_8));
Document xmlDoc = jdomBuilder.build(stream);
Element gmlElement = xmlDoc.getRootElement();
return new GMLReader(gmlElement);
}
use of com.google.cloud.documentai.v1beta2.Document in project gocd by gocd.
the class GoConfigMigration method getCurrentSchemaVersion.
private int getCurrentSchemaVersion(String content) {
try {
SAXBuilder builder = new SAXBuilder();
Document document = builder.build(new ByteArrayInputStream(content.getBytes()));
Element root = document.getRootElement();
String currentVersion = root.getAttributeValue(schemaVersion) == null ? "0" : root.getAttributeValue(schemaVersion);
return Integer.parseInt(currentVersion);
} catch (Exception e) {
throw bomb(e);
}
}
use of com.google.cloud.documentai.v1beta2.Document in project gocd by gocd.
the class GoConfigMigrationIntegrationTest method shouldRemoveAllLuauConfigurationFromConfig.
@Test
public void shouldRemoveAllLuauConfigurationFromConfig() throws Exception {
String configString = "<cruise schemaVersion='66'>" + "<server siteUrl='https://hostname'>" + "<security>" + " <luau url='https://luau.url.com' clientKey='0d010cf97ec505ee3788a9b5b8cf71d482c394ae88d32f0333' authState='authorized' />" + " <ldap uri='ldap' managerDn='managerDn' encryptedManagerPassword='+XhtUNvVAxJdHGF4qQGnWw==' searchFilter='(sAMAccountName={0})'>" + " <bases>" + " <base value='ou=Enterprise,ou=Principal,dc=corporate,dc=thoughtworks,dc=com' />" + " </bases>" + " </ldap>" + " <roles>" + " <role name='luau-role'><groups><luauGroup>luau-group</luauGroup></groups></role>" + " <role name='ldap-role'><users><user>some-user</user></users></role>" + "</roles>" + "</security>" + "</server>" + "</cruise>";
String migratedContent = migrateXmlString(configString, 66);
Document document = new SAXBuilder().build(new StringReader(migratedContent));
assertThat(document.getDescendants(new ElementFilter("luau")).hasNext()).isFalse();
assertThat(document.getDescendants(new ElementFilter("groups")).hasNext()).isFalse();
}
Aggregations