Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8465987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:12:35+00:00 2026-06-10T15:12:35+00:00

I am attempting to transform some XML [returned by a sql query e.g. SELECT

  • 0

I am attempting to transform some XML [returned by a sql query e.g. SELECT … FOR XML RAW(‘EmailData’),ROOT(‘Emails’),type] but for whatever reason just this row is giving me problems:

<Emails>
  <EmailData ID="370" C_ID="93" Co_ID="019" MemberName="Twin Cities Orthopedics – Savage" Commit_Program_ID="92" SubmittedBy="9175" AccountExecInfo="Jessica Cooley, jcooley@cc.com" PortfolioExecInfo="Seth Bull, 000.581.5006, sbulling@CCDD.com" SupplierRepInfo="Matt Matts, 000.000.4236 Ext-37, Matt.Matts@ker.com" MemberInfoLink="https://nf.CCDD.com/asp/memberinfo.asp?memid=7893&amp;co=019" DocumentLink="https://nf.CCDD.com/asp/maintanance.asp?doc_id=630" TermsAndCondLink="https://nf.CCDD.com/TermsAndConditions.asp?CPID=92" Doc_Source_ID="BTM" SubmittedByInfo="Automated Tier Update" />
</Emails>

The cuplrit seems to be MemberName attribute value … because when I return an empty string instead of the above value I do not get the exception. Do you see any invalid charecters? Is ‘-‘ an invalid charecter for xml?

My XSL Transformation code:

public static SqlXml Transform(SqlXml inputDataXML, SqlXml inputTransformXML)
        {
            try
            {
                MemoryStream memoryXml = new System.IO.MemoryStream();
                XslCompiledTransform xslt = new XslCompiledTransform();
                XmlReader output = null;

                xslt.Load(inputTransformXML.CreateReader());

                // Output the newly constructed XML
                XmlTextWriter outputWriter = new XmlTextWriter(memoryXml, System.Text.Encoding.Default);
                xslt.Transform(inputDataXML.CreateReader(), null, outputWriter, null);
                memoryXml.Seek(0, System.IO.SeekOrigin.Begin);
                output = new XmlTextReader(memoryXml);

                return new SqlXml(output);
            }
            catch(Exception ex)
            {
                byte[] byteArray = Encoding.ASCII.GetBytes( "<error>" + ex.ToString() + "</error>");
                    MemoryStream stream = new MemoryStream( byteArray );
                    XmlReader reader = new XmlTextReader(stream);
                SqlXml x = new SqlXml(reader);

                return x;
            }
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:12:36+00:00Added an answer on June 10, 2026 at 3:12 pm

    It’s possible that the hyphen in the member name value is actually an ’em-dash’ or an ‘en-dash’ instead of a normal hypen, which could happen if the data was copy-and-pasted from Microsoft Word, for example, when entering into the database.

    Try finding out the ASCII value of the character in SQL. It would be either 150 or 151.

    SELECT ASCII(SUBSTRING(MemberName, 23, 1)) FROM Member WHERE ....
    

    If so, they may need to be encoded in the XML as &#x2013; and `—’ respectively.

    It very much depends on the encoding of the XML. As an example, try opening the following files (which contains both an en-dash and em-dash) in IE and see how differently they are handled

    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <Emails> <EmailData MemberName="Twin Cities Orthopedics –— Savage"/> </Emails>
    

    The above file should work, but the following shouldn’t.

    <?xml version="1.0" encoding="utf-8"?>
    <Emails> <EmailData MemberName="Twin Cities Orthopedics –— Savage"/> </Emails>
    

    Encoding them as &#x2013; and &#x2014; would work in both cases though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to transform crossdomain.xml for different environments, just like regular web.config files. I've
I'm attempting to transfer some files through WCF, but as soon as the method
I'm attempting to do a transform on an XML document. My XML transform can
I'm attempting to apply an XSL transform to an XML file inside an SSIS
I am attempting to transform some Docbook XSL to HTML using Java / Xalan
I'm having some trouble with a word add-in. I'm attempting to create a new
I'm having a strange problem while attempting to transform a blocking socket server into
I am attempting to apply an XSLT transformation to a batch of XML documents.
We have some clients who, upon attempting to submit a form, are recieving the
I'm attempting to use HSlogger to get some information about my program. So I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.