I try to convert data in table Products from SqL Server's Nortwind database into XML format. I use ASP to get the data and write the XML tag to the browser. Regarding the specification, I have to fill the value (i.e. Product name) into atrribute, so the XML structure would look like this: <Product Definition="XXXProduct" listprice="21" id="Item41" parentCategories="Item4"> <Field fieldID="ProductID" fieldValue="11" /> <Field fieldID="ProductName" fieldValue="xxx" /> ..... </Product> The FieldID is the column name in the Product table and fieldValue is its corresponding value. When I encounter non-English Characters in ProductName Field, the browser (IE5+) throws an Error: "an invalid character was found..." If I remove all non-English characters in the table then everything works fine. So how to solve non-English characters and maybe any special characters in XML?
Did you specify encoding attribute in xml declaration: <?xml version="1.0" encoding="..."?> If specified encoding is different from actual, you will get an error message. If you did not specify any encoding, UTF8/UTF-16 is assumed and if actual encoding is different from UTF8... then see the sentence above. This link will give more details: http://www.w3schools.com/xml/xml_encoding.asp
hi 0while writing in browser using asp include like this response.write(server.htmlencode(the xml value)) this will work. i also faced the above problem
We must storm this mad man's lab and destroy his villanous bomb! Are you with me tiny ad?