Re: RE: Re: Handling of special char
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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format