* Extract namespace from raw tag name * @param {string} rawTagName - Tag name possibly with namespace (e.g., "soap:Envelope") * @returns {string|undefined} Namespace or undefined
(rawTagName)
| 57 | * @returns {string|undefined} Namespace or undefined |
| 58 | */ |
| 59 | function extractNamespace(rawTagName) { |
| 60 | if (!rawTagName || typeof rawTagName !== 'string') return undefined; |
| 61 | |
| 62 | const colonIndex = rawTagName.indexOf(':'); |
| 63 | if (colonIndex !== -1 && colonIndex > 0) { |
| 64 | const ns = rawTagName.substring(0, colonIndex); |
| 65 | // Don't treat xmlns as a namespace |
| 66 | if (ns !== 'xmlns') { |
| 67 | return ns; |
| 68 | } |
| 69 | } |
| 70 | return undefined; |
| 71 | } |
| 72 | |
| 73 | export default class OrderedObjParser { |
| 74 | constructor(options, externalEntities) { |