Exemplo n.º 1
0
 /* (non-Javadoc)
  * @see org.eclipse.ohf.utilities.xml.IXMLWriter#element(java.lang.String, java.lang.String, java.lang.String)
  */
 @Override
 public void element(String namespace, String name, String content) throws IOException {
   if (!XMLUtil.isNMToken(name)) throw new IOException("XML name " + name + " is not valid");
   open(namespace, name);
   text(content);
   close();
 }
 /**
  * Compose a bundle to a stream, possibly using pretty presentation for a human reader (used in
  * the spec, for example, but not normally in production)
  */
 @Override
 public void compose(OutputStream stream, AtomFeed feed, boolean pretty) throws Exception {
   XMLWriter writer = new XMLWriter(stream, "UTF-8");
   writer.setPretty(pretty);
   writer.start();
   compose(writer, feed, pretty);
   writer.close();
 }
 /**
  * Compose a resource to a stream, possibly using pretty presentation for a human reader, and
  * maybe a different choice in the xhtml narrative (used in the spec in one place, but should not
  * be used in production)
  */
 public void compose(OutputStream stream, Resource resource, boolean pretty, boolean htmlPretty)
     throws Exception {
   XMLWriter writer = new XMLWriter(stream, "UTF-8");
   writer.setPretty(pretty);
   writer.start();
   compose(writer, resource, htmlPretty);
   writer.close();
 }
 /**
  * Compose a tag list to a stream, possibly using pretty presentation for a human reader, and
  * maybe a different choice in the xhtml narrative (used in the spec in one place, but should not
  * be used in production)
  */
 public void compose(
     OutputStream stream, List<AtomCategory> tags, boolean pretty, boolean htmlPretty)
     throws Exception {
   XMLWriter writer = new XMLWriter(stream, "UTF-8");
   writer.setPretty(pretty);
   writer.start();
   compose(writer, tags, htmlPretty);
   writer.close();
 }
Exemplo n.º 5
0
 /* (non-Javadoc)
  * @see org.eclipse.ohf.utilities.xml.IXMLWriter#close(java.lang.String)
  */
 @Override
 public void close(String name) throws IOException {
   checkStarted();
   if (levels.empty())
     throw new IOException("Unable to close null|" + name + ", nothing to close");
   if (levels.current().getNamespace() != null || !levels.current().getName().equals(name))
     throw new IOException(
         "Unable to close null|"
             + name
             + ", found "
             + levels.current().getNamespace()
             + "|"
             + levels.current().getName());
   close();
 }
Exemplo n.º 6
0
 /* (non-Javadoc)
  * @see org.eclipse.ohf.utilities.xml.IXMLWriter#closeToLevel(int)
  */
 @Override
 public void closeToLevel(int count) throws IOException {
   while (levels.size() > count) close();
 }