Skip to content

writer.writeOpen(x) doesn't write namespaces #39

@borissmidt

Description

@borissmidt

When i create an element with namespaces it will not write out the namespaces.

def writeDocument(writer: XMLWriter) 
  val rss = doc.addElement("rss")
     .addNamespace("g", "http://base.google.com/ns/1.0")
     .addNamespace("c", "http://base.google.com/cns/1.0")
   writer.writeOpen(rss)  // => doesn't work <rss>
   writer.write(rss) // => works <rss xmlns:c="http://base.google.com/ns/1.0" ... >

A normal write also writes out the namespaces

However when i write it using attributes it writes out the tag with namespaces.

def writeDocument(writer: XMLWriter) 
  val rss = XML.createElement("rss")
     .addAttribute("xmlns:g", "http://base.google.com/ns/1.0")
     .addAttribute("xmlns:c", "http://base.google.com/cns/1.0")
 writer.writeOpen(rss) // => works <rss xmlns:c="http://base.google.com/ns/1.0" ... >

btw it is scala code but that shouldn't matter.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions