org.sakaiproject.util.Xml.encodeAttribute()方法的使用及代码示例

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

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

Xml.encodeAttribute介绍

[英]Place a string into the attribute of the element , encoded so special characters can be used.
[中]将字符串放入元素的属性中,对其进行编码以使用特殊字符。

代码示例

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

public void encodeFormattedTextAttribute(Element element, String baseAttributeName, String value)
{
  // store the formatted text in an attribute called baseAttributeName-html
  Xml.encodeAttribute(element, baseAttributeName + "-html", value);
  // Store the non-formatted (plaintext) version as well
  Xml.encodeAttribute(element, baseAttributeName, convertFormattedTextToPlaintext(value));
}

代码示例来源:origin: sakaiproject/sakai

/**
 * Serialize the properties into XML, adding an element to the doc under the top of the stack element.
 * 
 * @param propsToSerialize
 *        The properties to serialize.
 * @param doc
 *        The DOM doc to contain the XML (or null for a string return).
 * @param stack
 *        The DOM elements, the top of which is the containing element of the new "resource" element.
 * @return The newly added element.
 */
public static Element propertiesToXml(Properties propsToSerialize, Document doc, Stack<Element> stack)
{
  Element properties = doc.createElement("properties");
  ((Element) stack.peek()).appendChild(properties);
  Enumeration<?> props = propsToSerialize.propertyNames();
  while (props.hasMoreElements())
  {
    String name = (String) props.nextElement();
    String value = propsToSerialize.getProperty(name);
    Element propElement = doc.createElement("property");
    properties.appendChild(propElement);
    propElement.setAttribute("name", name);
    // encode to allow special characters in the value
    Xml.encodeAttribute(propElement, "value", (String) value);
    propElement.setAttribute("enc", "BASE64");
  }
  return properties;
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

if (m_description != null) Xml.encodeAttribute(role, "description-enc", m_description);
if (m_providerOnly) Xml.encodeAttribute(role, "provider-only", "true");

代码示例来源:origin: org.sakaiproject.mailarchive/sakai-mailarchive-impl

/**
   * Serialize the resource into XML, adding an element to the doc under the top of the stack element.
   * 
   * @param doc
   *        The DOM doc to contain the XML (or null for a string return).
   * @param stack
   *        The DOM elements, the top of which is the containing element of the new "resource" element.
   * @return The newly added element.
   */
  public Element toXml(Document doc, Stack stack)
  {
    Element message = super.toXml(doc, stack);
    // Over-ride super.toXml() definition of body and body-html attributes
    
    // store the html body in attribute
    Xml.encodeAttribute(message, "body-html", getHtmlBody() );
    // store the plain-text body in attribute
    Xml.encodeAttribute(message, "body", getBody() );
    return message;
  }
} // class BasicMailArchiveMessageEdit

代码示例来源:origin: sakaiproject/sakai

Xml.encodeAttribute(propElement, "value", (String) value);
propElement.setAttribute("enc", "BASE64");
    properties.appendChild(propElement);
    propElement.setAttribute("name", name);
    Xml.encodeAttribute(propElement, "value", (String) val);
    propElement.setAttribute("enc", "BASE64");
    propElement.setAttribute("list", "list");

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

Xml.encodeAttribute(message, "subject", msg.getSubject());
Xml.encodeAttribute(message, "body", msg.getBody());

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

if (newCreatorId != null)
  Xml.encodeAttribute(element4, "CHEF:creator", newCreatorId);
  element4.setAttribute("enc", "BASE64");
if (newModifierId != null)
  Xml.encodeAttribute(element4, "CHEF:creator", newModifierId);
  element4.setAttribute("enc", "BASE64");

代码示例来源:origin: org.sakaiproject.assignment/sakai-assignment-impl

if (newCreatorId != null)
  Xml.encodeAttribute(element4, "CHEF:creator", newCreatorId);
  element4.setAttribute("enc", "BASE64");
if (newModifierId != null)
  Xml.encodeAttribute(element4, "CHEF:modifiedby", newModifierId);
  element4.setAttribute("enc", "BASE64");

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

Xml.encodeAttribute(site, "short-description-enc", m_shortDescription);
Xml.encodeAttribute(site, "description-enc", m_description);

代码示例来源:origin: org.sakaiproject.assignment/sakai-assignment-impl

Xml.encodeAttribute(propElement, "value", (String) value);
propElement.setAttribute("enc", "BASE64");
    properties.appendChild(propElement);
    propElement.setAttribute("name", key);
    Xml.encodeAttribute(propElement, "value", (String) val);
    propElement.setAttribute("enc", "BASE64");
    propElement.setAttribute("list", "list");

相关文章