comp.lang.tcl
[Top] [All Lists]

tdom : dealing with attributes

Subject: tdom : dealing with attributes
From: chedderslam
Date: Fri, 30 May 2008 06:21:38 -0700 PDT
Newsgroups: comp.lang.tcl

I am writing a simple xml to json converter.  I have it working for a
basic xml document like this one:
<recordset>
 <division>
  <coe_division_name>mississippi valley</coe_division_name>
  <division_abbreviation>mvd</division_abbreviation>
 </division>
</recordset>

I am now trying to expand its capabilities to handle attribute values,
for documents like this:
<recordset>
 <division ATTRIBUTE="ATTRIBUTE VALUE">
  <coe_division_name>mississippi valley</coe_division_name>
  <division_abbreviation>mvd</division_abbreviation>
 </division>
</recordset>

Looking through the document at http://www.tdom.org/domNode.html, it
doesn't look like there is way way to test for the presence of
attributes.  There is the method "hasAttribute", but it takes the name
of the attribute as an argument so it doesn't do what I am looking
for.

How would I test for the presence of attribute values and then access
them?

Thank you.

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy