incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cory Zue <c...@dimagi.com>
Subject Re: Problems inserting XML document into CouchDB 0.10.2 on CentOS 5.4
Date Mon, 05 Jul 2010 15:51:53 GMT
I also had to store xml documents in couch, and I accomplished this by
modifying an xml to json library to support e4x (the xml parser that
comes with couch) and using an update handler.

I thought you might find it useful:  http://gist.github.com/464483

Cory

On Sun, Jul 4, 2010 at 4:49 AM, Nils Breunese <N.Breunese@vpro.nl> wrote:
> == XML ==
>
> Remember that CouchDB uses JSON for documents. I think you have three options here:
>
> 1. Convert XML to a JSON document
>
> Instead of storing the XML you mentioned you could maybe transform your XML into JSON
(not always easy, as attributes and subelements can clash, the other way around is easier):
>
> ----
> {
>  "type": "note",
>  "to": "Tove",
>  "from": "Jani",
>  "heading": "Reminder",
>  "body": "Don't forget me this weekend!"
> }
> ----
>
> 2. Store the XML as a string field
>
> I believe this is what you were trying to do. Surround the XML with quotes and escape
any quotes in the XML. I believe most XML libraries have a function to output XML as a string
with all escaping done automatically.
>
> {
>  "XML": "<note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't
forget me this weekend!</body></note>"
> }
>
> 3. Store the XML as an attachment
>
> You can store arbitrary files as attachments to CouchDB documents.
>
> I'd go route 1, as that will allow you to make use of CouchDB's indexing features, etc.
If you just want to store the data, all three options will work.
>
> == curl >=7.18 and RHEL/CentOS ==
>
> About the curl >=7.18 dependency, I don't know why 7.18 exactly, but I'm sure the
dependency version hasn't been changed for no reason. People have built CouchDB 0.11 on RHEL/CentOS
5, but yes, you'll need to install a separate curl >=7.18 build. You could just install
curl from source. Or you could package curl >= 7.18 for installation in a location where
it doesn't clash with the OS curl package and build CouchDB to find curl >=7.18 there,
or maybe include curl >=7.18 in the CouchDB package itself and make it a selfcontained
package. It's not impossible, it's just more work than when you're able to use the vendor's
curl package.
>
> Nils.
> ________________________________________
> Van: Himmelein, Ralf [Ralf.Himmelein@softwareag.com]
> Verzonden: dinsdag 29 juni 2010 19:36
> Aan: user@couchdb.apache.org
> Onderwerp: Problems inserting XML document into CouchDB 0.10.2 on CentOS 5.4
>
> Hello CouchDB experts,
> I am using CouchDB at the moment for a potential large scale implementation. I am faced
with the problem that I can't
> insert a simple XML document into my CouchDB via the Futon interface.
> The CouchDB is version 0.10.2 installed on CentOS. The error message that I get on the
UI is that the data I insert is not
> a string.
>
> The document I try to insert looks like this:
>
> <note>
> <to>Tove</to>
> <from>Jani</from>
> <heading>Reminder</heading>
> <body>Don't forget me this weekend!</body>
> </note>
>
> If I mask the the data with "" I can insert the data, but since I plan to insert XML
documents I can have "" everywhere.
> At the moment this is a show stopper and I wonder if there is a special way or procedure
on how to store XML data within CouchDB.
>
> The second question I have is, why is CouchDB 0.11 depended on curl 7.18? This fact makes
building the new CouchDB version impossible
> without breaking a lot of things within the CentOS (RHEL 5). Has anyone eventually produced
a how to for CentOS on how to build CouchDB 0.11
> for CentOS?
>
> Thanks in advance,
> Ralf Himmelein
>
> De informatie vervat in deze  e-mail en meegezonden bijlagen is uitsluitend bedoeld
voor gebruik door de geadresseerde en kan vertrouwelijke informatie bevatten. Openbaarmaking,
vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is voorbehouden
aan geadresseerde. De VPRO staat niet in voor de juiste en volledige overbrenging van de inhoud
van een verzonden e-mail, noch voor tijdige ontvangst daarvan.
>

Mime
View raw message