org.opensaml.xml.schema.XSAny类的使用及代码示例

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

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

XSAny介绍

[英]Represents the schema Any type.
[中]表示任何类型的架构。

代码示例

代码示例来源:origin: cloudfoundry/uaa

value = ((XSString) xmlObject).getValue();
} else if (xmlObject instanceof XSAny) {
  value = ((XSAny)xmlObject).getTextContent();
} else if (xmlObject instanceof XSInteger) {
  Integer i =  ((XSInteger)xmlObject).getValue();

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

if (AttributeValue.DEFAULT_ELEMENT_LOCAL_NAME.equals(ep.getElementQName().getLocalPart())
    && SAMLConstants.SAML20_NS.equals(ep.getElementQName().getNamespaceURI())) {
  if (ep.getUnknownXMLObjects().size() > 0) {
    StringBuilder res = new StringBuilder();
    for (XMLObject obj : ep.getUnknownXMLObjects()) {
      res.append(XMLHelper.nodeToString(SamlUtil.marshallObject(obj)));
  values.add(ep.getTextContent());

代码示例来源:origin: edu.internet2.middleware/shibboleth-common

} else if (xmlObj instanceof XSAny) {
  final XSAny wc = (XSAny) xmlObj;
  if (wc.getUnknownAttributes().isEmpty() && wc.getUnknownXMLObjects().isEmpty()) {
    toMatch = wc.getTextContent();

代码示例来源:origin: OpenConext/Mujina

public static Optional<String> getStringValueFromXMLObject(XMLObject xmlObj) {
 if (xmlObj instanceof XSString) {
  return Optional.ofNullable(((XSString) xmlObj).getValue());
 } else if (xmlObj instanceof XSAny) {
  XSAny xsAny = (XSAny) xmlObj;
  String textContent = xsAny.getTextContent();
  if (StringUtils.hasText(textContent)) {
   return Optional.of(textContent);
  }
  List<XMLObject> unknownXMLObjects = xsAny.getUnknownXMLObjects();
  if (!CollectionUtils.isEmpty(unknownXMLObjects)) {
   XMLObject xmlObject = unknownXMLObjects.get(0);
   if (xmlObject instanceof NameID) {
    NameID nameID = (NameID) xmlObject;
    return Optional.of(nameID.getValue());
   }
  }
 }
 return Optional.empty();
}

代码示例来源: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: org.opensaml/xmltooling

/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
    throws UnmarshallingException {
  XSAny xsAny = (XSAny) parentXMLObject;
  xsAny.getUnknownXMLObjects().add(childXMLObject);
}

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

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

    xsAny.setTextContent(elementContent);
  }
}

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

public XSAny createXSAny(Element dom)
{
XSAnyBuilder anyBuilder = (XSAnyBuilder) Configuration.getBuilderFactory().getBuilder(XSAny.TYPE_NAME);
  XSAny any = anyBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSAny.TYPE_NAME);
  // this builds only the root element not the whole dom
  XSAny xo=anyBuilder.buildObject(dom);
  // set/populate dom so whole dom gets into picture
  xo.setDOM(dom);
  any.getUnknownXMLObjects().add(xo);

 return any; 
}

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

/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
  XSAny xsAny = (XSAny) xmlObject;
  QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
      .getPrefix());
  if (attribute.isId()) {
    xsAny.getUnknownAttributes().registerID(attribQName);
  }
  xsAny.getUnknownAttributes().put(attribQName, attribute.getValue());
}

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

if (AttributeValue.DEFAULT_ELEMENT_LOCAL_NAME.equals(ep.getElementQName().getLocalPart())
    && SAMLConstants.SAML20_NS.equals(ep.getElementQName().getNamespaceURI())) {
  if (ep.getUnknownXMLObjects().size() > 0) {
    StringBuilder res = new StringBuilder();
    for (XMLObject obj : ep.getUnknownXMLObjects()) {
      res.append(XMLHelper.nodeToString(marshallObject(obj)));
  return ep.getTextContent();

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

/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
    throws UnmarshallingException {
  XSAny xsAny = (XSAny) parentXMLObject;
  xsAny.getUnknownXMLObjects().add(childXMLObject);
}

代码示例来源: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 processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
  XSAny xsAny = (XSAny) xmlObject;
  QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
      .getPrefix());
  if (attribute.isId()) {
    xsAny.getUnknownAttributes().registerID(attribQName);
  }
  xsAny.getUnknownAttributes().put(attribQName, attribute.getValue());
}

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

if (AttributeValue.DEFAULT_ELEMENT_LOCAL_NAME.equals(ep.getElementQName().getLocalPart())
    && SAMLConstants.SAML20_NS.equals(ep.getElementQName().getNamespaceURI())) {
  if (ep.getUnknownXMLObjects().size() > 0) {
    StringBuilder res = new StringBuilder();
    for (XMLObject obj : ep.getUnknownXMLObjects()) {
      res.append(XMLHelper.nodeToString(SamlUtil.marshallObject(obj)));
  values.add(ep.getTextContent());

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

/** {@inheritDoc} */
  protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException {
    XSAny xsAny = (XSAny) xmlObject;

    if (xsAny.getTextContent() != null) {
      XMLHelper.appendTextContent(domElement, xsAny.getTextContent());
    }
  }
}

代码示例来源:origin: edu.internet2.middleware/shibboleth-common

/** {@inheritDoc} */
public Attribute encode(BaseAttribute attribute) throws AttributeEncodingException {
  Attribute samlAttribute = attributeBuilder.buildObject();
  populateAttribute(samlAttribute);
  XSAny samlAttributeValue;
  for (Object o : attribute.getValues()) {
    if (o == null || !(o instanceof XMLObject)) {
      continue;
    }
    samlAttributeValue = attributeValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME);
    samlAttributeValue.getUnknownXMLObjects().add((XMLObject) o);
    samlAttribute.getAttributeValues().add(samlAttributeValue);
  }
  List<XMLObject> attributeValues = samlAttribute.getAttributeValues();
  if (attributeValues == null || attributeValues.isEmpty()) {
    log.debug("Unable to encode {} attribute.  It does not contain any values", attribute.getId());
    return null;
  }
  return samlAttribute;
}

代码示例来源: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: org.opensaml/xmltooling

/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
  XSAny xsAny = (XSAny) xmlObject;
  Attr attribute;
  for (Entry<QName, String> entry : xsAny.getUnknownAttributes().entrySet()) {
    attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
    attribute.setValue(entry.getValue());
    domElement.setAttributeNodeNS(attribute);
    if (Configuration.isIDAttribute(entry.getKey())
        || xsAny.getUnknownAttributes().isIDAttribute(entry.getKey())) {
      attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    }
  }
}

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

if (AttributeValue.DEFAULT_ELEMENT_LOCAL_NAME.equals(ep.getElementQName().getLocalPart())
    && SAMLConstants.SAML20_NS.equals(ep.getElementQName().getNamespaceURI())) {
  if (ep.getUnknownXMLObjects().size() > 0) {
    StringBuilder res = new StringBuilder();
    for (XMLObject obj : ep.getUnknownXMLObjects()) {
      res.append(XMLHelper.nodeToString(SamlUtil.marshallObject(obj)));
  return ep.getTextContent();

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

/** {@inheritDoc} */
  protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException {
    XSAny xsAny = (XSAny) xmlObject;

    if (xsAny.getTextContent() != null) {
      XMLHelper.appendTextContent(domElement, xsAny.getTextContent());
    }
  }
}

相关文章

微信公众号

最新文章

更多