[xsl] RE: [xsl] Re: [xsl] RE: [xsl] Re: [xsl] Handling of special characters like C etc

Subject: [xsl] RE: [xsl] Re: [xsl] RE: [xsl] Re: [xsl] Handling of special characters like C etc
From: "Yogesh Dare" <yogeshd@xxxxxxxxxx>
Date: Thu, 3 May 2001 17:46:29 +0530
Hi,
Mike what you wrote in later part abt
<mail-sender><mike@xxxxxxxx></mail-sender> is absolutely true.
I must reject it.But when I recieve it and I send it for parsing it contains
<mail-sender>&lt;mike@xxxxxxxx&gt;</mail-sender>
When I am get output from parser and I send it to xslprocessor it is again
<mail-sender><mike@xxxxxxxx></mail-sender>
How can I avoid this actual replacement of &lt; &gt; by < > so that this
error will not be there at processor level.

Thnx for u r comments,
Yogesh.



-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Mike Brown
Sent: Thursday, May 03, 2001 3:19 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Re: [xsl] RE: [xsl] Re: [xsl] Handling of special
characters like C etc


Yogesh Dare wrote:
> Here I want to escape thr' < and > characters when it representd node
> i.e.<root> and suppose this appears as a part of text like this
> <mail-sender><mike@xxxxxxxx></mail-sender> then only I want to get rid of
<
> and > characters.
> How to differentiate this before sending it to XSLTProcessor.

Your questions are vague, and only tangentially related to XSL, at best.
You should be asking them in a more appropriate forum, like xml-dev or
comp.text.xml.

How are you making your XML? Are you using DOM objects? Are you putting
Strings together?

If using DOM objects, you don't do any escaping. You put the data into the
nodes as-is. When it comes time to serialize the document in XML syntax,
the proper escaping will be done. People often write their own utilities
to recursively walk through the Document and emit the necessary element
and attribute tags and other markup, as well as the escaped character
data. If feeding the DOM object directly to the XSL processor as input,
there's no need to do this of course.

If you are making XML by pasting strings together (which is not a practice
I recommend, but it can be done safely if you know what you are doing),
then you'll need to do the escaping. It's a simple text substitution.
Well, simple in most languages. Java for some reason makes it incredibly
tedious.

If your problem is that you are receiving "XML" that is not really XML
because it looks like <mail-sender><mike@xxxxxxxx></mail-sender>
then you must reject it because there is no way to differentiate between
the markup and the other text! Tell whoever is sending you this malformed
XML that the whole point of escaping the markup characters is so that
there is no confusion about what is markup indicating element boundaries
and entity references, and what is just character data.

   - Mike
____________________________________________________________________________
_
mike j. brown, software engineer at  |  xml/xslt: http://skew.org/xml/
webb.net in denver, colorado, USA    |  personal:
http://hyperreal.org/~mike/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread