Skip to content

docs: fix XPathContext documentation errors (GH #208, #238, #239) - #286

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-xpathcontext-docs
Draft

toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/fix-xpathcontext-docs

Conversation

@toddr-bot

Copy link
Copy Markdown
Contributor

What

Fix three long-standing documentation errors in XPathContext and Node POD.

Why

The registerVarLookupFunc example had the callback arguments in the wrong order ($varname, $ns, $data instead of $data, $varname, $ns), a typo in the function name, and broken Perl quoting. These have confused users since at least 2013 (RT #84267). Separately, the namespace/XPath documentation didn't mention that registerNs calls are per-context — a common gotcha when iterating child nodes with new XPathContext objects.

How

All changes in docs/libxml.dbk with regenerated .pod files:

  • Corrected callback argument order to match the XS implementation (verified at LibXML.xs:1284-1286)
  • Fixed function name from registerVarLookup() to registerVarLookupFunc()
  • Changed district='Brooklyn' to district="Brooklyn" (inner single quotes broke Perl syntax)
  • Added per-context note to registerNs docs and a GPX example to the "NOTE ON NAMESPACES AND XPATH" section in Node.pod

Testing

  • make test passes (all test files)
  • Verified regenerated POD matches expectations

Closes #208, closes #238, closes #239

Fix three documentation issues in XPathContext and Node:

- registerVarLookupFunc example: correct callback argument order
  from ($varname,$ns,$data) to ($data,$varname,$ns) matching
  the actual XS implementation (GH #208)
- Same example: fix function name registerVarLookup() to
  registerVarLookupFunc() (GH #208)
- Same example: fix broken Perl quoting in XPath expression
  district='Brooklyn' to district="Brooklyn" (GH #238)
- registerNs: document that namespace registrations are
  per-context and not shared between XPathContext objects,
  with a GPX example showing re-registration for sub-tree
  contexts (GH #239)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant