本文整理了Java中nu.xom.Element.getValue()
方法的一些代码示例,展示了Element.getValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getValue()
方法的具体详情如下:
包路径:nu.xom.Element
类名称:Element
方法名:getValue
暂无
代码示例来源:origin: wiztools/rest-client
static char[] getPassword(Element ePassword) {
return Util.base64decode(ePassword.getValue()).toCharArray();
}
}
代码示例来源:origin: wiztools/rest-client
private String getPartValue(Element e) {
if(readVersion.isLessThan(VERSION_SINCE_PART_CONTENT)) {
return e.getValue();
}
else {
Element eContent = e.getChildElements("content").get(0);
return eContent.getValue();
}
}
代码示例来源:origin: wiztools/rest-client
private void addFields(Elements eFields, ReqEntityBasePart part) {
if(eFields == null) {
return;
}
for(int i=0; i<eFields.size(); i++) {
Element eField = eFields.get(i);
String name = eField.getChildElements("name").get(0).getValue();
String value = eField.getChildElements("value").get(0).getValue();
part.addField(name, value);
}
}
代码示例来源:origin: wiztools/rest-client
static void populateBasicDigestAuth(BasicDigestAuthBaseBean bean, Element eAuth) {
Elements eChildren = eAuth.getChildElements();
for(int i=0; i<eChildren.size(); i++) {
Element e = eChildren.get(i);
final String name = e.getLocalName();
if(name.equals("host")) {
bean.setHost(e.getValue());
}
else if(name.equals("realm")) {
bean.setRealm(e.getValue());
}
else if(name.equals("username")) {
bean.setUsername(e.getValue());
}
else if(name.equals("password")) {
bean.setPassword(getPassword(e));
}
else if(name.equals("preemptive")) {
bean.setPreemptive(true);
}
else {
throw new XMLException("Unknown element in basic/digest auth: " + name);
}
}
}
代码示例来源:origin: wiztools/rest-client
static NtlmAuth getNtlmAuth(Element eNtlmAuth) {
NtlmAuthBean out = new NtlmAuthBean();
Elements eChildren = eNtlmAuth.getChildElements();
for(int i=0; i<eChildren.size(); i++) {
Element e = eChildren.get(i);
final String name = e.getLocalName();
if(name.equals("domain")) {
out.setDomain(e.getValue());
}
else if(name.equals("workstation")) {
out.setWorkstation(e.getValue());
}
else if(name.equals("username")) {
out.setUsername(e.getValue());
}
else if(name.equals("password")) {
out.setPassword(getPassword(e));
}
else {
throw new XMLException("Unknown element in ntlm auth: " + name);
}
}
return out;
}
代码示例来源:origin: wiztools/rest-client
if("string".equals(name)) {
ContentType ct = getContentType(e);
String body = e.getValue();
return new ReqEntityStringBean(body, ct);
String filePath = e.getValue();
return new ReqEntityFileBean(new File(filePath), ct);
byte[] body = Util.base64decodeByteArray(e.getValue());
return new ReqEntityByteArrayBean(body, ct);
try {
ContentType ct = getContentType(e);
URL url = new URL(e.getValue());
return new ReqEntityUrlStreamBean(ct, url);
代码示例来源:origin: wiztools/rest-client
static OAuth2BearerAuth getOAuth2BearerAuth(Element eAuth) {
OAuth2BearerAuthBean out = new OAuth2BearerAuthBean();
Elements eChildren = eAuth.getChildElements();
for(int i=0; i<eChildren.size(); i++) {
Element e = eChildren.get(i);
final String name = e.getLocalName();
if(name.equals("token")) {
out.setOAuth2BearerToken(e.getValue());
}
else {
throw new XMLException("Unknown element in oauth2-bearer auth: " + name);
}
}
return out;
}
代码示例来源:origin: wiztools/rest-client
String nodeName = tNode.getQualifiedName();
if ("http-version".equals(nodeName)) {
String t = tNode.getValue();
HTTPVersion httpVersion = "1.1".equals(t)?
HTTPVersion.HTTP_1_1 : HTTPVersion.HTTP_1_0;
URL url = new URL(tNode.getValue());
requestBean.setUrl(url);
requestBean.setMethod(HTTPMethod.get(tNode.getValue()));
requestBean.setTestScript(tNode.getValue());
代码示例来源:origin: wiztools/rest-client
responseBean.setExecutionTime(Long.parseLong(tNode.getValue()));
} else if ("status".equals(nodeName)) {
responseBean.setStatusLine(tNode.getValue());
responseBean.setStatusCode(Integer.parseInt(tNode.getAttributeValue("code")));
} else if ("headers".equals(nodeName)) {
final String base64body = tNode.getValue();
responseBean.setResponseBody(Util.base64decodeByteArray(base64body));
} else if ("test-result".equals(nodeName)) {
代码示例来源:origin: wiztools/rest-client
break;
case "hostname-verifier":
out.setHostNameVerifier(SSLHostnameVerifier.valueOf(e.getValue()));
break;
case "keystore":
代码示例来源:origin: cmu-phil/tetrad
/**
* @return the value of the elemnt, will return null if its an empty string.
*/
private static String getValue(Element value) {
String v = value.getValue();
if (v != null && v.length() == 0) {
return null;
}
return v;
}
代码示例来源:origin: BruceEckel/OnJava8-Examples
public APerson(Element person) {
first = person
.getFirstChildElement("first").getValue();
last = person
.getFirstChildElement("last").getValue();
}
@Override
代码示例来源:origin: org.openbase/jul.extension.xml
public static boolean parseBooleanElementValue(final String elementName, final Element sourceElement) {
try {
return Boolean.parseBoolean(XMLProcessor.parseOneChildElement(elementName, sourceElement).getValue());
} catch (MissingElementException | OverissueElementException ex) {
return false;
}
}
代码示例来源:origin: ESAPI/esapi-java-legacy
private static List<Object> getExceptionsFromElement(Element root) {
Elements exceptions = root.getChildElements("path-exception");
ArrayList<Object> exceptionList = new ArrayList<Object>();
for(int i=0;i<exceptions.size();i++) {
Element e = exceptions.get(i);
if ( REGEX.equalsIgnoreCase(e.getAttributeValue("type"))) {
exceptionList.add( Pattern.compile(e.getValue()) );
} else {
exceptionList.add( e.getValue() );
}
}
return exceptionList;
}
代码示例来源:origin: se.vgregion.mobile/mobile-mobile-composite-svc
private String getValue(Elements elements) {
if(elements.size() == 1) {
return elements.get(0).getValue();
} else {
throw new RuntimeException("Invalid XML");
}
}
代码示例来源:origin: com.io7m.jstructural/io7m-jstructural-xom
private static SDocumentTitle documentTitleRoot(
final Element root)
{
final Element e = SDocumentParser.getElement(root, "document-title");
assert e != null;
return SDocumentTitle.documentTitle(e.getValue());
}
代码示例来源:origin: com.io7m.jstructural/io7m-jstructural-xom
private static SFormalItemTitle formalItemTitleRoot(
final Element e)
{
final Element ec = SDocumentParser.getElement(e, "formal-item-title");
assert ec != null;
return SFormalItemTitle.formalItemTitle(ec.getValue());
}
代码示例来源:origin: com.io7m.jstructural/io7m-jstructural-xom
private static SSectionTitle sectionTitleRoot(
final Element root)
{
final Element e = SDocumentParser.getElement(root, "section-title");
assert e != null;
return SSectionTitle.sectionTitle(e.getValue());
}
代码示例来源:origin: com.io7m.jstructural/io7m-jstructural-xom
private static
@Nullable
SDocumentStyle documentStyleRoot(
final Element root)
throws URISyntaxException
{
final Element e = SDocumentParser.getElement(root, "document-style");
if (e == null) {
return null;
}
return SDocumentStyle.documentStyle(new URI(e.getValue()));
}
代码示例来源:origin: org.xml-cml/cmlxom
private static double getWeight(Element element, String source) {
Elements weights = element.getChildElements("mass");
for (int i = 0; i < weights.size(); i++) {
Element weight = (Element) weights.get(i);
if (source != null
&& source.equals(weight.getAttributeValue("source"))) {
return Double.parseDouble(weight.getValue());
}
}
return 0;
}
内容来源于网络,如有侵权,请联系作者删除!