List of usage examples for org.dom4j Namespace NO_NAMESPACE
Namespace NO_NAMESPACE
To view the source code for org.dom4j Namespace NO_NAMESPACE.
Click Source Link
From source file:architecture.common.xml.XmlWriter.java
License:Apache License
public XmlWriter(Writer writer, OutputFormat format) { this.writer = writer; this.format = format; namespaceStack.push(Namespace.NO_NAMESPACE); }
From source file:architecture.common.xml.XmlWriter.java
License:Apache License
public XmlWriter() throws UnsupportedEncodingException { this.format = DEFAULT_FORMAT; this.writer = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8")); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
From source file:architecture.common.xml.XmlWriter.java
License:Apache License
public XmlWriter(OutputStream out) throws UnsupportedEncodingException { this.format = DEFAULT_FORMAT; this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
From source file:architecture.common.xml.XmlWriter.java
License:Apache License
public XmlWriter(OutputStream out, OutputFormat format) throws UnsupportedEncodingException { this.format = format; this.writer = createWriter(out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
From source file:architecture.common.xml.XmlWriter.java
License:Apache License
public XmlWriter(OutputFormat format) throws UnsupportedEncodingException { this.format = format; this.writer = createWriter(System.out, format.getEncoding()); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
From source file:architecture.common.xml.XmlWriter.java
License:Apache License
/** * Writes the attributes of the given element * *///from ww w .j a va2 s .c o m protected void writeAttributes(Element element) throws IOException { // I do not yet handle the case where the same prefix maps to // two different URIs. For attributes on the same element // this is illegal; but as yet we don't throw an exception // if someone tries to do this for (int i = 0, size = element.attributeCount(); i < size; i++) { Attribute attribute = element.attribute(i); Namespace ns = attribute.getNamespace(); if (ns != null && ns != Namespace.NO_NAMESPACE && ns != Namespace.XML_NAMESPACE) { String prefix = ns.getPrefix(); String uri = namespaceStack.getURI(prefix); if (!ns.getURI().equals(uri)) { // output a new namespace // declaration writeNamespace(ns); namespaceStack.push(ns); } } // If the attribute is a namespace declaration, check if we have // already // written that declaration elsewhere (if that's the case, it must // be // in the namespace stack String attName = attribute.getName(); if (attName.startsWith("xmlns:")) { String prefix = attName.substring(6); if (namespaceStack.getNamespaceForPrefix(prefix) == null) { String uri = attribute.getValue(); namespaceStack.push(prefix, uri); writeNamespace(prefix, uri); } } else if (attName.equals("xmlns")) { if (namespaceStack.getDefaultNamespace() == null) { String uri = attribute.getValue(); namespaceStack.push(null, uri); writeNamespace(null, uri); } } else { char quote = format.getAttributeQuoteCharacter(); writer.write(" "); writer.write(attribute.getQualifiedName()); writer.write("="); writer.write(quote); writeEscapeAttributeEntities(attribute.getValue()); writer.write(quote); } } }
From source file:architecture.ee.util.xml.XmlWriter.java
License:Apache License
public XmlWriter() throws UnsupportedEncodingException { this.format = DEFAULT_FORMAT; this.writer = new BufferedWriter(new OutputStreamWriter(System.out, StandardCharsets.UTF_8)); this.autoFlush = true; namespaceStack.push(Namespace.NO_NAMESPACE); }
From source file:architecture.ee.util.xml.XmlWriter.java
License:Apache License
/** Writes the attributes of the given element */*from w ww . j av a2s. co m*/ */ protected void writeAttributes(Element element) throws IOException { // I do not yet handle the case where the same prefix maps to // two different URIs. For attributes on the same element // this is illegal; but as yet we don't throw an exception // if someone tries to do this for (int i = 0, size = element.attributeCount(); i < size; i++) { Attribute attribute = element.attribute(i); Namespace ns = attribute.getNamespace(); if (ns != null && ns != Namespace.NO_NAMESPACE && ns != Namespace.XML_NAMESPACE) { String prefix = ns.getPrefix(); String uri = namespaceStack.getURI(prefix); if (!ns.getURI().equals(uri)) { // output a new namespace declaration writeNamespace(ns); namespaceStack.push(ns); } } // If the attribute is a namespace declaration, check if we have already // written that declaration elsewhere (if that's the case, it must be // in the namespace stack String attName = attribute.getName(); if (attName.startsWith("xmlns:")) { String prefix = attName.substring(6); if (namespaceStack.getNamespaceForPrefix(prefix) == null) { String uri = attribute.getValue(); namespaceStack.push(prefix, uri); writeNamespace(prefix, uri); } } else if (attName.equals("xmlns")) { if (namespaceStack.getDefaultNamespace() == null) { String uri = attribute.getValue(); namespaceStack.push(null, uri); writeNamespace(null, uri); } } else { char quote = format.getAttributeQuoteCharacter(); writer.write(" "); writer.write(attribute.getQualifiedName()); writer.write("="); writer.write(quote); writeEscapeAttributeEntities(attribute.getValue()); writer.write(quote); } } }
From source file:com.cladonia.xml.ExchangerXMLWriter.java
License:Open Source License
public ExchangerXMLWriter(OutputStream out, ExchangerOutputFormat format) throws UnsupportedEncodingException { super(out, format); namespaceStack.push(Namespace.NO_NAMESPACE); this.format = format; format.setNewlines(true);/*w ww . ja va 2s.co m*/ format.setIndent(""); }
From source file:com.cladonia.xml.ExchangerXMLWriter.java
License:Open Source License
public ExchangerXMLWriter(ExchangerOutputFormat format) throws UnsupportedEncodingException { super(format); namespaceStack.push(Namespace.NO_NAMESPACE); this.format = format; format.setNewlines(true);/*from ww w.ja va 2 s. com*/ format.setIndent(""); }