1


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.

2 Answers 2

2

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:

&   -> &amp;
<   -> &lt;
>   -> &gt;
"   -> &quot;
'   -> &apos;

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!

Sign up to request clarification or add additional context in comments.

1 Comment

I'm not a Java guy, but if you use an XML serialization mechanism, the framework/library should handle all encoding.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.