Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Sample program below:</p> <pre><code>import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Dom { public static void main( String[] args ) throws Throwable { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware( true ); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); Element root = doc.createElement( "root" ); root.setAttribute( "xmlns:m" , "http://www.lfinance.fr/blog-rachat-credits" ); root.setAttribute( "xmlns:rt", "http://www.lfinance.fr/forum-rachat-credits" ); doc.appendChild( root ); Element elt = doc.createElement( "simple" ); elt.setAttribute( "m:FC_TargetPath" , "false" ); elt.setAttribute( "m:FC_KeepInContent", "false" ); elt.setAttribute( "rt:filterable" , "false" ); root.appendChild( doc.createTextNode( "\n\t" )); root.appendChild( elt ); root.appendChild( doc.createTextNode( "\n" )); TransformerFactory.newInstance().newTransformer().transform( new DOMSource( doc ), new StreamResult( System.out )); } } </code></pre> <p>Output:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;root xmlns:m="http://www.lfinance.fr/blog-rachat-credits" xmlns:rt="http://www.lfinance.fr/forum-rachat-credits"&gt; &lt;simple m:FC_KeepInContent="false" m:FC_TargetPath="false" rt:filterable="false" /&gt; &lt;/root&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload