@Override public void process(final Writer out, final Format format, final Document doc) throws IOException { printDocument(out, new FormatStack(format), new NamespaceStack(), doc); out.flush(); }
/** * Inspect the current scope and return true if the specified namespace is * in scope. * @param ns The Namespace to check * @return true if the current scope contains that Namespace. */ public boolean isInScope(Namespace ns) { if (ns == scope[depth][0]) { return true; } final int ip = binarySearch(scope[depth], 1, scope[depth].length, ns); if (ip >= 0) { // we have the same prefix. return ns == scope[depth][ip]; } return false; }
/** * Create a new in-scope level for the Stack based on an Attribute. * * @param att The attribute to contribute to the namespace scope. */ public void push(Attribute att) { final List<Namespace> toadd = new ArrayList<Namespace>(1); final Namespace mns = att.getNamespace(); // check to see whether the Namespace is new-to-scope. Namespace[] newscope = checkNamespace(toadd, mns, scope[depth]); pushStack(mns, newscope, toadd); }
final Element element) { nstack.push(element); try { element.getNamespaceURI(), element.getQualifiedName()); for (Namespace ns : nstack.addedForward()) { if (ns == Namespace.XML_NAMESPACE) { continue; nstack.pop();
final Element element) throws XMLStreamException { nstack.push(element); try { out.add(eventfactory.createStartElement("", "", element.getName(), new AttIterator(ait, eventfactory, fstack.isSpecifiedAttributesOnly()), new NSIterator(nstack.addedForward().iterator(), eventfactory))); } else if ("".equals(ns.getPrefix())) { out.add(eventfactory.createStartElement("", ns.getURI(), element.getName(), new AttIterator(ait, eventfactory, fstack.isSpecifiedAttributesOnly()), new NSIterator(nstack.addedForward().iterator(), eventfactory))); } else { out.add(eventfactory.createStartElement(ns.getPrefix(), ns.getURI(), element.getName(), new AttIterator(ait, eventfactory, fstack.isSpecifiedAttributesOnly()), new NSIterator(nstack.addedForward().iterator(), eventfactory))); new NSIterator(nstack.addedReverse().iterator(), eventfactory))); nstack.pop();
final NamespaceStack nstack, final Element element) throws XMLStreamException { nstack.push(element); try { for (final Namespace nsd : nstack.addedForward()) { printNamespace(out, fstack, nsd); for (final Namespace nsd : nstack.addedForward()) { printNamespace(out, fstack, nsd); nstack.pop();
nstack.push(element); try { for (Namespace ns : nstack.addedForward()) { ch.startPrefixMapping(ns.getPrefix(), ns.getURI()); if (out.isDeclareNamespaces()) { for (Namespace ns : nstack.addedReverse()) { ch.endPrefixMapping(ns.getPrefix()); nstack.pop(); out.getLocator().setNode(origloc);
final NamespaceStack nstack, final Element element) throws IOException { nstack.push(element); try { final List<Content> content = element.getContent(); for (final Namespace ns : nstack.addedForward()) { printNamespace(out, fstack, ns); nstack.pop();
@Override public void process(final XMLStreamWriter out, final Format format, final Document doc) throws XMLStreamException { printDocument(out, new FormatStack(format), new NamespaceStack(), doc); out.flush(); }
final Namespace mns = element.getNamespace(); Namespace[] newscope = checkNamespace(toadd, mns, scope[depth]); if (element.hasAdditionalNamespaces()) { for (final Namespace ns : element.getAdditionalNamespaces()) { newscope = checkNamespace(toadd, ns, newscope); newscope = checkNamespace(toadd, ns, newscope); pushStack(mns, newscope, toadd);
int ip = - binarySearch(newscope, 1, newscope.length, tmp) - 1; newscope[ip] = tmp; ip = binarySearch(newscope, 0, newscope.length, mns);
final NamespaceStack nstack, final Element element) throws IOException { nstack.push(element); try { final List<Content> content = element.getContent(); for (final Namespace ns : nstack.addedForward()) { definedNamespaces.add(ns); || nstack.addedForward().iterator().hasNext(); for (final Attribute attribute : element.getAttributes()) { printAttribute(out, fstack, attribute, printMultiLine); nstack.pop();
@Override public void process(final Writer out, final Format format, final Element element) throws IOException { // If this is the root element we could pre-initialize the // namespace stack with the namespaces printElement(out, new FormatStack(format), new NamespaceStack(), element); out.flush(); }
int ip = binarySearch(scope, 1, scope.length, namespace); if (ip >= 0 && namespace == scope[ip]) {
@Override protected void printElement( Writer out, FormatStack fstack, NamespaceStack nstack, Element element ) throws IOException { nstack.push( element ); try { final List<Content> content = element.getContent(); write( out, "<" ); write( out, element.getQualifiedName() ); for ( final Namespace ns : nstack.addedForward() ) { printNamespace( out, fstack, ns ); nstack.pop();
@Override public void process(final XMLStreamWriter out, final Format format, final Element element) throws XMLStreamException { // If this is the root element we could pre-initialize the // namespace stack with the namespaces printElement(out, new FormatStack(format), new NamespaceStack(), element); out.flush(); }
@Override public void process(final XMLEventConsumer out, final Format format, final XMLEventFactory eventfactory, final Element element) throws XMLStreamException { // If this is the root element we could pre-initialize the // namespace stack with the namespaces printElement(out, new FormatStack(format), new NamespaceStack(), eventfactory, element); }
@Override public void process(final XMLStreamWriter out, final Format format, final List<? extends Content> list) throws XMLStreamException { final FormatStack fstack = new FormatStack(format); final Walker walker = buildWalker(fstack, list, false); printContent(out, fstack, new NamespaceStack(), walker); out.flush(); }
@Override public void process(final XMLEventConsumer out, final Format format, final XMLEventFactory eventfactory, final Document doc) throws XMLStreamException { printDocument(out, new FormatStack(format), new NamespaceStack(), eventfactory, doc); }
@Override public org.w3c.dom.Document process(org.w3c.dom.Document basedoc, Format format, Document doc) { return printDocument(new FormatStack(format), new NamespaceStack(), basedoc, doc); }