private void renderGroup(XMLWriter writer, HitGroup hit) { writer.openTag(GROUP); renderHitAttributes(writer, hit); writer.closeStartTag(); }
/** * XML escapes and writes the content.toString(). If the content is null this does nothing but closing the start tag. * * @param content the content - output by XML.xmlEscape(content.toString()) * @param multiline whether the content should be treated as multiline, * such that the following end tag should appear on a new line */ public XMLWriter content(Object content,boolean multiline) { closeStartTag(); return (content==null) ? this : escapedContent(XML.xmlEscape(content.toString(),false),multiline); }
/** * Writes an attribute by its utf8 value * * @param name the name of the attribute. An exception is thrown if this is null * @param value the value of the attribute. */ public XMLWriter attribute(Utf8String name, long value) { allowAttribute(); return w(SPACE).w(name).w(ATTRIBUTE_START).w(value).w(ATTRIBUTE_END); }
public boolean render(Writer writer) throws java.io.IOException { if (owner.getTraceLevel()!=0) { XMLWriter xmlWriter=XMLWriter.from(writer); xmlWriter.openTag("meta").attribute("type",ID); TraceNode traceRoot=owner.getModel().getExecution().trace().traceNode().root(); traceRoot.accept(new XmlRenderer.RenderingVisitor(xmlWriter, owner.getStartTime())); xmlWriter.closeTag(); } return true; }
private void header(XMLWriter writer, Result result) throws IOException { // TODO: move setting this to Result writer.xmlHeader(getRequestedEncoding(result.getQuery())); writer.openTag(RESULT).attribute(TOTAL_HIT_COUNT,String.valueOf(result.getTotalHitCount())); renderCoverageAttributes(result.getCoverage(false), writer); renderTime(writer, result); writer.closeStartTag(); }
private void renderSection(XMLWriter writer, HitGroup hit) { writer.openTag("section"); writer.attribute("id", hit.getDisplayId()); writer.attribute("layout", hit.getField("layout")); writer.attribute("region", hit.getField("region")); writer.attribute("placement", hit.getField("placement")); // deprecated in 5.0 writer.closeStartTag(); renderSectionContent(writer, hit); }
private void renderSingularHit(XMLWriter writer, Hit hit) { if ( ! hit.isMeta() && ! writer.isIn("content")) writer.openTag("content"); writer.openTag(HIT); renderHitAttributes(hit,writer); writer.closeStartTag(); renderField(writer, "id", hit.getId()); hit.forEachField((name, value) -> renderField(writer, name, value)); writer.closeTag(); }
protected static void renderCoverageAttributes(Coverage coverage, XMLWriter writer) throws IOException { if (coverage == null) return; writer.attribute(COVERAGE_DOCS,coverage.getDocs()); writer.attribute(COVERAGE_NODES,coverage.getNodes()); writer.attribute(COVERAGE_FULL,coverage.getFull()); writer.attribute(COVERAGE,coverage.getResultPercentage()); writer.attribute(RESULTS_FULL,coverage.getFullResultSets()); writer.attribute(RESULTS,coverage.getResultSets()); }
private void renderSectionContent(XMLWriter writer, HitGroup hit) { if (hit instanceof SectionHitGroup) { // render additional information SectionHitGroup sectionGroup = (SectionHitGroup)hit; for (Source source : sectionGroup.sources()) { writer.openTag("source").attribute("url", source.getUrl()); renderParameters(source.parameters(), writer); writer.closeTag(); } for (Renderer renderer : sectionGroup.renderers()) { writer.openTag("renderer").attribute("for", renderer.getRendererFor()).attribute("name", renderer.getName()); renderParameters(renderer.parameters(), writer); writer.closeTag(); } } }
private void writeCloseFieldElement(XMLWriter writer) { writer.closeTag(); }
@Override public void entering(TraceNode node) { if (node.isRoot()) return; writer.openTag(tag); }
/** * Writes an attribute by XML.xmlEscape(value.toString(),false) * * @param name the name of the attribute. An exception is thrown if this is null * @param value the value of the attribute. The empty string if the attribute is null or empty */ public XMLWriter forceAttribute(Utf8String name, Object value) { String stringValue = value!=null ? value.toString() : ""; allowAttribute(); return w(SPACE).w(name).w(ATTRIBUTE_START).wTranscode(XML.xmlEscape(stringValue,true)).w(ATTRIBUTE_END); }
/** * Writes the given string as-is. The content string <i>must</i> be XML escaped before calling this. * If the content is null this does nothing but closing the start tag. * * @param content the content - output by XML.xmlEscape(content.toString()) * @param multiline whether the content should be treated as multiline, * such that the following end tag should appear on a new line */ public XMLWriter escapedContent(String content,boolean multiline) { closeStartTag(); if (content==null) return this; if (multiline) currentIsMultiline=true; return wTranscode(content); }