gpt4 book ai didi

org.restlet.ext.xml.XmlWriter.emptyElement()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 15:09:05 26 4
gpt4 key购买 nike

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

XmlWriter.emptyElement介绍

[英]Add an empty element without a Namespace URI, qname or attributes.

This method will supply an empty string for the qname, and empty string for the Namespace URI, and an empty attribute list. It invokes #emptyElement(String,String,String,Attributes) directly.
[中]添加一个没有名称空间URI、qname或属性的空元素。
此方法将为qname提供空字符串,为命名空间URI提供空字符串,并提供空属性列表。它直接调用#emptyElement(字符串、字符串、字符串、属性)。

代码示例

代码示例来源:origin: org.restlet.android/org.restlet.ext.xml

/**
 * Add an empty element without a Namespace URI, qname or attributes.
 * 
 * <p>
 * This method will supply an empty string for the qname, and empty string
 * for the Namespace URI, and an empty attribute list. It invokes
 * {@link #emptyElement(String, String, String, Attributes)} directly.
 * </p>
 * 
 * @param localName
 *            The element's local name.
 * @exception org.xml.sax.SAXException
 *                If there is an error writing the empty tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #emptyElement(String, String, String, Attributes)
 */
public void emptyElement(String localName) throws SAXException {
  emptyElement("", localName, "", this.EMPTY_ATTS);
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.xml

/**
 * Add an empty element without a qname or attributes.
 * 
 * <p>
 * This method will supply an empty string for the qname and an empty
 * attribute list. It invokes
 * {@link #emptyElement(String, String, String, Attributes)} directly.
 * </p>
 * 
 * @param uri
 *            The element's Namespace URI.
 * @param localName
 *            The element's local name.
 * @exception org.xml.sax.SAXException
 *                If there is an error writing the empty tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #emptyElement(String, String, String, Attributes)
 */
public void emptyElement(String uri, String localName) throws SAXException {
  emptyElement(uri, localName, "", this.EMPTY_ATTS);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.xml

/**
 * Add an empty element without a Namespace URI, qname or attributes.
 * 
 * <p>
 * This method will supply an empty string for the qname, and empty string
 * for the Namespace URI, and an empty attribute list. It invokes
 * {@link #emptyElement(String, String, String, Attributes)} directly.
 * </p>
 * 
 * @param localName
 *            The element's local name.
 * @exception org.xml.sax.SAXException
 *                If there is an error writing the empty tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #emptyElement(String, String, String, Attributes)
 */
public void emptyElement(String localName) throws SAXException {
  emptyElement("", localName, "", this.EMPTY_ATTS);
}

代码示例来源:origin: org.restlet/org.restlet.ext.xml

/**
 * Add an empty element without a Namespace URI, qname or attributes.
 * 
 * <p>
 * This method will supply an empty string for the qname, and empty string
 * for the Namespace URI, and an empty attribute list. It invokes
 * {@link #emptyElement(String, String, String, Attributes)} directly.
 * </p>
 * 
 * @param localName
 *            The element's local name.
 * @exception org.xml.sax.SAXException
 *                If there is an error writing the empty tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #emptyElement(String, String, String, Attributes)
 */
public void emptyElement(String localName) throws SAXException {
  emptyElement("", localName, "", this.EMPTY_ATTS);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.xml

/**
 * Add an empty element without a qname or attributes.
 * 
 * <p>
 * This method will supply an empty string for the qname and an empty
 * attribute list. It invokes
 * {@link #emptyElement(String, String, String, Attributes)} directly.
 * </p>
 * 
 * @param uri
 *            The element's Namespace URI.
 * @param localName
 *            The element's local name.
 * @exception org.xml.sax.SAXException
 *                If there is an error writing the empty tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #emptyElement(String, String, String, Attributes)
 */
public void emptyElement(String uri, String localName) throws SAXException {
  emptyElement(uri, localName, "", this.EMPTY_ATTS);
}

代码示例来源:origin: org.restlet/org.restlet.ext.xml

/**
 * Add an empty element without a qname or attributes.
 * 
 * <p>
 * This method will supply an empty string for the qname and an empty
 * attribute list. It invokes
 * {@link #emptyElement(String, String, String, Attributes)} directly.
 * </p>
 * 
 * @param uri
 *            The element's Namespace URI.
 * @param localName
 *            The element's local name.
 * @exception org.xml.sax.SAXException
 *                If there is an error writing the empty tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #emptyElement(String, String, String, Attributes)
 */
public void emptyElement(String uri, String localName) throws SAXException {
  emptyElement(uri, localName, "", this.EMPTY_ATTS);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @param namespace
 *            The element namespace URI.
 * @param localName
 *            The local name of the element.
 * @throws SAXException
 */
public static void writeElement(XmlWriter writer, Date date,
    String namespace, String localName) throws SAXException {
  if (date != null) {
    writer.startElement(namespace, localName);
    writer.characters(DateUtils.format(date,
        DateUtils.FORMAT_RFC_3339.get(0)));
    writer.endElement(namespace, localName);
  } else {
    writer.emptyElement(namespace, localName);
  }
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @param namespace
 *            The element namespace URI.
 * @param localName
 *            The local name of the element.
 * @throws SAXException
 */
public static void writeElement(XmlWriter writer, Date date,
    String namespace, String localName) throws SAXException {
  if (date != null) {
    writer.startElement(namespace, localName);
    writer.characters(DateUtils.format(date, DateUtils.FORMAT_RFC_3339
        .get(0)));
    writer.endElement(namespace, localName);
  } else {
    writer.emptyElement(namespace, localName);
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer) throws SAXException {
  final AttributesImpl attributes = new AttributesImpl();
  if (getLabel() != null) {
    attributes.addAttribute("", "label", null, "text", getLabel());
  }
  if ((getScheme() != null) && (getScheme().toString() != null)) {
    attributes.addAttribute("", "scheme", null, "atomURI", getScheme()
        .toString());
  }
  if (getTerm() != null) {
    attributes.addAttribute("", "term", null, "text", getTerm());
  }
  writer.emptyElement(ATOM_NAMESPACE, "category", null, attributes);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer) throws SAXException {
  final AttributesImpl attributes = new AttributesImpl();
  if ((getValue() != null) && !getValue().equals("")) {
    attributes.addAttribute("", "id", null, "xs:string", getValue());
  }
  if (getDocumentations().isEmpty()) {
    writer.emptyElement(APP_NAMESPACE, "option", null, attributes);
  } else {
    writer.startElement(APP_NAMESPACE, "option", null, attributes);
    for (final DocumentationInfo documentationInfo : getDocumentations()) {
      documentationInfo.writeElement(writer);
    }
    writer.endElement(APP_NAMESPACE, "option");
  }
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer) throws SAXException {
  final AttributesImpl attributes = new AttributesImpl();
  if (getLabel() != null) {
    attributes.addAttribute("", "label", null, "text", getLabel());
  }
  if ((getScheme() != null) && (getScheme().toString() != null)) {
    attributes.addAttribute("", "scheme", null, "atomURI", getScheme()
        .toString());
  }
  if (getTerm() != null) {
    attributes.addAttribute("", "term", null, "text", getTerm());
  }
  writer.emptyElement(ATOM_NAMESPACE, "category", null, attributes);
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer) throws SAXException {
  if (getDocumentations().isEmpty() && getIncludes().isEmpty()) {
    writer.emptyElement(APP_NAMESPACE, "grammars");
  } else {
    writer.startElement(APP_NAMESPACE, "grammars");
    for (final DocumentationInfo documentationInfo : getDocumentations()) {
      documentationInfo.writeElement(writer);
    }
    for (final IncludeInfo includeInfo : getIncludes()) {
      includeInfo.writeElement(writer);
    }
    writer.endElement(APP_NAMESPACE, "grammars");
  }
}

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer) throws SAXException {
  final AttributesImpl attributes = new AttributesImpl();
  if ((getUri() != null) && (getUri().toString() != null)) {
    attributes.addAttribute("", "uri", null, "atomURI", getUri()
        .toString());
  }
  if (getVersion() != null) {
    attributes.addAttribute("", "version", null, "text", getVersion());
  }
  if (getName() != null) {
    writer.dataElement(ATOM_NAMESPACE, "generator", null, attributes,
        getName());
  } else {
    writer.emptyElement(ATOM_NAMESPACE, "generator", null, attributes);
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer) throws SAXException {
  final AttributesImpl attributes = new AttributesImpl();
  if ((getUri() != null) && (getUri().toString() != null)) {
    attributes.addAttribute("", "uri", null, "atomURI", getUri()
        .toString());
  }
  if (getVersion() != null) {
    attributes.addAttribute("", "version", null, "text", getVersion());
  }
  if (getName() != null) {
    writer.dataElement(ATOM_NAMESPACE, "generator", null, attributes,
        getName());
  } else {
    writer.emptyElement(ATOM_NAMESPACE, "generator", null, attributes);
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl

/**
   * Writes the current object as an XML element using the given SAX writer.
   * 
   * @param writer
   *            The SAX writer.
   * @throws SAXException
   */
  public void writeElement(XmlWriter writer) throws SAXException {
    final AttributesImpl attributes = new AttributesImpl();
    if ((getTargetRef() != null) && (getTargetRef().toString() != null)) {
      attributes.addAttribute("", "href", null, "xs:anyURI",
          getTargetRef().toString());
    }

    if (getDocumentations().isEmpty()) {
      writer.emptyElement(APP_NAMESPACE, "include", null, attributes);
    } else {
      writer.startElement(APP_NAMESPACE, "include", null, attributes);
      for (final DocumentationInfo documentationInfo : getDocumentations()) {
        documentationInfo.writeElement(writer);
      }
      writer.endElement(APP_NAMESPACE, "include");
    }
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.atom

getContent());
} else {
  writer.emptyElement(ATOM_NAMESPACE, localName, null, attributes);

代码示例来源:origin: org.restlet.android/org.restlet.ext.atom

getContent());
} else {
  writer.emptyElement(ATOM_NAMESPACE, localName, null, attributes);

代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer) throws SAXException {
  final AttributesImpl attributes = new AttributesImpl();
  if (getBaseRef() != null) {
    attributes.addAttribute("", "base", null, "xs:anyURI", getBaseRef()
        .toString());
  }
  if (getDocumentations().isEmpty() && getResources().isEmpty()) {
    writer.emptyElement(APP_NAMESPACE, "resources", null, attributes);
  } else {
    writer.startElement(APP_NAMESPACE, "resources", null, attributes);
    for (final DocumentationInfo documentationInfo : getDocumentations()) {
      documentationInfo.writeElement(writer);
    }
    for (final ResourceInfo resourceInfo : getResources()) {
      resourceInfo.writeElement(writer);
    }
    writer.endElement(APP_NAMESPACE, "resources");
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl

writer.emptyElement(APP_NAMESPACE, "resource_type", null,
      attributes);
} else {

代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl

/**
 * Writes the current object as an XML element using the given SAX writer.
 * 
 * @param writer
 *            The SAX writer.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer) throws SAXException {
  if (getDocumentations().isEmpty() && getParameters().isEmpty()
      && getRepresentations().isEmpty()) {
    writer.emptyElement(APP_NAMESPACE, "request");
  } else {
    writer.startElement(APP_NAMESPACE, "request");
    for (final DocumentationInfo documentationInfo : getDocumentations()) {
      documentationInfo.writeElement(writer);
    }
    for (final ParameterInfo parameterInfo : getParameters()) {
      parameterInfo.writeElement(writer);
    }
    for (final RepresentationInfo representationInfo : getRepresentations()) {
      representationInfo.writeElement(writer);
    }
    writer.endElement(APP_NAMESPACE, "request");
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com