- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.n52.security.common.xml.XMLPath.text()
方法的一些代码示例,展示了XMLPath.text()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLPath.text()
方法的具体详情如下:
包路径:org.n52.security.common.xml.XMLPath
类名称:XMLPath
方法名:text
[英]Method text, expects a xpath query resulting in a string.
[中]方法文本,需要xpath查询生成字符串。
代码示例来源:origin: org.n52.metadata/smarteditor-api
private void buildExtentTemplate(Document document, Map<String, String> hashMap, XMLPathCtx xmlPathCtx) {
hashMap.put("west", xmlPathCtx.findIn(document).text("//gmd:westBoundLongitude/*/text()").get());
hashMap.put("east", xmlPathCtx.findIn(document).text("//gmd:eastBoundLongitude/*/text()").get());
hashMap.put("north", xmlPathCtx.findIn(document).text("//gmd:northBoundLatitude/*/text()").get());
hashMap.put("south", xmlPathCtx.findIn(document).text("//gmd:southBoundLatitude/*/text()").get());
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
private void buildPartyTemplate(Document document, Map<String, String> hashMap, XMLPathCtx xmlPathCtx) {
hashMap.put("IndividualName", xmlPathCtx.findIn(document).text("//gmd:individualName/*/text()").get());
hashMap.put("PositionName", xmlPathCtx.findIn(document).text("//gmd:positionName/*/text()").get());
hashMap.put("OrganisationName", xmlPathCtx.findIn(document).text("//gmd:organisationName/*/text()").get());
hashMap.put("Voice", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:phone/*/gmd:voice/*/text()").get());
hashMap.put("Fax", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:phone/*/gmd:facsimile/*/text()").get());
hashMap.put("DeliveryPoint", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:deliveryPoint/*/text()").get());
hashMap.put("City", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:city/*/text()").get());
hashMap.put("AdministrativeArea", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:administrativeArea/*/text()").get());
hashMap.put("PostalCode", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:postalCode/*/text()").get());
hashMap.put("Country", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:country/*/text()").get());
hashMap.put("MailAddress", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:address/*/gmd:electronicMailAddress/*/text()").get());
hashMap.put("Role", xmlPathCtx.findIn(document).text("//gmd:role/*/@codeListValue").get());
hashMap.put("Url", xmlPathCtx.findIn(document).text("//gmd:contactInfo/*/gmd:onlineResource/*/gmd:linkage/gmd:URL").get());
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
/**
* Load a builder class defined in '/catalog_api_factory.xml'
*
* @param pType xml or kvp is standard, any other type might be given also
* @param pName Name of the REquest (GetRecords, GetCapabilities, ect)
* @return Class or null, if not loaded
*/
protected Class loadClass(String pType, String pName) {
String lExpression = "//api:BuilderFactory/api:Group[@type='" + pType + "']/api:Builder[@name='" + pName + "']/api:class";
LOG.debug("Evaluating expression: {} ", lExpression);
String className = xmlPathCtx.findIn(mRoot).text(lExpression).get();
if (className == null) {
LOG.warn(lExpression + " could not be evaluated. Result is null.");
return null;
}
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
LOG.error(e.getMessage());
return null;
}
}
代码示例来源:origin: org.n52.security/52n-security-decision-xacml
private void debugPDPResponse(Element response) {
StringBuilder text = new StringBuilder();
String resourceId = XMLPathCtx.createNew().findIn(response).text("//*[local-name() = 'Result']/@ResourceId").get();
String decision = XMLPathCtx.createNew().findIn(response).text("//*[local-name() = 'Result']/*[local-name() = 'Decision']/text()").get();
text.append("Resource: \t").append(resourceId ).append("\n");
text.append("Decision: \t").append(decision).append("\n");
NodeList obligationNodes = XMLPathCtx.createNew().findIn(response).all("//*[local-name() = 'Obligation']").get();
for (int i = 0; i < obligationNodes.getLength(); i++) {
Element obligationElem = (Element) obligationNodes.item(i);
String oblId = obligationElem.getAttribute("ObligationId");
String fulfillOn = obligationElem.getAttribute("FulfillOn");
text.append("Obligation: \t").append(oblId ).append("(fulfillOn:").append(fulfillOn).append(")\n");
appendAttributeAssignments(text, XMLPathCtx.createNew().findIn(obligationElem).all(".//*[local-name()='AttributeAssignment']").get());
}
LOG.debug("PDP response\n" + text);
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
String fileIdentifier = xmlPathContextFactory.createContext().findIn(document).text("//gmd:fileIdentifier/gco:CharacterString/text()").get();
代码示例来源:origin: org.n52.metadata/smarteditor-api
public String getTemplateFor(Document document) {
Node rootNode = context.findIn(document).node("/*[1]").get();
String serviceType = getServiceTypeFrom(rootNode);
String version = context.findIn(rootNode).text("@version").get();
return version.equals("") ? templateMap.get(serviceType) : templateMap.get(serviceType + "_" + version);
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
for (Document record : records) {
Map<String, Object> innerMap = new HashMap<>();
String fileIdentifier = context.findIn(record).text("//gmd:fileIdentifier[1]/*/text()").get();
String title = context.findIn(record).text("//gmd:identificationInfo[1]/*/gmd:citation/*/gmd:title/*/text()").get();
String lResourceType = context.findIn(record).text("//gmd:hierarchyLevel[1]/*/@codeListValue").get();
innerMap.put("title", title);
innerMap.put("resourceType", lResourceType);
for (int i = 0; i < identifiers.getLength(); i++) {
Node node = identifiers.item(i);
String code = context.findIn(node).text("gmd:code/*/text()").get();
String codeSpace = context.findIn(node).text("gmd:codeSpace/*/text()").get();
StringBuilder stringBuilder = new StringBuilder();
if (!StringUtils.isEmpty(codeSpace)) {
代码示例来源:origin: org.n52.security/52n-security-facade
public String getAssertionConsumerUrl() {
return getXpathCtx().findIn(
m_paosResponse).text("//samlp:AuthnRequest/@AssertionConsumerServiceURL").get();
}
代码示例来源:origin: org.n52.security/52n-security-core
/**
* Creates an instance of this class from an XML file.
*
* @param in
* a service excpetion XML document
*
* @return
* @throws org.xml.sax.SAXException
* @throws IOException
*/
public static ServiceException createFromXML(InputSource in) {
Document excDoc = DOMParser.createNew().parse(in);
XMLPathCtx pathCtx = XMLPathCtx.createNew();
String cd = pathCtx.findIn(excDoc).text("//ServiceException/@code").get().trim();
if (cd.equals(""))
cd = "No code available";
String msg = pathCtx.findIn(excDoc).text("//ServiceException/text()").get().trim();
if (msg.equals(""))
msg = "No exception information available";
return new ServiceException(msg, cd);
}
代码示例来源:origin: org.n52.security/52n-security-wss
private List<AuthenticationMethod> getSupportedAuthenticationMethods() {
List<AuthenticationMethod> supportedAuthNMethods = new ArrayList<AuthenticationMethod>();
NodeList authenticationMethodList = m_xPathCtx.findIn(m_capsDoc).all("//authn:AuthenticationMethod").get();
for (int i = 0; i < authenticationMethodList.getLength(); i++) {
org.w3c.dom.Node currentAuthMethod = authenticationMethodList.item(i);
String type = m_xPathCtx.findIn(currentAuthMethod).text("@xsi:type").get();
type = type.substring(type.lastIndexOf(":") + 1);
String method = m_xPathCtx.findIn(currentAuthMethod).text("@method").get();
AuthenticationMethod supportedAuthMethod;
if (type.equals("WASType")) {
org.w3c.dom.Node accAuthNServiceNode = m_xPathCtx.findIn(currentAuthMethod).node("//authn:AuthenticationService").get();
String wasName = m_xPathCtx.findIn(accAuthNServiceNode).text("authn:Name/text()").get();
String wasUrl = m_xPathCtx.findIn(accAuthNServiceNode).text("authn:OnlineResource/@xlink:href").get();
supportedAuthMethod = new org.n52.security.authentication.WASAuthenticationMethod(wasName, wasUrl, "");
} else {
supportedAuthMethod = AuthenticationMethodFactory.getDefault().create(method);
}
supportedAuthNMethods.add(supportedAuthMethod);
}
return supportedAuthNMethods;
}
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
@RequestMapping(value = "/saveTemplate", method = RequestMethod.POST)
public void saveTemplate(HttpServletResponse response) throws Exception {
// get backend document
Document mergeBackend = backendManagerService.mergeBackend();
String title = xmlPathContextFactory.createContext().findIn(mergeBackend).text("//gmd:title/*/text()").get();
try {
templateManager.saveTemplate(title, "MD_Metadata",
userInfoBean.getUserId() != null ? userInfoBean.getUserId() : "",
userInfoBean.getGroupId() != null ? userInfoBean.getGroupId() : "",
"public",
DOMUtil.convertToString(mergeBackend, false));
} catch (Exception e) {
LOG.error(e.getMessage());
response.sendError(500, e.getMessage());
}
LOG.info("Template saved...");
}
}
代码示例来源:origin: org.n52.security/52n-security-wss
/**
* @return
*/
public LicensePrecondition getLicensePrecondition() {
org.w3c.dom.Node licBroClientElement = m_xPathCtx.findIn(m_capsDoc).node("/wss:WSS_Capabilities/wss:Capability/licb:LicensePrecondition/licb:LicenseBrokerClient").get();
if (licBroClientElement == null) {
return null;
}
String licenseRedirectURL = m_xPathCtx.findIn(licBroClientElement).text("licb:RedirectURL/text()").get();
String ssoGetURL = m_xPathCtx.findIn(licBroClientElement).text("licb:SSOGetURL").get();
if (licenseRedirectURL == null && ssoGetURL == null) {
String baseUrl = m_xPathCtx.findIn(licBroClientElement).text("ows:DCP/ows:HTTP/ows:Post/text()").get();
if (baseUrl == null) {
return null;
}
baseUrl = ensureSingleEndingSlash(baseUrl);
licenseRedirectURL = baseUrl + "getOrCreateLicenseToken.faces";
ssoGetURL = baseUrl + "getLicenseToken.faces";
}
LicensePrecondition licensePrecondition = new LicensePrecondition(ssoGetURL.trim(), licenseRedirectURL.trim(), null);
return licensePrecondition;
}
代码示例来源:origin: org.n52.security/52n-security-decision-xacml
private ResponseDocument convertToXACML1XmlBeanResponse(String xmlChunk) {
Document responseChunk = DOMParser.createNew().parse(new InputSource(new StringReader(xmlChunk)));
ResponseDocument responseDoc = ResponseDocument.Factory.newInstance();
ResponseType response = responseDoc.addNewResponse();
ResultType result = response.addNewResult();
result.setDecision(DecisionType.Enum.forString(xmlPathCtx.findIn(responseChunk).text("/c:Response/c:Result[1]/c:Decision/text()").get()));
result.setResourceId(xmlPathCtx.findIn(responseChunk).text("/c:Response/c:Result[1]/@ResourceId").get());
NodeList obligationNodes = xmlPathCtx.findIn(responseChunk).all("/c:Response/c:Result[1]/p:Obligations/*").get();
ObligationsType obligations;
if (obligationNodes.getLength() > 0) {
obligations = result.addNewObligations();
for (int i = 0; i < obligationNodes.getLength(); i++) {
Element oblElem = (Element) obligationNodes.item(i);
fillObligationFromElem(obligations.addNewObligation(), oblElem);
}
}
return responseDoc;
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
/**
* Simply determines the resource type from the current backend
*
* @return
*/
public String getResourceType() {
if (getMergeDocument() != null) {
return xmlPathContextFactory.createContext().findIn(getMergeDocument()).text("//gmd:hierarchyLevel/*/@codeListValue").get();
}
return null;
}
代码示例来源:origin: org.n52.security/52n-security-enforcement-impl
String offeringID = xPath.findIn(offering).text("@gml:id").get();
String lcContent = xPath.findIn(actual).text("gml:Envelope/gml:lowerCorner/text()").get();
String ucContent = xPath.findIn(actual).text("gml:Envelope/gml:upperCorner/text()").get();
String bpContent = xPath.findIn(timePeriod).text("gml:beginPosition/text()").get();
String epContent = xPath.findIn(timePeriod).text("gml:endPosition/text()").get();
代码示例来源:origin: org.n52.security/52n-security-facade
public static SAML2IdPMetadata createFrom(Element idpSsoDescrElement) throws MalformedURLException {
XMLPathCtx xpathCtx = XMLPathCtx.createNew().addNamespace("md", "urn:oasis:names:tc:SAML:2.0:metadata");
NodeList nodeList = xpathCtx.findIn(idpSsoDescrElement).all("md:SingleSignOnService").get();
SAML2IdPMetadata metadata = new SAML2IdPMetadata();
for (int i = 0; i < nodeList.getLength(); i++) {
Element ssoService = (Element) nodeList.item(i);
String binding = ssoService.getAttribute("Binding");
String location = ssoService.getAttribute("Location");
metadata.addSSOBinding(binding, new URL(location));
}
Element organizationElem = (Element) xpathCtx.findIn(idpSsoDescrElement).node("./../md:Organization").get();
if (organizationElem == null) {
String entityID = xpathCtx.findIn(idpSsoDescrElement).text("./../@entityID").get();
metadata.setOrganisationDisplayName(entityID);
} else {
String idpDisplayName = xpathCtx.findIn(organizationElem).text("md:OrganizationDisplayName/text()").get();
metadata.setOrganisationDisplayName(idpDisplayName);
}
return metadata;
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
/**
* validates the backend bean properties against a given schematron (or else) validator
*
* @param target
* @param errors
*/
public void validate(Object target, Errors errors) {
BackendBean lBean = (BackendBean) target;
// chekc if we need to validate
if (lBean.getValidatorId() != null && !lBean.getValidatorId().equals("")) {
// apply schematron transformation
Document lReport = mService.validate(lBean.getValidatorId());
// add assertions to errors.
XMLPathCtx context = xmlPathContextFactory.createContext();
NodeList nodeList = context.findIn(lReport).all("//svrl:failed-assert").get();
for (int i = 0; i < nodeList.getLength(); i++) {
Node lNode = nodeList.item(i);
String id = context.findIn(lNode).text("@id").get();
String text = context.findIn(lNode).text("svrl:text").get();
errors.rejectValue(id,text);
}
}
}
}
代码示例来源:origin: org.n52.metadata/smarteditor-api
private void addNodes(Node pNode, ITreeNode pTreeNode) {
ITreeNode lCurrentNode = new TreeNode();
String lValue = xmlPathContextFactory.createContext().findIn(pNode).text("value").get();
String lName = xmlPathContextFactory.createContext().findIn(pNode).text("name").get();
LOG.debug("Node name is: {}", lName);
LOG.debug("Node value is: {}", lValue);
// add to pTreeNode
if (pTreeNode.getName().equals("")) {
pTreeNode.setId(lValue);
pTreeNode.setName(lName);
pTreeNode.setType(lValue);
lCurrentNode = pTreeNode;
} else {
lCurrentNode.setId(lValue);
lCurrentNode.setName(lName);
lCurrentNode.setType(lValue);
pTreeNode.addChild(lCurrentNode);
}
lCurrentNode.setObject(new HashMap<>(getDefaultOptions()));
LOG.debug("added node with id {}", lCurrentNode.getId());
// has lChildrenList?
NodeList lChildrenList = xmlPathContextFactory.createContext().findIn(pNode).all("./node").get();
if (lChildrenList != null) {
LOG.debug("Node has ChildrenList");
for (int i = 0; i < lChildrenList.getLength(); i++) {
addNodes(lChildrenList.item(i), lCurrentNode);
}
}
LOG.debug("node has no ChildrenList");
}
我目前正在创建一个正则表达式来拆分所有匹配以下格式的字符串:&[text(text - text text) !text]。这里的文本实际上可以是任何字符。并且间距很重要。文本将如图所示列出。 我已经
这个问题在这里已经有了答案: Remove duplicate commas and extra commas at start/end with RegExp in Javascript, and
我有以下代码。 from xml.dom.minidom import Document doc = Document() root = doc.createElement('root') doc.a
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: Find text string in jQuery and make it bold 如何使用 jQuer
我使用 libmagic 在我的元素的 Web 界面中获取文件的 MIME 类型。我在 css 和 js 文件上得到文本/纯 mime 类型。 例如 chromium 显示以下警告: Resource
起初我必须阅读很多教程,但我仍然不知道我做错了什么...... 我想内联使用 4 个 div。在我想放置的那些 div 中:文本、图像、文本、文本。我希望中间文本自动设置为最大宽度。 我写了一个简单的
我想替换所有出现的 [b: "text"]至text使用 JavaScript 和 RegEx。目前我知道如何替换 [b: ""]至使用'/\[b: ""\]/g'但我不知道如果 " 之间有文本该怎么
这可能是一个幼稚的问题,但我想知道是否有比使用 text() 更好的方法将文本添加到绘图中。注意,我也在使用 layout()以及。具体来说,我有一个情节的一部分,我想在其中添加一些带有标题的文本,然
我必须反复从 latex 源粘贴代码,因此每次都必须做很多查找和替换操作('“a'=>'ä','” o'=>'ö',...) 。 有没有一种方法可以存储这些搜索和替换规则,例如,我可以通过一次按键执行
当我在Sublime Text 3代码屏幕中编写代码时,它连续地向右滑动,如图所示。我该怎么办? 请注意第10行。 最佳答案 如果您只想为当前 View (正在编辑的当前文件)激活自动换行,只需vie
是否有可能更改 sublime text 中的默认字体目录?我只想使用可移植 sublime 文本存储在我的 pendrive 上的字体,这样我就不必在我使用可移植 sublime 文本的每台机器上安
我是 Android 开发的新手,我有一个愚蠢的问题。如何将“文本字段”框放在一行中的文本旁边。 例子: Please Enter the number: [ ] 关于 "t
我想自动将“我的文本”更改为“我的文本”,因为这是用德语写的正确方式。引号可以在文本中的任何位置。 有没有一种简单的方法可以实现这一点? 解决方案应该检查第一个字符,最后一个字符,比如“this”,或
我想知道是否有特殊的语法来绑定(bind)与现有文本连接的文本。 像这样。 显然,这行不通。 什么是最佳实践? 使用 SL4。 最佳答案 使用StringFormat在 Binding 上。 WPF
我认为它应该打印“真实文本”,因为它相当于 true console.log('true text' || true ? 'text' : 'text1'); 但是,输出是“文本”;抱歉,如果是愚蠢的
有没有办法通过 css 打破文本,以便中间有一个“空白”?目前我正在通过手工打破文本来解决这个问题 -但这是愚蠢的。我知道有一个函数可以让文本在另一个 div 中结束和开始,但 IE 不支持它。 文本
我想为我的Tcl/Tk工具实现一个效果:在text控件中,根据具体情况,希望高亮一些线条的背景色,其他线条正常透明.有可能吗? 我尝试了一些选项,例如:-highlightbackground 、-i
我正在尝试解析原始维基百科文章内容,例如the article on Sweden ,使用re.sub()。但是,我在尝试替换 {{some text}} block 时遇到了问题,因为它们可以包含更
我试图先删除 ComboBox 中的所有内容。然后在其前面添加文本,但保留了一些旧文本。有没有办法重置或清除 ComboBox?或者我怎样才能最好地实现这一目标? public void GetBad
我知道我们应该创建 Example对象并将其传递给 nlp.update() 方法。根据 docs 中的示例, 我们有 for raw_text, entity_offsets in train_da
我是一名优秀的程序员,十分优秀!