-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
namespace support #7
Comments
What would you consider to be necessary for that? I'm not very familiar with XML namespacing other than the fact that the names then have a namespace in them which then tells the application something about what the tag is for. As it stands, the name is provided as-is, so it should be trivial for anyone to get the namespace by calling |
I would like to replace my dummy xml implementation with yours in this library: https://github.com/gedaiu/vibe.dav The problem is that the dav protocol uses a lot of namespaces |
Okay. But what does "namespace support" mean to you? As I understand it, the namespace is just part of the name where the part before a colon is the namespace - e.g. Is the problem that you want an easier or more idiomatic way to pull out the namespace where you do something like |
You could use a split for the tag namebut I don't think it's enough, because you could have this xmls documents which are equivalent: <a:table xmlns:a="http://somedefinition.com">
<a:name>some name</a:name>
</a:table> <b:table xmlns:b="http://somedefinition.com">
<b:name>some name</a:name>
</b:table> And every DAV client has their own way for sending the prefix name. It could be definitely be handled by the client library but it would be nice if something like this would be possible with your library:
|
So, when you say that you want the namespace, you don't mean the name of the namespace that goes in a tag name, you mean the URL associated with the namespace, because that uniquely identifies the namespace, whereas its name doesn't? That's definitely harder. It would be easy enough to provide a function for splitting the tag name into the namespace name and the local tag name, but the only place where the URL would be is in the start tag with the xlmns attribute. For the parser to provide that information, it would have to store it, which would mean allocating storage for it somewhere, which doesn't really make sense in the default case, especially since the parser is designed to allocate as little as possible. So, I'll have to think about a reasonable way to solve this. My first thought is to provide a wrapper range that examines each start tag in |
It's exactly what I was thinking... I think this might be the best approach. I'll watch the project for this feature :) |
I need to parse a lot of documents some tags in them may have and some may not have namsespaces. How I can iterate trow them without specifying namespased:
instead of:
|
dxml doesn't currently understand anything about namespaces.
though that's going to be reading through all of the entities linearly and would give you any tag anywhere in the document after the current entity which had a matching name, regardless of its depth or relation to the current entity. So, it's not really equivalent to
Alternatively, if you don't care about the memory consumption, you could call But really, as things stand, dxml doesn't really have any good helper functions for searching for tags based on their names unless you're looking for the exact name. |
@jmdavis could you add ns support in future? |
I intend to add something, but I don't know exactly what it will look like yet. It will probably involve a helper wrapper around the existing functionality, but I have to find time to sit down and work out what's really needed. |
will you consider in the future to add namespace support for the xml tags?
The text was updated successfully, but these errors were encountered: