jinn_hnnl
asked on
Reading XML problem with invalid character
Hi,
I am developing a web application using ASP and VBScript.
I have to read an XML data returned from another third party company using SAP.
The XML data looks like:
<eQuoteCustomer>
<KISno>114735</KISno>
<SAPno>73990</SAPno>
<Type>Installation</Type>
<Companyname>ETIC</Company name>
...........
The whole job has been finished. Most of the returned XML files can be read without problem except those which contains some reserved character (like & ). So the following XML will cause the error:
<eQuoteCustomer>
<KISno>114735</KISno>
<SAPno>73990</SAPno>
<Type>Installation</Type>
<Companyname> CIAC & SO </Companyname>
....
I got this error : object required objXML.documentElement. When ever the XML file contains: &
How should I fix this problem?
Thanks,
JINNI
I am developing a web application using ASP and VBScript.
I have to read an XML data returned from another third party company using SAP.
The XML data looks like:
<eQuoteCustomer>
<KISno>114735</KISno>
<SAPno>73990</SAPno>
<Type>Installation</Type>
<Companyname>ETIC</Company
...........
The whole job has been finished. Most of the returned XML files can be read without problem except those which contains some reserved character (like & ). So the following XML will cause the error:
<eQuoteCustomer>
<KISno>114735</KISno>
<SAPno>73990</SAPno>
<Type>Installation</Type>
<Companyname> CIAC & SO </Companyname>
....
I got this error : object required objXML.documentElement. When ever the XML file contains: &
How should I fix this problem?
Thanks,
JINNI
Function LoadCustomerData(ByRef objTpl, ByVal kisNo)
Dim objXML, contactList, index, strPath
Dim sapNo, customerType, relative, address, postcode
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = false
strPath = strDirCRMData & "eQuote" & kisNo & ".xml"
If CheckFileExists(strPath) Then
objXML.Load(strPath)
sapNo = objXML.documentElement.childNodes(1).text
customerType = objXML.documentElement.childNodes(2).text
relative = objXML.documentElement.childNodes(3).text
.............
using Server.HTMLEncode
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@ rdonline1: can you please elaborate more your idea?. Because the error seems to appear as soon as I load the data. I guess if I use some kind of XMLParse code to check, it will give the error. But I must have the content of the file instead of throwing an exception overthere.
Rouchi, it is imposible. They are using some kind of IBM Lotus database, then export that database to XML using Domino designer. The content of the database is hardly changed. It gonna take a lot of time if I ask them to modify the code (company policy).
I will have to find a solution to deal with that XML file.
Any idea ?
Rouchi, it is imposible. They are using some kind of IBM Lotus database, then export that database to XML using Domino designer. The content of the database is hardly changed. It gonna take a lot of time if I ask them to modify the code (company policy).
I will have to find a solution to deal with that XML file.
Any idea ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
By the way, I don't believe that an IBM application would output invalid XML.
Maybe it is the way the XML is stored as a file, between the output from Domino and you picking it up. It looks as if the the XML file is stored as a text file, not as an XML file. If I were you I'd look at that first.
Maybe it is the way the XML is stored as a file, between the output from Domino and you picking it up. It looks as if the the XML file is stored as a text file, not as an XML file. If I were you I'd look at that first.
ASKER
Sybe,
Your solution is what I need :) Thanks, I have thought about it and I think you catched the solution.
Well as far as I am concern, the CRM - customer database is stored inside IBM Lotus database (if I am correct), our client need the data, they request a webservice, and XML files (plus some another jobs with SAP).
The procedure is written using Domino, and they export that Lotus database to XML file. Then content has the invalid character (some company name contains &).
But your solution is correct!
I still want to hear another possible solution before close this question.
Your solution is what I need :) Thanks, I have thought about it and I think you catched the solution.
Well as far as I am concern, the CRM - customer database is stored inside IBM Lotus database (if I am correct), our client need the data, they request a webservice, and XML files (plus some another jobs with SAP).
The procedure is written using Domino, and they export that Lotus database to XML file. Then content has the invalid character (some company name contains &).
But your solution is correct!
I still want to hear another possible solution before close this question.
I don't think there is another solution. Either you fix the errors or they do. If their procedure is exporting raw symbols then they should fix it.
There are other symbols in XML that will invalidate the file. The ampersand character is just the start of what you'll have to replace unless they fix this for you!
There are other symbols in XML that will invalidate the file. The ampersand character is just the start of what you'll have to replace unless they fix this for you!
ASKER
I have not test the code, but the idea is what I need :)