-
Notifications
You must be signed in to change notification settings - Fork 107
Iterating over attributes #105
Comments
I don't think this is possible. Iteration means a list, means elements. On Fri, Nov 13, 2015 at 7:35 PM, Serge Aleynikov [email protected]
|
So, there is no way for a for/while loop to address the attributes of elements other then to accessing an individual element explicitly by name? Seems like a rather big limitation... |
Only if you don't control the schema. |
Perhaps I am not thinking in "gsl" way? I have an XML document that I need to use to generate source code that would have a function that returns some node from this XML as an XML string. For that purpose I need to go through the XML doc using selective filtering and output some nodes with conditional filtering of their attributes. I know the schema upfront, but the XML elements have many optional attributes, and some of them need to be filtered out, so I cannot use XML.string() function "as-is". Here's an example:
From this XML I need to produce a string which filters out some attributes, and includes others, e.g.:
Here iterating over children nodes is easy, but iterating over node's attributes and filtering out some of them is the problem I am having trouble with using gsl. |
It's unclear from documentation how to iterate over attributes of a given XML node.
I tried the following, without success:
This prints:
What I need is an iterator that would iterate through all attributes of "a" node: "value", "x".
Any help?
The text was updated successfully, but these errors were encountered: