• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Escape character

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I need to read "<" from a xml file, but I get
org.xml.sax.SAXParseException:The content beginning "<" is not legal markup... Is there some kind of escape character in xml?
...
<CONTENT>if(a < b)
b = a;
a = 0;
</CONTENT>
Above code snippet is what I want to read from a xml file. Thanks in advance for your help.
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"<" symbol is illegal in XML, you have to escape it as "&lt;"
[This message has been edited by Mapraputa Is (edited August 06, 2001).]
 
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Special characters are handled through entities.
An entity reference like < contains a name (in this case, �lt�) between the start and end delimiters. The text it refers to (< ) is substituted for the name, like a macro in a C or C++ program. The following table shows the predefined entities for special characters

Character Reference
& &
< <
> >
" "
' '
 
Joon Park
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys,
"& l t;" seems to be working in place of "<".
[This message has been edited by Joon Park (edited August 06, 2001).]
[This message has been edited by Joon Park (edited August 06, 2001).]
 
Mapraputa Is
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Errr... "<" is &lt; , not &amp; - I corrected my post
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!