File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Is forward slash / a reserverd character? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Is forward slash / a reserverd character?" Watch "Is forward slash / a reserverd character?" New topic
Author

Is forward slash / a reserverd character?

Phil Weinstein
Greenhorn

Joined: Nov 30, 2003
Posts: 5
Is forward slash / a reserverd character in xml? If so what is the escape sequence i.e. > for >.
Many Thanks
Hari Vignesh Padmanaban
Ranch Hand

Joined: Oct 07, 2003
Posts: 578
Hi pin an xml file. hil,
As far as I know you can use both "/" and ">" as the co ntent of an elemnt
Even though ">" can be used as it is, it is better to put it as an entity. But for "<" you would have to use an entity!!.
For some reason when I type in the entity it gets converted into teh corresponding character!!. I tried thrice
Please refer to teh follwing link for a detailed info on entities !!!
http://tech.irt.org/articles/js212/#intro
So all the following are right

Hope thsi helps
hari
[ January 10, 2004: Message edited by: Hari Vignesh Padmanaban ]
[ January 10, 2004: Message edited by: Hari Vignesh Padmanaban ]
[ January 10, 2004: Message edited by: Hari Vignesh Padmanaban ]
[ January 10, 2004: Message edited by: Hari Vignesh Padmanaban ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
For some reason when I type in the entity it gets converted into teh corresponding character!!. I tried thrice

Yeah, it's a bit difficult. But there's really no other way to prevent "malicious HTML scripting" but to encode all special characters that might affect how the page layout comes out...
In case someone is interested, here are some examples of how you post stuff with special characters etc:
UBB blocks:
[CODE]foobar[/CODE] is written as &#91;CODE&#93;foobar&#91;/CODE&#93;
XML/HTML snippets:
<xml version="1.0"?> is written as &lt;xml version="1.0"?&gt;


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
GeeCON Prague 2014
 
subject: Is forward slash / a reserverd character?