471,046 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,046 software developers and data experts.

Find and Replace within an XML file

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
1 4726
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.

Similar topics

10 posts views Thread by hokieghal99 | last post: by
1 post views Thread by Mark | last post: by
6 posts views Thread by DataSmash | last post: by
3 posts views Thread by mouac01 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.