BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-16-2008, 06:13 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2008
Model: 8310
PIN: N/A
Carrier: Informatico
Posts: 56
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default reading xml with parse

Please Login to Remove!

Hi,

I have the next result of my web service in asp .net:


<?xml version="1.0" encoding="utf-8" ?>
- <DataSetClientes xmlns="http://tempuri.org/">
- <xs:schema id="DataSetClientes" targetNamespace="http://tempuri.org/DataSetClientes.xsd" xmlns:mstns="http://tempuri.org/DataSetClientes.xsd" xmlns="http://tempuri.org/DataSetClientes.xsd" xmlnss="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-comml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
- <xs:element name="DataSetClientes" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="CLIENTES">
- <xs:complexType>
- <xs:sequence>
<xs:element name="CLI_CODIGO" type="xs:string" minOccurs="0" />
<xs:element name="CLI_NOMBRE" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-comml-msdata" xmlns:diffgr="urn:schemas-microsoft-comml-diffgram-v1">
- <DataSetClientes xmlns="http://tempuri.org/DataSetClientes.xsd">
- <CLIENTES diffgr:id="CLIENTES1" msdata:rowOrder="0">
<CLI_CODIGO>000049</CLI_CODIGO>
<CLI_NOMBRE>BANCO SANTANDER CENTRAL HISPANO, S.A.</CLI_NOMBRE>
</CLIENTES>
- <CLIENTES diffgr:id="CLIENTES2" msdata:rowOrder="1">
<CLI_CODIGO>000063</CLI_CODIGO>
<CLI_NOMBRE>BANCO MAPFRE</CLI_NOMBRE>
</CLIENTES>
</DataSetClientes>
</diffgr:diffgram>
</DataSetClientes>

I try to read with a parse with the next code:

public void ProcesarXML2() {
HttpConnection http;
String dayLabel;
InputStream is;
InputStreamReader reader = null;
try {
String url = "http://100.1.1.126/WebService/service.asmx/ObtenerClientes";
http = (HttpConnection)Connector.open(url);
http.setRequestMethod(HttpConnection.POST);
http.setRequestProperty("Content-Language","es-ES");
http.setRequestProperty("Content-Type","text/xml; charset=utf-8");
int respuesta_servidor = http.getResponseCode();
if (respuesta_servidor==200) {
is = http.openInputStream();
reader = new InputStreamReader(is);
}
XmlParser parser = null;
parser = new XmlParser(reader, 300);
ParseEvent event = null;

while ( (event = parser.read()).getType() != Xml.END_DOCUMENT ) {
if (event.getType() == Xml.START_TAG) {
String name = event.getName();
if (name != null && name.equals("CLI_CODIGO")) {
dayLabel = parser.readText();
formulario.append(dayLabel);
}
name = null;
}
event = null;
}
} catch (IOException e) {
formulario.append(e.toString());
}
}

but,when I debug the application and watch the variable name, ever give me a number as "#446578688", what is the mean of this number? and why don't obtain the tag's name? please help.

Thanks, Oscar
Offline  
Old 04-16-2008, 09:19 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please don't start threads unnecessarily, this query could have gone in this thread you started:

read xml
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 04-16-2008, 09:28 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2008
Model: 8310
PIN: N/A
Carrier: Informatico
Posts: 56
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok, sorry, but this post is not equal, can you help me with this problem?
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.