private Element top() { return (Element)getCurrent(); } }
public void addAttribute(final String name, final String value) { top().setAttribute(encodeAttribute(name), value); }
protected Object createNode(final String name) { final Element child = document.createElement(encodeNode(name)); final Element top = top(); if (top != null) { top().appendChild(child); } else if (!hasRootElement) { document.appendChild(child); hasRootElement = true; } return child; }
public void setValue(final String text) { top().appendChild(document.createTextNode(text)); }
protected Object createNode(final String name) { final Element child = document.createElement(escapeXmlName(name)); final Element top = top(); if (top != null) { top().appendChild(child); } else if (!hasRootElement) { document.appendChild(child); hasRootElement = true; } return child; }
@Override protected void marshalDomNode(Object graph, Node node) throws XmlMappingException { HierarchicalStreamWriter streamWriter; if (node instanceof Document) { streamWriter = new DomWriter((Document) node, this.nameCoder); } else if (node instanceof Element) { streamWriter = new DomWriter((Element) node, node.getOwnerDocument(), this.nameCoder); } else { throw new IllegalArgumentException("DOMResult contains neither Document nor Element"); } doMarshal(graph, streamWriter, null); }
@Override public void setValue(final String text) { top().appendChild(document.createTextNode(text)); }
public void addAttribute(final String name, final String value) { top().setAttribute(escapeXmlName(name), value); }
protected void marshalDomNode(Object graph, Node node) throws XmlMappingException { HierarchicalStreamWriter streamWriter; if (node instanceof Document) { streamWriter = new DomWriter((Document) node); } else if (node instanceof Element) { streamWriter = new DomWriter((Element) node, node.getOwnerDocument(), new XmlFriendlyReplacer()); } else { throw new IllegalArgumentException("DOMResult contains neither Document nor Element"); } marshal(graph, streamWriter); }
@Override public void addAttribute(final String name, final String value) { top().setAttribute(encodeAttribute(name), value); }
@Override protected Element createNode(final String name) { final Element child = document.createElement(encodeNode(name)); final Element top = top(); if (top != null) { top().appendChild(child); } else if (!hasRootElement) { document.appendChild(child); hasRootElement = true; } return child; }
private Element top() { return getCurrent(); } }
public void setValue(final String text) { top().appendChild(document.createTextNode(text)); }
public void addAttribute(final String name, final String value) { top().setAttribute(escapeXmlName(name), value); }
private static Element storeGBeans(List gbeans) throws IOException { GBeanData[] gbeanDatas = (GBeanData[]) gbeans.toArray(new GBeanData[gbeans.size()]); DocumentBuilderFactory documentBuilderFactory = XmlUtil.newDocumentBuilderFactory(); DocumentBuilder documentBuilder = null; try { documentBuilder = documentBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw (IOException)new IOException("Cannot instantiate " + Document.class.getName()).initCause(e); } Document document = documentBuilder.newDocument(); DomWriter writer = new DomWriter(document); XStream xstream = XStreamUtil.createXStream(); xstream.marshal(gbeanDatas, writer); // FileWriter w = new FileWriter("target/foo.xml"); // xstream.toXML(gbeanDatas, w); // w.close(); return document.getDocumentElement(); } }
public void addAttribute(final String name, final String value) { top().setAttribute(encodeAttribute(name), value); }
protected Object createNode(final String name) { final Element child = document.createElement(encodeNode(name)); final Element top = top(); if (top != null) { top().appendChild(child); } else if (!hasRootElement) { document.appendChild(child); hasRootElement = true; } return child; }
private Element top() { return (Element)getCurrent(); } }
public void setValue(final String text) { top().appendChild(document.createTextNode(text)); }
protected Object createNode(final String name) { final Element child = document.createElement(escapeXmlName(name)); final Element top = top(); if (top != null) { top().appendChild(child); } else if (!hasRootElement) { document.appendChild(child); hasRootElement = true; } return child; }