XML null namespaces need to be preserved
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 28
- Forks
- 14
- Avg merge
- 3h 10m
- Merged PRs (30d)
- 1
Description
When serializing a node that should not belong in any (including the default) namespace, it is important to preserve that fact. XMLSerializer/DOMParser objects have long supported such serialization via the xmlns="" mechanism, which instructs the parser to not place the element in the default namespace, but that the element should have no namespace.
This behavior is detailed in the XML namespaces specification, Namespaces in XML 1.0 (Third Edition): "The attribute value in a default namespace declaration MAY be empty. This has the same effect, within the scope of the declaration, of there being no default namespace."
As a quick example, consider this:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<people xmlns="">
<person>
<lastname>Smith</lastname>
<firstname>Joe</firstname>
</person>
<person>
<lastname>Jones</lastname>
<firstname>John</firstname>
</person>
</people>
</head>
<body>
</body>
</html>
The people element and all of its descendants should be considered to be in no namespace whatsoever (i.e. they do not inherit the XHTML namespace).
This is a critical distinction that has impact in many areas, but especially things like XPath querying.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the XML namespaces specification linked in the issue and the XMLSerializer/DOMParser behavior it describes. No repository files or tests are named, so locate the parsing and serialization entry points first. Done means preserving xmlns="" and keeping the element and descendants in no namespace, including for XPath queries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, xml
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100