Maczosss
Maczosss

Reputation: 23

Java JCR is it possible to add '&' into node name

If I'm renaming node in JCR, is it possible to add & to that name? Currently when I pass string name for ex: test & node it is saved as test---node./

Upvotes: 0

Views: 101

Answers (2)

Julian Reschke
Julian Reschke

Reputation: 42045

Yes, you can.

What API/UI did you try?

Upvotes: 0

Marcin Orlowski
Marcin Orlowski

Reputation: 75636

The naming restrictions are documented here:

The JCR specification already restricts what can go into the “local” part of an item name - see JCR v2.0 Specification, Section 3.2. In particular:

  • Characters not allowed in XML are forbidden in names as well; this affects most control characters plus unpaired surrogates; see Extensible Markup Language (XML) 1.0 (Fifth Edition), Section 2.2.
  • Furthermore, the names . and .. can not be used.
  • Finally, the characters /, :, [, ], |, and * are forbidden. For these, the JCR v2.0 Specification, Section 3.2.5.4 proposes a mapping to “private-use” code points.

so as & is XML special character is not allowed without prior escaping to the entity (&).

Upvotes: 1

Related Questions