public int writePretty(boolean eoln) throws IOException { if (isPretty()) { if (eoln) write(lineType == LINE_UNIX ? "\n" : "\r\n"); for (int i = 0; i < levels.size() - 1; i++) write(" "); return (levels.size() - 1) * 2; } else return 0; }
protected XMLNamespace findDefaultNamespace() { for (int i = levels.size() - 1; i >= 0; i--) { XMLNamespace ns = levels.item(i).getDefaultNamespace(); if (ns != null) return ns; } return null; }
/* (non-Javadoc) * @see org.eclipse.ohf.utilities.xml.IXMLWriter#findByAbbreviation(java.lang.String) */ public XMLNamespace findByAbbreviation(String abbreviation) { for (int i = levels.size() - 1; i >= 0; i--) { XMLNamespace ns = levels.item(i).getDefnByAbbreviation(abbreviation); if (ns != null) return ns; } return null; }
/* (non-Javadoc) * @see org.eclipse.ohf.utilities.xml.IXMLWriter#findByNamespace(java.lang.String) */ public XMLNamespace findByNamespace(String namespace) { for (int i = levels.size() - 1; i >= 0; i--) { XMLNamespace ns = levels.item(i).getDefnByNamespace(namespace); if (ns != null) return ns; } return null; }
/* (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(); }
/* (non-Javadoc) * @see org.eclipse.ohf.utilities.xml.IXMLWriter#closeToLevel(int) */ @Override public void closeToLevel(int count) throws IOException { while (levels.size() > count) close(); }