
30/09/2004, 09:20
|
| | Fecha de Ingreso: agosto-2004
Mensajes: 8
Antigüedad: 20 años, 7 meses Puntos: 0 | |
error de ruta larga con xsd xml y java hola! Estoy trabajando en una aplicacion en la cual se envia un archivo xml y luego de ciertas validaciones los datos son ingresados en la BD. Mi xml es comparado con un archivo de extension xsd. Pero al momento de cargar el archivo xml, este carga de cualquier ruta menos del escritorio. Cuando es asi, el tomcat me bota el siguiente error: Cita: [ERROR FATAL row:2 col:6]
The processing instruction target matching "[xX][mM][lL]" is not allowed. Sin embargo, si se accede a la aplicacion desde otra pc y envio el mismo archivo el error cambia Cita: String index out of range = -1 El siguiente texto es mi esquema
Código:
<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- Elemento Principal -->
<xsd:element name="IRU_ReclamosServicio" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Registro" type="bodySchema" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Cuerpo del Esquema -->
<xsd:complexType name="bodySchema" mixed="true">
<xsd:sequence>
<xsd:element name="CodigoServicio" type="tipoCodigoServicio" />
<xsd:element name="CodigoMes" type="tipoCodigoMes" />
<xsd:element name="CantidadReclamos" type="tipoCantidadReclamos" />
</xsd:sequence>
</xsd:complexType>
<!-- sub tipos de elementos principales -->
<xsd:simpleType name="tipoCodigoServicio">
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxInclusive value="8"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tipoCodigoMes">
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxInclusive value="12"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="tipoCantidadReclamos">
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Y este es mi archivo XML
Código:
<?xml version="1.0" encoding="utf-8" ?>
<IRU_ReclamosServicio xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='http://localhost:8080/Sigotel/TransaccionesXML/temporal/frmtDirectory/IRU_ReclamosServicio.xsd'>
<Registro>
<CodigoServicio>1</CodigoServicio>
<CodigoMes>10</CodigoMes>
<CantidadReclamos>2654</CantidadReclamos>
</Registro>
<Registro>
<CodigoServicio>3</CodigoServicio>
<CodigoMes>11</CodigoMes>
<CantidadReclamos>26</CantidadReclamos>
</Registro>
<Registro>
<CodigoServicio>3</CodigoServicio>
<CodigoMes>12</CodigoMes>
<CantidadReclamos>2441</CantidadReclamos>
</Registro>
</IRU_ReclamosServicio>
Ademas, cuento con una clase que valida lo de la ruta larga... y q al parecer tiene algo de malo. Aqui les pongo el metodo que considera eso
Código:
public void doUpload(HttpServletRequest request) throws IOException
{
ServletInputStream in = request.getInputStream();
byte line[] = new byte[128];
int i = in.readLine(line, 0, 128);
if(i < 3)
return;
int boundaryLength = i - 2;
String boundary = new String(line, 0, boundaryLength);
fields = new Hashtable();
for(; i != -1; i = in.readLine(line, 0, 128))
{
String newLine = new String(line, 0, i);
if(!newLine.startsWith("Content-Disposition: form-data; name=\""))
continue;
if(newLine.indexOf("filename=\"") != -1)
{
setFileName(new String(line, 0, i - 2));
if(fileName == null)
return;
i = in.readLine(line, 0, 128);
setContentType(new String(line, 0, i - 2));
i = in.readLine(line, 0, 128);
i = in.readLine(line, 0, 128);
buffer = new ByteArrayOutputStream();
for(newLine = new String(line, 0, i); i != -1 && !newLine.startsWith(boundary); newLine = new String(line, 0, i))
{
buffer.write(line, 0, i);
i = in.readLine(line, 0, 128);
if((buffer.size()/1024.0)>getSIZE_KILOBYTES()){
setUploaded(false);
buffer = null;
break;
}
}
continue;
}
int pos = newLine.indexOf("name=\"");
String fieldName = newLine.substring(pos + 6, newLine.length() - 3);
i = in.readLine(line, 0, 128);
i = in.readLine(line, 0, 128);
newLine = new String(line, 0, i);
StringBuffer fieldValue = new StringBuffer(128);
for(; i != -1 && !newLine.startsWith(boundary); newLine = new String(line, 0, i))
{
i = in.readLine(line, 0, 128);
if((i == boundaryLength + 2 || i == boundaryLength + 4) && (new String(line, 0, i)).startsWith(boundary))
fieldValue.append(newLine.substring(0, newLine.length() - 2));
else
fieldValue.append(newLine);
}
fields.put(fieldName, fieldValue.toString());
}
if(existe)
{
/*File f = new File(String.valueOf(savePath != null ? ((Object) (savePath)) : "") + String.valueOf(fileName));
if(f.length() > (long)4095)
f.delete();
f = null;*/
}
}
no encuentro el error por ningun lado. Por favor podrian ayudarme?
muchas gracias!! |