exporting an xml file from excel

Posted on 2011-05-04
Last Modified: 2012-05-11
I have an excel file that has an xml map (xsd) and I am exporting the information keyed in excel into an xml format.  One of the fields is company name and the name I am using is 'COMPANY & COMPANY NAME'.  When this xml file is uploaded to the outside source the company name fails to match the company name they have.  I am told this is because of the &.  How do I handle this?  Does the xsd need to be changed?  
Question by:cogc_it
    LVL 6

    Expert Comment

    "&" is not an allowed character in XML value.

    If you have & in your source xml, then it must be represented as it's
    entity reference & as & is a special character in xml reserved to
    indicate the beginning of character/entity references such as '
    " etc If you have '&' on its own then you are not dealing with xml,
    so you need to look at whats producing this made-up syntax and fix it.

    So while exporting the XML convert all "&" to "&amp" or "and".
    If this is not possible for you there is some special syntax to specify strings in XML, which I would have to look up. But even that would require a similar change as converting to &amp or and. Let me know.

    Author Comment

    The name of our company has '&' in it and the company name must be included in the xml file.  How would I turn this into a string to make a valid xml file?
    LVL 6

    Expert Comment

    How are you doing the export? Do you have some VB macro..?
    Can you post one sample excel?

    Accepted Solution

    I found that if you used CDATA you can work with the &.  However, the company receiving the xml file is modifing there xml parse to handle the &.  Thanks for your help
    LVL 6

    Expert Comment

    CDATA is exactly what I meant by this "for you there is some special syntax to specify strings in XML".

    Author Closing Comment

    I found the answer myself and also the company receiving the xml file modified their xml parse to handle the situation

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT ( The crux of this batch f…
    This collection of functions covers all the normal rounding methods of just about any numeric value.
    The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
    Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now