Skip to content

message.removeAllNamespaces

Signature: message.removeAllNamespaces()

Returns: void

Remove all of the XML namespace declarations.

Note

This method only applies to XML formatted messages.

Parameters

None

Example

// Example: Remove all XML namespace declarations and prefixes from a document.

// Sample XML message structure (with namespaces)
message = qie.createXMLMessage(`
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:web="http://example.com/webservice">
        <soapenv:Header/>
        <soapenv:Body>
            <web:getUser>
                <web:id>123</web:id>
                <web:name>John Doe</web:name>
            </web:getUser>
        </soapenv:Body>
    </soapenv:Envelope>
`);

// Remove all namespaces
message.removeAllNamespaces();
/* result:
<Envelope>
    <Header/>
    <Body>
        <getUser>
            <id>123</id>
            <name>John Doe</name>
        </getUser>
    </Body>
</Envelope>
*/