468,256 Members | 1,426 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,256 developers. It's quick & easy.

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 4645
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
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.