import * as wxml from 'wxml';
const parsed = wxml.parse('<view></view>');
wxml.traverse(parsed, function visitor(node, parent) {
const type = node.type;
const parentNode = node.parentNode;
if (type === wxml.NODE_TYPES.ELEMENT) {
const tagName = node.tagName;
const attributes = node.attributes;
const childNodes = node.childNodes;
const selfClosing = node.selfClosing;
} else if (type === wxml.NODE_TYPES.TEXT) {
const textContent = node.textContent;
} else if (type === wxml.NODE_TYPES.COMMENT) {
const comment = node.comment;
}
});
const serialized = wxml.serialize(parsed);