do you know function in java that will validate a string to be a good XML element name.
Form w3schools:
XML elements must follow these naming
rules:
- Names can contain letters, numbers, and other characters
- Names cannot start with a number or punctuation character
- Names cannot start with the letters xml (or XML, or Xml, etc)
- Names cannot contain spaces
I found other questions that offered regex solutions, isn’t there a function that already does that?
If you are using Xerces XML parser, you can use the XMLChar (or XML11Char) class
isValidName()method, like this:There is also sample code available here for
isValidName.