xml-to-react icon indicating copy to clipboard operation
xml-to-react copied to clipboard

Convert XML nodes to custom elements by default

Open pgoldrbx opened this issue 8 years ago • 2 comments

Currently, we require converters to be defined to do anything. But as of React 16.x (if not earlier?), we can render custom/arbitrary tag names. This means that we can turn an XML document into a React tree without any provided converters.

e.g.

import { createElement } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';

renderToStaticMarkup(createElement('foo'));
// => <foo></foo>

I'd like to propose that this be our default behavior.

pgoldrbx avatar Dec 09 '17 01:12 pgoldrbx

i like this. it feels as if it will solve some edge cases

separately, i'd love an option in the constructor to throw an error / report a warning when an XML node is found without a converter

taveras avatar Dec 11 '17 16:12 taveras

You mean a constructor option to control whether or not we alert the library user of this issue? that makes sense. Naming the interface will be hardest. We'll have to do a bit of research I think.

pgoldrbx avatar Dec 11 '17 17:12 pgoldrbx