-
Notifications
You must be signed in to change notification settings - Fork 198
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
name space handling (xmlns:) #38
Comments
In soap.js, the current code looks like: OnvifSoap.prototype.parse = function(soap) {
let promise = new Promise((resolve, reject) => {
let opts = {
'explicitRoot' : false,
'explicitArray' : false,
//'ignoreAttrs' : true,
'ignoreAttrs' : false,
'tagNameProcessors': [function(name) {
let m = name.match(/^([^\:]+)\:([^\:]+)$/);
return (m ? m[2] : name);
}]
};
mXml2Js.parseString(soap, opts, (error, result) => { If you change 'ignoreAttrs' back to true, then this problem with $ and _ goes away. I wonder why the value was changed ... |
Thank you for your feedback. I've suspected the I'm planning to change the Unfortunately, I don't have enough time for this project now. Give me some time. |
I misunderstood this issue. Now I understand what is problem. As you advised, it seems that the xml2js returns different results depends on where a namespace ( If you don't mind my asking, could you give me the manufacturer name and the model name of the network camera you have? If it is affordable and available in Japan (where I live), I will buy and try it. |
I built it myself, using: https://github.com/BreeeZe/rpos |
Wow, you built it by yourself! Great! I'll try it soon. |
I installed the rpos on my Raspberry Pi 3 Model B+ with a camera module v2. It worked fine though I don't have the PiMoroni PanTiltHAT. You advised a solution: soap = soap.replace(/xmlns(.*?)=(".*?")/g,'');
mXml2Js.parseString(soap, opts, (error, result) => {
...
}); This solution would solve this issue comprehensively, but all namespace information would be removed from responses of the low-level methods. Some users might expect that namespace information is included in a response. So I focused only on the high-level methods. I improved the Thank you. |
I think this library suffers from the same problem that onvif had; namely that when the camera is sending
xmlns:
name spaces with all of its elements, the xml to json parser is not doing the right thing. My camera outputs something like this:Which produces json that looks like this:
If I apply the same "fix" as described in the linked ticket, namely:
in lib/modules/soap.js::parse(), then the problem goes away and I get this json:
I realize this is just how xml2js works, but higher level apps (like samples/manager) break when the camera is sending xmlns:
The text was updated successfully, but these errors were encountered: