I've getting a problem when trying to parse an XML. The logs says:
System.XmlException: Failed to parse XML due to: markup not allowed inside attribute value - illegal < (position: START_TAG seen ...la.ccbdw.dbo.ft_certificas TxtCertificado="AGENCIA : BOGOTA (2).\n<... @3:2)
The code that thows that exception is the following:
strReturn = strReturn.unescapeHtml4().unescapeXml();
objDocument = null;
objDocument = new DOM.Document();
try{
strReturn = strReturn.replace('&', '&');
objDocument.load(strReturn); //The problem occurs here
bodyNode = objDocument.getRootElement();
DOM.XmlNode datosBasicosNode = bodyNode.getChildElement('DatosBasicos', null);
//------------
}catch(Exception objException){
System.debug(' ERROR ===> '+objException.getMessage());
}
strReturn
is the XML that I try to parse to get the 'DatosBasicos'.
I'm try to understand what's going on.
What should I do to fix the problem?
The squeleton of the XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<DatosBasicos ciudad="" esConfecamaras=""><DatosBasicos>
<IdClase> </IdClase>
<NumId> </NumId>
<NombreCliente> </NombreCliente>
<OrganizacionJuridica> </OrganizacionJuridica>
<CategoriaEmpresa> </CategoriaEmpresa>
<NroMatricula> </NroMatricula> <FecMatricula>
<paralela.ccbdw.dbo.ft_certificas TxtCertificado=""
<paralela.ccbdw.dbo.ft_certificas TxtCertificado=""
<paralela.ccbdw.dbo.ft_certificas TxtCertificado=""
<paralela.ccbdw.dbo.ft_certificas TxtCertificado=""
</TxtCertificado></DatosConstitucion><DatosError><CodRetorno>0</CodRetorno></DatosError></DatosBasicos>