org.opensaml.xml.schema.XSAny.setTextContent()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.opensaml.xml.schema.XSAny.setTextContent()方法的一些代码示例,展示了XSAny.setTextContent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSAny.setTextContent()方法的具体详情如下:
包路径:org.opensaml.xml.schema.XSAny
类名称:XSAny
方法名:setTextContent

XSAny.setTextContent介绍

[英]Sets the text content for the DOM Element.
[中]

代码示例

代码示例来源:origin: org.opensaml/xmltooling

/** {@inheritDoc} */
  protected void processElementContent(XMLObject xmlObject, String elementContent) {
    XSAny xsAny = (XSAny) xmlObject;

    xsAny.setTextContent(elementContent);
  }
}

代码示例来源:origin: io.apigee.opensaml/xmltooling

/** {@inheritDoc} */
  protected void processElementContent(XMLObject xmlObject, String elementContent) {
    XSAny xsAny = (XSAny) xmlObject;

    xsAny.setTextContent(elementContent);
  }
}

代码示例来源:origin: net.unicon.cas/cas-addons

private XSAny newAttributeValue(final Object value, final AttributeStatement statement) {
  final QName temp = statement.getElementQName();
  final QName qName = new QName(temp.getNamespaceURI(), AttributeValue.DEFAULT_ELEMENT_NAME.getLocalPart(),
      temp.getPrefix());
  final XSAny stringValue = this.attrValueBuilder.buildObject(qName);
  if (value instanceof String) {
    stringValue.setTextContent((String) value);
  } else {
    stringValue.setTextContent(value.toString());
  }
  return stringValue;
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public static XSAny createAttributeValue(String value, String type) {
  XSAny ep = createAttributeValue();
  ep.setTextContent(String.valueOf(value));
  ep.getUnknownAttributes().put(XSI_TYPE_ATTRIBUTE_NAME, type);
  
  ep.addNamespace(new Namespace(XMLConstants.XSI_NS, XMLConstants.XSI_PREFIX));
  return ep;
}

代码示例来源:origin: stackoverflow.com

String yourXMLFragment = "...";

AttributeStatementBuilder attributeStatementBuilder = 
  (AttributeStatementBuilder) builderFactory.getBuilder(AttributeStatement.DEFAULT_ELEMENT_NAME);
AttributeStatement attributeStatement = attributeStatementBuilder.buildObject();

AttributeBuilder attributeBuilder = 
  (AttributeBuilder) builderFactory.getBuilder(Attribute.DEFAULT_ELEMENT_NAME);
Attribute attr = attributeBuilder.buildObject();
attr.setName("yourAttributeName");

XSAnyBuilder sb2 = (XSAnyBuilder) builderFactory.getBuilder(XSAny.TYPE_NAME);
XSAny attrAny = sb2.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSAny.TYPE_NAME);
attrAny.setTextContent(yourXMLFragment.trim());

attr.getAttributeValues().add(attrAny);
attributeStatement.getAttributes().add(attr);

相关文章