> However, I still am facing the issue about getting all the values in an
> attribute, as below:
An attribute only has one value, so I don't understand what you mean by
"getting all the values."
> INSTEAD, I get:
> bash-2.03$ mySerializeNodeSet SerializeNodeSet/foo.xml / /doc/name/@first
>
> Warning: An attribute or namespace node was selected. Attribute and
namespace
> nodes cannot be serialized.
The sample shows how you can serialize XML. When serializing XML, you
cannot serialize an attribute, because it appears on the element to which
it belongs. If you want to get values out of a document using XPath
expressions, XML serialization is not the answer.
You should write your own code that selects a node-set, the prints out the
values:
for (NodeRefList::size_type i = 0; i < theLength; ++i)
{
const XalanNode* const theNode = theResult.item(i);
assert(theNode != 0);
cout << DOMServices::getNodeValue(*theNode) << endl;
}
Dave