List of usage examples for org.jdom2 Element addNamespaceDeclaration
public boolean addNamespaceDeclaration(final Namespace additionalNamespace)
From source file:com.rometools.rome.io.impl.RSS091UserlandGenerator.java
License:Open Source License
@Override protected Element createRootElement(final Channel channel) { final Element root = new Element("rss", getFeedNamespace()); final Attribute version = new Attribute("version", getVersion()); root.setAttribute(version);// ww w.j av a 2 s . c o m root.addNamespaceDeclaration(getContentNamespace()); generateModuleNamespaceDefs(root); return root; }
From source file:com.sun.syndication.io.impl.Atom03Generator.java
License:Open Source License
protected Element createRootElement(Feed feed) { Element root = new Element("feed", getFeedNamespace()); root.addNamespaceDeclaration(getFeedNamespace()); Attribute version = new Attribute("version", getVersion()); root.setAttribute(version);//from ww w . j a va 2 s . c o m generateModuleNamespaceDefs(root); return root; }
From source file:com.sun.syndication.io.impl.Atom10Generator.java
License:Open Source License
protected Element createRootElement(Feed feed) { Element root = new Element("feed", getFeedNamespace()); root.addNamespaceDeclaration(getFeedNamespace()); //Attribute version = new Attribute("version", getVersion()); //root.setAttribute(version); if (feed.getXmlBase() != null) { root.setAttribute("base", feed.getXmlBase(), Namespace.XML_NAMESPACE); }//from w w w . ja v a 2 s. c om generateModuleNamespaceDefs(root); return root; }
From source file:com.sun.syndication.io.impl.RSS090Generator.java
License:Open Source License
protected Element createRootElement(Channel channel) { Element root = new Element("RDF", getRDFNamespace()); root.addNamespaceDeclaration(getFeedNamespace()); root.addNamespaceDeclaration(getRDFNamespace()); root.addNamespaceDeclaration(getContentNamespace()); generateModuleNamespaceDefs(root);//from w w w . j a v a 2 s. c o m return root; }
From source file:com.sun.syndication.io.impl.RSS091UserlandGenerator.java
License:Open Source License
protected Element createRootElement(Channel channel) { Element root = new Element("rss", getFeedNamespace()); Attribute version = new Attribute("version", getVersion()); root.setAttribute(version);/*from w w w . j av a 2s .c o m*/ root.addNamespaceDeclaration(getContentNamespace()); generateModuleNamespaceDefs(root); return root; }
From source file:com.tactfactory.harmony.generator.androidxml.AttrsFile.java
License:Open Source License
@Override protected Element getDefaultRoot() { Element rootElement = new Element(ELEMENT_ROOT); rootElement.addNamespaceDeclaration( Namespace.getNamespace("android", "http://schemas.android.com/apk/res/android")); return rootElement; }
From source file:com.tactfactory.harmony.generator.androidxml.ManifestUpdater.java
License:Open Source License
@Override protected Element getDefaultRoot() { Namespace androidNs = Namespace.getNamespace("android", "http://schemas.android.com/apk/res/android"); Element rootElement = new Element("manifest"); rootElement.addNamespaceDeclaration(androidNs); rootElement.setAttribute("package", ApplicationMetadata.INSTANCE.getProjectNameSpace()); rootElement.setAttribute("versionCode", "1", androidNs); rootElement.setAttribute("versionName", "@string/app_version", androidNs); return rootElement; }
From source file:com.thoughtworks.go.config.MagicalGoConfigXmlWriter.java
License:Apache License
private Document createEmptyCruiseConfigDocument() { Element root = new Element("cruise"); Namespace xsiNamespace = Namespace.getNamespace("xsi", XML_NS); root.addNamespaceDeclaration(xsiNamespace); registry.registerNamespacesInto(root); root.setAttribute("noNamespaceSchemaLocation", "cruise-config.xsd", xsiNamespace); String xsds = registry.xsds(); if (!xsds.isEmpty()) { root.setAttribute("schemaLocation", xsds, xsiNamespace); }/*w w w. j av a2s.c om*/ root.setAttribute("schemaVersion", Integer.toString(GoConstants.CONFIG_SCHEMA_VERSION)); return new Document(root); }
From source file:com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry.java
License:Apache License
public void registerNamespacesInto(Element element) { for (PluginNamespace namespace : xsdsFor.values()) { element.addNamespaceDeclaration(Namespace.getNamespace(namespace.prefix, namespace.uri)); }//w ww . jav a 2 s . co m }
From source file:cz.pecina.retro.memory.Snapshot.java
License:Open Source License
/** * Writes a hardware shapshot to a file. * * @param file output file//from w ww .j a v a2 s . co m */ public void write(final File file) { log.fine("Writing snapshot to a file, file: " + file.getName()); final Element snapshot = new Element("snapshot"); final Namespace namespace = Namespace.getNamespace("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI); snapshot.addNamespaceDeclaration(namespace); snapshot.setAttribute("noNamespaceSchemaLocation", Application.XSD_PREFIX + "snapshot-" + SNAPSHOT_XML_FILE_VERSION + ".xsd", namespace); snapshot.setAttribute("version", SNAPSHOT_XML_FILE_VERSION); hardware.marshal(snapshot); final Document doc = new Document(snapshot); try (final PrintWriter writer = new PrintWriter(file)) { new XMLOutputter(Format.getPrettyFormat()).output(doc, writer); } catch (final Exception exception) { log.fine("Error, writing failed, exception: " + exception.getMessage()); throw Application.createError(this, "XMLWrite"); } log.fine("Writing completed"); }