abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edwin Shin <ed...@fedora-commons.org>
Subject preserving the contents of atom:content
Date Fri, 25 Apr 2008 05:40:42 GMT
Hello all,

I'd like to be able to set the content of an entry and get exactly the 
same thing back out. One case I have in mind is checksumming what goes 
in and out.

For example, take the following:

	String content = "<doc/>";
         Abdera abdera = Abdera.getInstance();
         Entry entry = abdera.newEntry();
         entry.setContent(content, Content.Type.XML);
         entry.writeTo("prettyxml", System.out);

Although "<doc/>" went in, "<doc></doc>" came out. Additionally, in the

serialization, an empty namespace declaration was added.

For the former case, I'm not sure what the right solution is (although 
even if we're not worried about preserving *how* elements were written 
out, I'd prefer empty elements to be written out in the compact form by 
default--I fooled around with a custom writer but didn't get this working).

For the latter, it seems just being able to define a namespace-prefix 
mapping for Atom would do the trick, but I don't see how to do that. 
Presumably, then my output could be:
	<?xml version="1.0" encoding="UTF-8"?>
	<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
   		<atom:content type="application/xml">

Element.declareNS("http://www.w3.org/2005/Atom", "atom") only adds 
another namespace declaration. Element.getNamespaces() returns an 
unmodifiable Map, so no go that way either.

FYI, this is with 0.4.0.


View raw message