Refine search
/** * @since 1.4 */ public JDomWriter(final Element container, final NameCoder nameCoder) { this(container, new DefaultJDOMFactory(), nameCoder); }
Iterator elIt = parent.getChildren(childTag, parent.getNamespace()).iterator(); if (!elIt.hasNext()) elIt = null; Counter innerCount = new Counter(counter.getDepth() + 1); if (! elIt.hasNext()) elIt = null; } else { el = factory.element(childTag, parent.getNamespace()); insertAtPreferredLocation(parent, el, innerCount);
Element element = parent.getChild(name, parent.getNamespace()); if (element != null && shouldExist) { counter.increaseCount(); element = factory.element(name, parent.getNamespace()); insertAtPreferredLocation(parent, element, counter); counter.increaseCount();
Iterator it = parent.getContent().iterator(); Text lastText = null; int offset = 0; starter = starter + " "; //TODO make settable? lastText = factory.text(starter); if (parent.getContentSize() == 0) { Text finalText = (Text)lastText.clone(); finalText.setText(finalText.getText().substring(0, finalText.getText().length() - " ".length())); parent.addContent(contentIndex, finalText); parent.addContent(contentIndex, child);
if (shouldExist) { Iterator it = list.iterator(); Iterator elIt = element.getChildren(childName, element.getNamespace()).iterator(); if (! elIt.hasNext()) elIt = null; Counter innerCount = new Counter(counter.getDepth() + 1); if (! elIt.hasNext()) elIt = null; } else { el = factory.element(childName, element.getNamespace()); insertAtPreferredLocation(element, el, innerCount);
/** * @param name The name of the point. * @param p Point to represent. * * @return An XML representation of the specified Point2D */ public static Element pointToXML(String name, Point2D p) { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element(name); Element x = f.element("x"); Element y = f.element("y"); int xval = (int) Math.round(p.getX()); int yval = (int) Math.round(p.getY()); x.addContent(f.text(Integer.toString(xval))); y.addContent(f.text(Integer.toString(yval))); ret.addContent(x); ret.addContent(y); return ret; } }
/** @return an XML representation of this element. */ public Element produceXML() { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element("straightLine"); ret.addContent(XMLUtility.pointToXML("start", getP1())); ret.addContent(XMLUtility.pointToXML("end", getP2())); return ret; }
/** @return An XML Document containing the state of this template. */ @SuppressWarnings({"WeakerAccess"}) public Document produceXML() { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element("template"); for (TemplateItem templateItem : templateItems) { ret.addContent((templateItem).produceXML()); } return f.document(ret); }
/** * {@inheritDoc} */ @Override public Element element(String name) { DescriptorTag tag = getTagByName(name); if (tag != null) { try { return tag.create(); } catch (Exception ignored) { // Ignored } } return super.element(name); }
if (shouldExist) { Iterator it = list.iterator(); Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator(); if (!elIt.hasNext()) elIt = null; Counter innerCount = new Counter(counter.getDepth() + 1); if (! elIt.hasNext()) elIt = null; } else { el = factory.element(childTag, element.getNamespace()); insertAtPreferredLocation(element, el, innerCount);
Element element = parent.getChild(name, parent.getNamespace()); if (element != null && shouldExist) { counter.increaseCount(); element = factory.element(name, parent.getNamespace()); insertAtPreferredLocation(parent, element, counter); counter.increaseCount();
Iterator it = parent.getContent().iterator(); Text lastText = null; int offset = 0; starter = starter + " "; //TODO make settable? lastText = factory.text(starter); if (parent.getContentSize() == 0) { Text finalText = (Text)lastText.clone(); finalText.setText(finalText.getText().substring(0, finalText.getText().length() - " ".length())); parent.addContent(contentIndex, finalText); parent.addContent(contentIndex, child);
if (shouldExist) { Iterator it = list.iterator(); Iterator elIt = element.getChildren(childName, element.getNamespace()).iterator(); if (! elIt.hasNext()) elIt = null; Counter innerCount = new Counter(counter.getDepth() + 1); if (! elIt.hasNext()) elIt = null; } else { el = factory.element(childName, element.getNamespace()); insertAtPreferredLocation(element, el, innerCount);
public EndpointReference createDefaultEPR() { DefaultJDOMFactory factory = new DefaultJDOMFactory(); Element eprElem = factory.element("EPR", getNamespace()); Element addressElem = factory.element(WSA_ADDRESS, getNamespace()); addressElem.addContent(factory.text(getAnonymousUri())); eprElem.addContent(addressElem); return createEPR(eprElem); }
/** {@inheritDoc} */ @Override public Element produceXML() { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element("straightLine"); ret.addContent(XMLUtility.pointToXML("start", getP1())); ret.addContent(XMLUtility.pointToXML("end", getP2())); return ret; } }
/** * {@inheritDoc} */ @Override public Element element(String name) { DescriptorTag tag = getTagByName(name); if (tag != null) { try { return tag.create(); } catch (Exception ignored) { // Ignored } } return super.element(name); }
if (shouldExist) { Iterator it = list.iterator(); Iterator elIt = element.getChildren(childTag, element.getNamespace()).iterator(); if (!elIt.hasNext()) elIt = null; Counter innerCount = new Counter(counter.getDepth() + 1); if (! elIt.hasNext()) elIt = null; } else { el = factory.element(childTag, element.getNamespace()); insertAtPreferredLocation(element, el, innerCount);
Element element = parent.getChild(name, parent.getNamespace()); if (element != null && shouldExist) { counter.increaseCount(); element = factory.element(name, parent.getNamespace()); insertAtPreferredLocation(parent, element, counter); counter.increaseCount();
Iterator it = parent.getContent().iterator(); Text lastText = null; int offset = 0; lastText = factory.text(starter.toString()); if (parent.getContentSize() == 0) parent.addContent(contentIndex, finalText); parent.addContent(contentIndex, child);
/** * @param name The name of the color. * @param c A color to represent. * * @return An XML representation of the color with the specified element * name */ public static Element colorToXML(String name, Color c) { DefaultJDOMFactory f = new DefaultJDOMFactory(); Element ret = f.element(name); String colorName = TemplateColor.nameFor(c); if (colorName != null) { Element which = f.element("which"); which.addContent(f.text(colorName)); ret.addContent(which); } else { Element red = f.element("r"); Element green = f.element("g"); Element blue = f.element("b"); red.addContent(f.text(Integer.toString(c.getRed()))); green.addContent(f.text(Integer.toString(c.getGreen()))); blue.addContent(f.text(Integer.toString(c.getBlue()))); ret.addContent(red); ret.addContent(green); ret.addContent(blue); } return ret; }