I am trying to send a value like <Somevalue = "Value A/B">
through XML.As "/" comes under illegal character,I tired to encode like ⁄
for slash but it is not working.Is there anyway to do the same?

- 85
- 1
- 3
- 7
-
1Why do you think '/' is an illegal character? And your title uses '\', not '/'. which are you asking about? – Aug 07 '09 at 08:39
-
Sorry,that was a mistake.Corrected the title. – Pavan Aug 07 '09 at 08:42
-
What are you trying to "send a value" to? – Laurence Gonsalves Aug 07 '09 at 09:04
3 Answers
The xml sample you have given there is not valid, irrespective of the slash (which is valid)
I'm guessing it should either be something like
<Somevalue>Value A/B</Somevalue>
OR
<Somevalue value="Value A/B"/>
In any case - until you fix your xml, it won't work.

- 40,328
- 13
- 85
- 111
-
Well spotted - maybe the 'Illegal Character' is actually relating to invalid syntax, i.e. an equals sign where an attribute name should be. – DilbertDave Aug 07 '09 at 08:47
-
2
-
You are right,but I just gave some example.The XML is working fine without slash.If I include slash I am getting Illegal Characters messages.The same value I can enter through front end without any problem. – Pavan Aug 07 '09 at 08:47
-
2
-
1"Just giving some example" which doesn't actually represent what you're doing isn't terribly useful. @DilbertDave is exactly right - you need to give a *real* example. You also still haven't said what you're doing with this XML. – Jon Skeet Aug 07 '09 at 10:37
"/" isn't an illegal character in XML at all. It may be illegal for the particular service you're using, however.
Could you give more context? I strongly suspect this isn't really an XML question, but a service-specific question. I suspect if you look at the error message you're getting, it will talk about invalid values rather than illegal XML. (If you could post that error message in full, it would be helpful too.)

- 1,421,763
- 867
- 9,128
- 9,194
-
Illegal Characters: _*%?:;=()[]/\|#." ErrorCode="1206" - This is the message I am getting while sending the above value. – Pavan Aug 07 '09 at 08:43
-
But your list of Illegal Characters above does not include a forward slash ... so your problem lies elsewhere. – DilbertDave Aug 07 '09 at 09:21
-
@DilbertDave: It does, just after ] - it's forward and backward slashes, not a caret :) – Jon Skeet Aug 07 '09 at 10:36
-
Forwardslash isn't a special character in XML. The snipped you posted is well-formed. What's saying it's illegal?
You could try using / (2F being the hex for the ASCII character code for the forwardslash character).

- 18,669
- 6
- 52
- 73
-
I am getting the same error,after using / also.If I remove the slash,it works fine. – Pavan Aug 07 '09 at 08:46