public void startNode(String name) { startPointer = writer.getPointer(); quickNodeValue = false; lastTagHadAttributes = false; tagIsEmpty = false; finishTag(); if (depth != 0) writer.write(LF); writer.write( WikiTableDriver.DELIM + WikiTableDriver.QUOTES + WikiTableDriver.START_NODE + WikiTableDriver.QUOTES + WikiTableDriver.DELIM); if (this.useLineSeparateBetweenTags) { writer.write(LF + WikiTableDriver.DELIM); } writer.write(name + WikiTableDriver.DELIM); elementStack.push(name); tagInProgress = true; depth++; readyForNewLine = true; tagIsEmpty = true; }
/** * Adds attribute for XML node * * @param key - name of attribute * @param value - value of attribute */ public void addAttribute(String key, String value) { writer.write( LF + WikiTableDriver.DELIM + WikiTableDriver.QUOTES + WikiTableDriver.ADD_ATTRIBUTE + WikiTableDriver.QUOTES + WikiTableDriver.DELIM); if (this.useLineSeparateBetweenTags) { writer.write(LF + WikiTableDriver.DELIM); } writer.write(key + WikiTableDriver.DELIM); writeAttributeValue(writer, value); writer.write(WikiTableDriver.DELIM); lastTagHadAttributes = true; }
/** * Stores value of previously defined XML node * * @param text - value of node */ public void setValue(String text) { readyForNewLine = false; tagIsEmpty = false; finishTag(); if (lastTagHadAttributes) { writer.write( LF + WikiTableDriver.DELIM + WikiTableDriver.QUOTES + WikiTableDriver.SET_VALUE + WikiTableDriver.QUOTES + WikiTableDriver.DELIM); quickNodeValue = false; } else { String startTag = StringHelper.replace( writer.substring(startPointer), WikiTableDriver.START_NODE, WikiTableDriver.SET_NODE_VALUE); if (this.useLineSeparateBetweenTags) { writer.write(LF + WikiTableDriver.DELIM); } writer.setPointer(startPointer); writer.write(startTag); quickNodeValue = true; } writeText(writer, text); writer.write(WikiTableDriver.DELIM); }
/** Marks end of node */ public void endNode() { depth--; if (tagIsEmpty) { String prevTag = (String) elementStack.pop(); // Silently(); if (!quickNodeValue) { writer.write( LF + WikiTableDriver.DELIM + WikiTableDriver.QUOTES + WikiTableDriver.END_NODE + WikiTableDriver.QUOTES + WikiTableDriver.DELIM); if (this.useLineSeparateBetweenTags) { writer.write(LF + WikiTableDriver.DELIM); } writer.write(prevTag + WikiTableDriver.DELIM); } readyForNewLine = false; } else { String prevTag = (String) elementStack.pop(); if (!quickNodeValue) { writer.write( LF + WikiTableDriver.DELIM + WikiTableDriver.QUOTES + WikiTableDriver.END_NODE + WikiTableDriver.QUOTES + WikiTableDriver.DELIM); if (this.useLineSeparateBetweenTags) { writer.write(LF + WikiTableDriver.DELIM); } writer.write(prevTag + WikiTableDriver.DELIM); } } finishTag(); readyForNewLine = true; if (depth == 0) { writer.flush(); } quickNodeValue = false; }
private void endOfLine() { writer.write(LF); for (int i = 0; i < depth; i++) { writer.write(lineIndenter); } }
/** Closes output */ public void close() { writer.close(); }
/** Flushes output */ public void flush() { writer.flush(); }