Reputation: 1723
I am creating xml file with my own tags and given values and that in form of String and again I decode that in XML.
I have been said to
check that is code-decode XML is XML encoding safe.
Any idea how to check it? or any thing that make it sure that it is XML safe.
Upvotes: 1
Views: 341
Reputation: 95684
An XML document that satisfies XML spec is said to be "well-formed," whereas a document that satisfies a schema (such as XHTML) is said to be valid. Since you're rolling your own XML-derived language, you likely want to check well-formedness. If you Google "well-formedness checker," you'd find them online. Any XML parser also could be used to check it.
The basic idea is like @Philipp is saying, you can't use certain characters between the tags (like <
), all begin tags need to match up with end tags, and Unicode characters are properly encoded.
Upvotes: 0
Reputation: 11833
If you would want to write </mytag>
as the content between <mytag>
and </mytag>
, you have to escape the less-than and greater-than characters, for example. There are several entities defined for escaping:
& -> &
< -> <
> -> >
" -> "
' -> '
What programming language/platform are you using? If you aren't writing the XML all by yourself, there should be ways that you don't have to worry about this!
Upvotes: 2