By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,619 Members | 1,712 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,619 IT Pros & Developers. It's quick & easy.

Find and Replace within an XML file

P: n/a
I was wondering if there is a simple method of replacing characters within
the xml document.

I'm looking at writing a Biztalk Pipeline that escapes illegal characters
before they are processed by a HL7 assembler.

I.E. replace all instances of & or & with \T\ .

I thought about converting to a string and using the replace function, but
that would mean knownig all the HTML codes for characters (as the escape
characters are to be dynamically chosen by the user). Where as I could via
xpath ??? replace all instances of the original character such as &.

Hope it makes sense.

Thanks!
Dec 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Namshub wrote:
I was wondering if there is a simple method of replacing characters within
the xml document.
Several languages will do this, notably XSLT, although XSLT 1.0 isn't
very good at string manipulation. XSLT 2 is much better, but less well
supported yet.
I'm looking at writing a Biztalk Pipeline that escapes illegal characters
before they are processed by a HL7 assembler.

I.E. replace all instances of & or & with \T\ .
None of those characters are illegal in XML.
I thought about converting to a string and using the replace function, but
that would mean knownig all the HTML codes for characters (as the escape
characters are to be dynamically chosen by the user). Where as I could via
xpath ??? replace all instances of the original character such as &.

Hope it makes sense.
Not really. If you want to do large-scale character filtering, and you
have a robust model for avoiding trespassing on the markup, it will be
faster to use a stream editor than to write it in a language which needs
to invoke a formal parse of the XML document first. But you do need to
know what you're doing with it.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Dec 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.