Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > New to XML

Reply
Thread Tools

New to XML

 
 
Peter Flynn
Guest
Posts: n/a
 
      12-13-2008
Asger Joergensen wrote:
[...]
> Thes characters are not alowed in the text in XML files
> & " ' < >
> they are reserved for tags and they must be translated to
> &amp; &quot; &apos; &lt; &gt;


No, only & and < are forbidden in text unless escaped. The characters
" ' > are just text and do not require escaping, although > acquires a
special meaning in a start-tag or end-tag, and " and ' are bound by
rules of matching and nesting when used in attributes.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
 
Reply With Quote
 
 
 
 
Asger Joergensen
Guest
Posts: n/a
 
      12-13-2008
Hi Peter

Peter Flynn wrote:

> Asger Joergensen wrote:
> [...]
> > Thes characters are not alowed in the text in XML files
> > & " ' < >
> > they are reserved for tags and they must be translated to
> > &amp; &quot; &apos; &lt; &gt;

>
> No, only & and < are forbidden in text unless escaped. The characters
> " ' > are just text and do not require escaping, although > acquires a special meaning in a start-tag or end-tag, and " and ' are bound by rules of matching and nesting when used in attributes.


You are of cource right, BUT it is commen / good practise to escape
all five.

http://www.w3schools.com/xml/xml_syntax.asp

Kind regards
Asger
 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      12-14-2008
Asger Joergensen wrote:
> Hi Peter
>
> Peter Flynn wrote:
>
>> Asger Joergensen wrote:
>> [...]
>>> Thes characters are not alowed in the text in XML files
>>> & " ' < >
>>> they are reserved for tags and they must be translated to
>>> &amp; &quot; &apos; &lt; &gt;

>> No, only & and < are forbidden in text unless escaped. The characters
>> " ' > are just text and do not require escaping, although > acquires a special meaning in a start-tag or end-tag, and " and ' are bound by rules of matching and nesting when used in attributes.

>
> You are of cource right, BUT it is commen / good practise to escape
> all five.


Possibly. It depends what system you are writing for. If you are writing
normal text, you probably want to avoid " and ' as quotes completely,
and use real (curly) open-and-close quotes (single and double) and keep
the ' for an apostrophe. The > occurs very rarely in normal text. When
used in its mathematical sense, it will of course be inside some kind of
<math> element; either way it is a matter of personal preference whether
you use it raw or in the form of a character reference.

> http://www.w3schools.com/xml/xml_syntax.asp


The W3Schools pages are not always reliable or accurate (these ones are OK).

///Peter
 
Reply With Quote
 
JanMoek JanMoek is offline
Junior Member
Join Date: Jan 2010
Posts: 1
 
      01-15-2010
I'm dealing with a simulair problem.
Im my XML Tag there is used de O-slash

like: <DESCRIPTION>Powers 12,7mm EV</DESCRIPTION>

when I parse these with php it results in 2 tags
<DESCRIPTION>Powers</DESCRIPTION>
<DESCRIPTION> 12,7mm EV</DESCRIPTION>

when I remove the O-slash everything is fine.

How can i solve this ??
I've tried Unicode and ISO-8859-1 aswell
and place

xml_parser_set_option($xml_parser,XML_OPTION_SKIP_ WHITE,1);
xml_parser_set_option($xml_parser,XML_OPTION_TARGE T_ENCODING, "ISO-8859-1");

in my code....
but still get the 2 tags

please help
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript new-new-new-new-newbee weblinkunlimited@gmail.com Javascript 2 03-11-2008 01:15 AM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Print XML parsing to JspWriter (out) Class org.xml.sax.helpers.NewInstance can not access a member of class javax.xml.parsers.SAXParser with modifiers "protected" Per Magnus L?vold Java 0 11-15-2004 02:27 PM
What XML technologies to learn first for "XML Processing" and "XML Mapping"? Bomb Diggy Java 0 07-28-2004 07:26 AM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM



Advertisments