You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Kevin Ross <Ke...@iVerticalLeap.com> on 2003/06/11 20:37:07 UTC
RE: Setting Id attribute with XIndice's auto-generated ID
I do it a little differently using my own id generator, where I specify
the documentId, and the documentId is also set as the content's @id.
XMLResource xmlResource =
(XMLResource)collection.createResource(documentId,
XMLResource.RESOURCE_TYPE);
// now store the document
xmlResource.setContentAsDOM(content.getNode());
collection.storeResource(xmlResource);
For your particular case, you might try something like this, but I'm not
sure it works:
XMLResource xmlResource =
(XMLResource)collection.createResource(XMLResource.RESOURCE_TYPE);
// set the id generated from xindice on the doc
// pseudo code: content.setAttribute("id", xmlResource.getDocumentId())
// now store the document
xmlResource.setContentAsDOM(content.getNode());
collection.storeResource(xmlResource);
-Kevin Ross
-----Original Message-----
From: António Santos [mailto:ansantos@fe.up.pt]
Sent: Wednesday, June 11, 2003 1:04 PM
To: xindice-users@xml.apache.org
Subject: Setting Id attribute with XIndice's auto-generated ID
Hi all,
A few days ago I posted here a question on how to set an element's
attribute
as an index with the auto-generated IDs. Since noone replied, I'm now
reformulating the question.
All my XML documents have an Id attribute in the root element. When I
send one
of these XML documents to XIndice (to store it), that Id attribute is
still
empty and I want XIndice to fill that attribute automatically with the
auto-generated ID, and then store the document. Is that possible? If so,
how
can I do that? And then, how to set that attribute as the index for that
collection?
Anyone?
Thanks,
Antonio Santos