Skip to content

fix: allow dots in namespace prefix validation#61

Open
ronaldtse wants to merge 1 commit intomainfrom
fix/validate-prefix-ncname
Open

fix: allow dots in namespace prefix validation#61
ronaldtse wants to merge 1 commit intomainfrom
fix/validate-prefix-ncname

Conversation

@ronaldtse
Copy link
Copy Markdown
Contributor

Summary

  • XML NCName spec permits dots (.) as valid NameChars, but the validate_prefix regex /\A[a-zA-Z_][\w-]*\z/ was too restrictive
  • This caused Moxml::ValidationError: Invalid namespace prefix: xmlns_1.0 when serializing XML with namespace prefixes containing dots
  • Fixed regex to /\A[a-zA-Z_][\w.\-]*\z/ to accept dots

Test plan

  • Existing tests pass
  • Namespace prefixes with dots (e.g., xmlns_1.0) no longer raise validation errors

XML NCName spec permits dots in namespace prefixes but the regex
was too restrictive, rejecting valid prefixes like xmlns_1.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant