Re: [xml] quick value finding

On Sat, Apr 10, 2004 at 03:40:11PM -0400, Daniel Veillard wrote:
On Sat, Apr 10, 2004 at 08:20:39PM +0100, skyhawk redbrick dcu ie wrote:
I'm thrawling through the docs and anything I've found so far seems
overkill for what I want to do.
Basically if i have a file such as <test><entry>printed</entry></test>
i'd like to be able to do somthing along the lines of
cout<<valueOf("entry")<<endl; and have printed appear on screen.

I'm sure there must be a method somewhere in the library to allow me 
to get the values of a given tag.

  No. Because your use case is far too limited for real work.
Just for a start you may have multiple "entry" in a file. It's overkill
to you because you have a far too narrow view of the real needs. Such
an API would be basically useless, except maybe for you, since it would
  1/ only work with a global variable
  2/ would not work correctly with XML namespaces
  3/ would have semantic problem in case of multiple elements
Instead of trying to invent a new API without properly understanding
the context, learn about XPath and check the xpath1 example from
or use the reader interface and get the content of the (first ?) entry

Rightyo, thought it may have one as sax in Java has a getElementsByTagName("tag") method.
I'll go rethink what I plan to do.


Redbrick - Dublin City University Networking Society
Declan McMullen - Webmaster

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]