Axonpack

XmlTree

A document as a tree, parsed in JavaScript so it works with no DOM.

<XmlTree primitives={domPrimitives} source={feed} />

Props

PropTypeDefaultWhat it does
primitivesPrimitivesrequiredSee Primitives
sourcestringrequiredThe raw XML
themePrettyPrintThemeDARK_THEMESee Themes
matcherMatchernoneSee 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. parseXml returns 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.

On this page