You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Eva Flora <ev...@bluemartini.com> on 2002/05/21 20:52:50 UTC
Repost: How to retrieve attribute values
I am using SAXParser and have the following startElement()
implementation
and I am unable to retrieve attributes via the XMLAttrList. I am
using xerces 1.4.4. Please help. I have looked everywhere
and I dont know what I am missing. Has anyone done this
successfully before?
Thanks in advance,
Eva
I have the following startElement() method implementation:
public void startElement(org.apache.xerces.utils.QName elementQName,
org.apache.xerces.framework.XMLAttrList
xmlAttrList,
int attrListIndex) {
...
}
and I am unable to retrieve the attributes of the element that is being
processed. A sample XML document is below:
<element1 firstname = "eva" lastname="flora">
<element11>
<element111>test</element111>
<element112>test</element112>
</element11>
</element1>
I need to retrieve the "firstname" attribute name.
xmlAttrList.getLength() returns
2 which is correct. I have tried xmlAttrList.getValue(),
xmlAttrList.getAttrName() to no avail. I have also tried
xmlAttrList.getAttributeList(attrListIndex) then looped
through the list and the attribute name is still not getting returned.
How do I retrieve the attribute values? What am I doing wrong?
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org