tags:

views:

1001

answers:

4

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

+2  A: 

"/" 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.)

Jon Skeet
Illegal Characters: _*%?:;=()[]/\|#." ErrorCode="1206" - This is the message I am getting while sending the above value.
Pavan
@Pavan: This pretty much proves Jon's point.
Tomalak
But your list of Illegal Characters above does not include a forward slash ... so your problem lies elsewhere.
DilbertDave
@DilbertDave: It does, just after ] - it's forward and backward slashes, not a caret :)
Jon Skeet
Oh yeah - "Should have gone to Spec Savers" ;-)
DilbertDave
+1  A: 

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 &#x2F; (2F being the hex for the ASCII character code for the forwardslash character).

Iain Galloway
I am getting the same error,after using / also.If I remove the slash,it works fine.
Pavan
+6  A: 

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.

Rob Levine
Well spotted - maybe the 'Illegal Character' is actually relating to invalid syntax, i.e. an equals sign where an attribute name should be.
DilbertDave
I say we take off and nuke the site from orbit.
skaffman
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
Can you post a bit of the actual XML you are using - in context.
DilbertDave
"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
Thanks Jon.Will keep that in mind in future questions.
Pavan
A: 

Hi everybody,looks like this is a problem in the application where the XML value is being sent.Thanks for your help.

Pavan