use of com.google.firestore.v1beta1.Document in project AndroidSampleLibrary by JackChen365.
the class AndroidManifest method parserAndroidManifest.
@Nonnull
private ManifestInformation parserAndroidManifest(File manifestFile) throws JDOMException, IOException {
ManifestInformation manifestInformation = new ManifestInformation();
if (!manifestFile.exists()) {
System.out.println("File:" + manifestFile.getPath() + " not exists!");
} else {
SAXBuilder saxBuilder = new SAXBuilder();
Document document = saxBuilder.build(manifestFile);
XPathFactory xPathFactory = XPathFactory.instance();
Namespace androidNameSpace = Namespace.getNamespace("android", "http://schemas.android.com/apk/res/android");
XPathExpression<Attribute> applicationExpression = xPathFactory.compile("//application/@android:name", Filters.attribute(), null, androidNameSpace);
Attribute applicationAttribute = applicationExpression.evaluateFirst(document);
if (null != applicationAttribute) {
manifestInformation.application = applicationAttribute.getValue();
}
XPathExpression<Attribute> applicationIdExpression = xPathFactory.compile("/manifest/@package", Filters.attribute(), null, androidNameSpace);
Attribute applicationIdAttribute = applicationIdExpression.evaluateFirst(document);
if (null != applicationIdAttribute) {
manifestInformation.applicationId = applicationIdAttribute.getValue();
}
XPathExpression<Attribute> expression = xPathFactory.compile("//activity/@android:name", Filters.attribute(), null, androidNameSpace);
List<Attribute> attributeList = expression.evaluate(document);
for (int i = 0; i < attributeList.size(); i++) {
Attribute attribute = attributeList.get(i);
manifestInformation.addActivity(attribute.getValue());
}
}
return manifestInformation;
}
use of com.google.firestore.v1beta1.Document in project bigwarp by saalfeldlab.
the class BigWarp method loadSettings.
protected void loadSettings(final String xmlFilename) throws IOException, JDOMException {
final SAXBuilder sax = new SAXBuilder();
final Document doc = sax.build(xmlFilename);
final Element root = doc.getRootElement();
viewerP.stateFromXml(root.getChild("viewerP"));
viewerQ.stateFromXml(root.getChild("viewerQ"));
setupAssignments.restoreFromXml(root);
bookmarks.restoreFromXml(root);
activeSourcesDialogP.update();
activeSourcesDialogQ.update();
// auto-save settings
Element autoSaveElem = root.getChild("autosave");
final String autoSavePath = autoSaveElem.getChild("location").getText();
final long autoSavePeriod = Integer.parseInt(autoSaveElem.getChild("period").getText());
setAutosaveFolder(new File(autoSavePath));
BigWarpAutoSaver.setAutosaveOptions(this, autoSavePeriod, autoSavePath);
viewerFrameP.repaint();
viewerFrameQ.repaint();
}
use of com.google.firestore.v1beta1.Document in project openbanking-aspsp by OpenBankingToolkit.
the class OBIEPainXmlReport1Builder method toPaymentReport.
String toPaymentReport(FRFileConsent consent) {
log.debug("Create {} report file for consent id: {}", consent.getFileType(), consent.getId());
final Document reportDocument = mapConsentToReportDocument(consent);
log.debug("Created JAXB object for report file: {}", reportDocument);
return marshalXML(consent.getId(), reportDocument);
}
use of com.google.firestore.v1beta1.Document in project tis by qlangtech.
the class XModifier method main.
public static void main(String[] arg) throws Exception {
// StringReader read = new StringReader(schema);
// InputSource source = new InputSource(read);
SAXBuilder builder = new SAXBuilder(new XMLReaderSAX2Factory(false));
// builder.setEntityResolver(entityResolver);
builder.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
InputSource source = new InputSource();
source.setCharacterStream(new StringReader(""));
return source;
}
});
InputStream inputStream = new FileInputStream(new File("D:\\home\\schema.xml"));
Document document = builder.build(inputStream);
XModifier modifier = new XModifier(document);
modifier.addModify("/types/fieldType[@name='singleString']/@class", "java.lang.String");
modifier.addModify("/types/fieldType[@name='kkkkkkkk']/@class", "ddddddd");
modifier.addModify("/types/fieldType[@name='xxxxxx'][@class='java.lang.String']");
modifier.addModify("/uniqueKey/text()", "ddddddd");
modifier.addModify("/fields/field[@name='email_dynamic_info'](:delete)");
modifier.modify();
// 设置xml文件格式---选用这种格式可以使生成的xml文件自动换行同时缩进
Format format = Format.getPrettyFormat();
// ▲▲▲▲▲▲************************ 构建schema文件格式
// 将生成的元素加入文档:根元素
// 添加docType属性
DocType docType = new DocType("schema", "http://tis.qlangtech.com:9999/dtd/solrschema.dtd");
document.setDocType(docType);
XMLOutputter xmlout = new XMLOutputter(format);
// 设置xml内容编码
xmlout.setFormat(format.setEncoding("utf8"));
ByteArrayOutputStream byteRsp = new ByteArrayOutputStream();
xmlout.output(document, byteRsp);
System.out.println(byteRsp.toString("utf8"));
}
use of com.google.firestore.v1beta1.Document in project mule-migration-assistant by mulesoft.
the class AbstractSpringMigratorStep method moveNamespacesDeclarations.
protected void moveNamespacesDeclarations(Document muleDocument, Element movedElement, Document springDocument) {
Set<Namespace> declaredNamespaces = doGetNamespacesDeclarationsRecursively(movedElement);
Attribute schemaLocationAttribute = muleDocument.getRootElement().getAttribute("schemaLocation", muleDocument.getRootElement().getNamespace("xsi"));
if (schemaLocationAttribute != null) {
Map<String, String> locations = new HashMap<>();
String[] splitLocations = stream(schemaLocationAttribute.getValue().split("\\s")).filter(s -> !StringUtils.isEmpty(s)).toArray(String[]::new);
for (int i = 0; i < splitLocations.length; i += 2) {
locations.put(splitLocations[i], splitLocations[i + 1]);
}
for (Namespace namespace : declaredNamespaces) {
if (!StringUtils.isEmpty(namespace.getURI()) && locations.containsKey(namespace.getURI())) {
getApplicationModel().addNameSpace(namespace, fixSpringSchemaLocationVersion(locations.get(namespace.getURI())), springDocument.getDocument());
}
}
}
}
Aggregations