jindw / xmldom

A PURE JS W3C Standard based(XML DOM Level2 CORE) DOMParser and XMLSerializer.
Other
819 stars 265 forks source link

Private attributes in DOMImplementation #224

Open thenextgosu opened 7 years ago

thenextgosu commented 7 years ago

Hey,

I want to use xmldom together with equivalent-xml-js. To be able to complete my task, I need to be able to check the type of a part of my XML file. Unfortunately, the types Document, Element, Attr, Text and CDATASection are not accessible from outside the xmldom file.

Code Example:

switch (node_1.constructor) {
                    case xmlDom.DOMImplementation.Document:
                        result = compare_documents(node_1, node_2, opts);
                        break;
                    case xmlDom.DOMImplementation.Element:
                        result = compare_elements(node_1, node_2, opts);
                        break;
                    case xmlDom.DOMImplementation.Attr:
                        result = compare_attributes(node_1, node_2, opts);
                        break;
                    case xmlDom.DOMImplementation.Text:
                        result = compare_text(node_1, node_2, opts);
                        break;
                    case xmlDom.DOMImplementation.CDATASection:
                        result = compare_cdata(node_1, node_2, opts);
                        break;
                    default:
                        result = compare_children(node_1, node_2, opts);
                }

How can I access those types so I can check after them?

Thanks!

amitguptagwl commented 5 years ago

This project is not active anymore. You can try fast-xml-parser instead