XmlTree
A document as a tree, parsed in JavaScript so it works with no DOM.
<XmlTree primitives={domPrimitives} source={feed} />Props
| Prop | Type | Default | What it does |
|---|---|---|---|
primitives | Primitives | required | See Primitives |
source | string | required | The raw XML |
theme | PrettyPrintTheme | DARK_THEME | See Themes |
matcher | Matcher | none | See Search |
Elements expand and collapse. Text and character data are leaves.
Things worth knowing
- It parses in JavaScript, because React Native has no
DOMParser. - It never throws. A document that will not parse renders a one-line reason instead, so keep the
raw text around to show beside it.
parseXmlreturns either a root or an error for the same reason. - A match on an element's own name or attributes does not open it. That says nothing about whether its contents are worth unfolding, so it is painted where it sits. An element opens only for a match inside it.
Searching covers element names, attribute names, attribute values, text and character data.