gpt4 book ai didi

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

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

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

XmlWriter.startElement介绍

[英]Start a new element without a qname, attributes or a Namespace URI.

This method will provide an empty string for the Namespace URI, and empty string for the qualified name, and a default empty attribute list. It invokes #startElement(String, String, String, Attributes)} directly.
[中]启动一个没有qname、属性或名称空间URI的新元素。
此方法将为命名空间URI提供空字符串,为限定名称提供空字符串,并提供默认的空属性列表。它直接调用#startElement(String,String,String,Attributes)}。

代码示例

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

/**
 * Start a new element without a qname, attributes or a Namespace URI.
 * 
 * <p>
 * This method will provide an empty string for the Namespace URI, and empty
 * string for the qualified name, and a default empty attribute list. It
 * invokes #startElement(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 start tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #startElement(String, String, String, Attributes)
 */
public void startElement(String localName) throws SAXException {
  startElement("", localName, "", this.EMPTY_ATTS);
}

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

/**
 * Start a new element without a qname, attributes or a Namespace URI.
 * 
 * <p>
 * This method will provide an empty string for the Namespace URI, and empty
 * string for the qualified name, and a default empty attribute list. It
 * invokes #startElement(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 start tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #startElement(String, String, String, Attributes)
 */
public void startElement(String localName) throws SAXException {
  startElement("", localName, "", this.EMPTY_ATTS);
}

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

/**
 * Start a new element without a qname, attributes or a Namespace URI.
 * 
 * <p>
 * This method will provide an empty string for the Namespace URI, and empty
 * string for the qualified name, and a default empty attribute list. It
 * invokes #startElement(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 start tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #startElement(String, String, String, Attributes)
 */
public void startElement(String localName) throws SAXException {
  startElement("", localName, "", this.EMPTY_ATTS);
}

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

/**
 * Start a new element without a qname or attributes.
 * 
 * <p>
 * This method will provide a default empty attribute list and an empty
 * string for the qualified name. It invokes
 * {@link #startElement(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 start tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #startElement(String, String, String, Attributes)
 */
public void startElement(String uri, String localName) throws SAXException {
  startElement(uri, localName, "", this.EMPTY_ATTS);
}

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

/**
 * Start a new element without a qname or attributes.
 * 
 * <p>
 * This method will provide a default empty attribute list and an empty
 * string for the qualified name. It invokes
 * {@link #startElement(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 start tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #startElement(String, String, String, Attributes)
 */
public void startElement(String uri, String localName) throws SAXException {
  startElement(uri, localName, "", this.EMPTY_ATTS);
}

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

/**
 * Start a new element without a qname or attributes.
 * 
 * <p>
 * This method will provide a default empty attribute list and an empty
 * string for the qualified name. It invokes
 * {@link #startElement(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 start tag, or if a
 *                restlet further down the filter chain raises an exception.
 * @see #startElement(String, String, String, Attributes)
 */
public void startElement(String uri, String localName) throws SAXException {
  startElement(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.android/org.restlet.ext.atom

/**
   * Writes the representation to a XML writer.
   * 
   * @param writer
   *            The XML writer to write to.
   * @throws SAXException
   */
  public void writeElement(XmlWriter writer) throws SAXException {
    writer.startElement(APP_NAMESPACE, "categories");

    for (final Category entry : getEntries()) {
      entry.writeElement(writer);
    }

    writer.endElement(APP_NAMESPACE, "categories");
    writer.endDocument();
  }
}

代码示例来源: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.jee/org.restlet.ext.atom

/**
   * Writes the representation to a XML writer.
   * 
   * @param writer
   *            The XML writer to write to.
   * @throws SAXException
   */
  public void writeElement(XmlWriter writer) throws SAXException {
    writer.startElement(APP_NAMESPACE, "categories");

    for (final Category entry : getEntries()) {
      entry.writeElement(writer);
    }

    writer.endElement(APP_NAMESPACE, "categories");
    writer.endDocument();
  }
}

代码示例来源: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.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.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");
  }
}

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

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.forceNSDecl(APP_NAMESPACE, "");
    writer.forceNSDecl(ATOM_NAMESPACE, "atom");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writer.startElement(APP_NAMESPACE, "service");
    for (final Workspace workspace : getWorkspaces()) {
      workspace.writeElement(writer);
    }
    writer.endElement(APP_NAMESPACE, "service");
    writer.endDocument();
  } catch (SAXException se) {
    throw new IOException("Couldn't write the service representation: "
        + se.getMessage());
  }
}

代码示例来源: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 {
  writer.startElement(APP_NAMESPACE, "workspace");
  if (getTitle() != null) {
    writer.dataElement(ATOM_NAMESPACE, "title", getTitle());
  }
  for (final Collection collection : getCollections()) {
    collection.writeElement(writer);
  }
  writer.endElement(APP_NAMESPACE, "workspace");
}

代码示例来源: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 {
  writer.startElement(APP_NAMESPACE, "workspace");
  if (getTitle() != null) {
    writer.dataElement(ATOM_NAMESPACE, "title", getTitle());
  }
  for (final Collection collection : getCollections()) {
    collection.writeElement(writer);
  }
  writer.endElement(APP_NAMESPACE, "workspace");
}

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

/**
 * Writes the representation to a XML writer.
 * 
 * @param writer
 *            The XML writer to write to.
 * @throws IOException
 */
@Override
public void write(XmlWriter writer) throws IOException {
  try {
    writer.forceNSDecl(APP_NAMESPACE, "");
    writer.forceNSDecl(ATOM_NAMESPACE, "atom");
    writer.setDataFormat(true);
    writer.setIndentStep(3);
    writer.startDocument();
    writer.startElement(APP_NAMESPACE, "service");
    for (final Workspace workspace : getWorkspaces()) {
      workspace.writeElement(writer);
    }
    writer.endElement(APP_NAMESPACE, "service");
    writer.endDocument();
  } catch (SAXException se) {
    throw new IOException("Couldn't write the service representation: "
        + se.getMessage());
  }
}

代码示例来源: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 localName
 *            The local name of the element.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer, String localName)
    throws SAXException {
  writer.startElement(ATOM_NAMESPACE, localName);
  if (getEmail() != null) {
    writer.dataElement(ATOM_NAMESPACE, "email", getEmail());
  }
  if (getName() != null) {
    writer.dataElement(ATOM_NAMESPACE, "name", getName());
  }
  if ((getUri() != null) && (getUri().toString() != null)) {
    writer.dataElement(ATOM_NAMESPACE, "uri", getUri().toString());
  }
  writer.endElement(ATOM_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.
 * @param localName
 *            The local name of the element.
 * @throws SAXException
 */
public void writeElement(XmlWriter writer, String localName)
    throws SAXException {
  writer.startElement(ATOM_NAMESPACE, localName);
  if (getEmail() != null) {
    writer.dataElement(ATOM_NAMESPACE, "email", getEmail());
  }
  if (getName() != null) {
    writer.dataElement(ATOM_NAMESPACE, "name", getName());
  }
  if ((getUri() != null) && (getUri().toString() != null)) {
    writer.dataElement(ATOM_NAMESPACE, "uri", getUri().toString());
  }
  writer.endElement(ATOM_NAMESPACE, localName);
}

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