private void writePendingComment() throws IOException { if (pendingComment != null) { if (isPretty()) write(" "); if (levels.inComment()) write("<!-- " + pendingComment + " -- >"); else write("<!-- " + pendingComment + " -->"); } }
/* (non-Javadoc) * @see org.eclipse.ohf.utilities.xml.IXMLWriter#startCommentBlock() */ @Override public void startCommentBlock() throws IOException { if (levels.inComment()) throw new IOException("cannot nest comments"); levels.current().setInComment(true); if (isPretty()) writePretty(); write("<!--"); if (isPretty()) writePretty(); }
/* (non-Javadoc) * @see org.eclipse.ohf.utilities.xml.IXMLWriter#endCommentBlock() */ @Override public void endCommentBlock() throws IOException { if (!levels.inComment()) throw new IOException("cannot close a comment block when it is open"); if (!levels.current().isInComment()) throw new IOException("cannot close a comment block when it is open"); if (isPretty()) writePretty(); write("-->"); if (isPretty()) writePretty(); levels.current().setInComment(false); }
/* (non-Javadoc) * @see org.eclipse.ohf.utilities.xml.IXMLWriter#comment(java.lang.String, boolean) */ @Override public void comment(String comment, boolean doPretty) throws IOException { checkStarted(); if (pendingClose) { write('>'); writePendingComment(); pendingClose = false; } if (doPretty) { writePretty(); if (isPretty()) { for (int i = 0; i < levels.size(); i++) write(" "); } } if (levels.inComment()) write("<!-- " + comment + " -- >"); else write("<!-- " + comment + " -->"); if (doPretty && !isPretty()) writePretty(); }