Hi all,

I too need to access attribute values.  Given this xml structure (for
example):

<RootElement>
  <NodeA id="1AD343">
      <NodeB>Some stuff</NodeB>
      <NodeC>Other text stuff</NodeC>
        ... (many other nodes)
  </NodeA>
  <NodeA id="288E43">
      <NodeB>Interesting node text</NodeB>
      <NodeC>Dull text stuff</NodeC>
        ... (many other nodes)
  </NodeA>
  <NodeA id="3BBDE2">
      <NodeB>More text</NodeB>
      <NodeC>Something else here</NodeC>
        ... (many other nodes)
  </NodeA>
  ... (many other NodeA nodes)
</RootElement>

All the id attributes of NodeA are unique, and I want to get a list of these
ids without having to drag the entire document across the network.  Bearing
in mind that each NodeA can be stored as a separate document in Xindice so
that Xindice can work with lots of small documents rather than one large
document, retrieving the root node for each document would mean copying the
entire database across the network so that it could be parsed using a DOM
tree (or something).

I am aware that Xindice doesn't allow attribute queries as this doesn't
return valid XML, but I was wondering if this will be changed in future
updates of Xindice?

Another solution to this problem involves just returning the root node
without any of its children: this would dramatically reduce the network
traffic generated by querying for attributes in the root node.  However, I
have not been able to find out if this is possible.  Can anyone out there
shed any light on this?

Thanks in advance,

Barney Govan
R&D Engineer
Sony BPE Research Labs



-----Original Message-----
From: Jayaram Narayana [mailto:[EMAIL PROTECTED]
Sent: 18 April 2002 16:13
To: 'Xindice Dev. Group'
Subject: Attribute Values


hi there!

i need to access the attribute value of an element using the xalan api. my
element is like so:

 <temp att="tempAtt" id="1001"/>

how do i access the value of "att", given that i already have this code:

Collection col =
DatabaseManager.getCollection(PageConstants.COLLECTION_PATH);
XPathQueryService service =
(XPathQueryService)col.getService("XPathQueryService", "1.0");

ResourceSet resultSet = service.queryResource("proj1", xpath);

XObject xo = new XObject();
XMLResource resource = (XMLResource) resultSet.getResource(0);
Node originalnode = resource.getContentAsDOM();

 // Use Xalan xpath parser to extract data
xo = XPathAPI.eval(originalnode, "/" + xpath);

 // TODO
 /* i need to access the attribute values here */

TIA,
-nani




*************************************************************************
The information contained in this message or any of its
attachments may be privileged and confidential and intended 
for the exclusive use of the addressee. If you are not the
addressee any disclosure, reproduction, distribution or other
dissemination or use of this communication is strictly prohibited
*************************************************************************

Reply via email to