RE: [xmlpull-dev] [Fwd: default namespace for elements in no namespace]

"Belanger, Simon" <[email protected]> Wed, 26 Nov 2003 16:38:05 -0500
Newsgroups gmane.comp.java.enhydra.kxml
Message-ID <[email protected]>
Hi Stefan,

Same problem, same place. Here the stack trace :

<GetDocumensListResponse
xmlns="http://www.telussa.com/TELUSSA.WIG.WebServices/Synchronisation"><
GetDocumensListResult><xs:schema id="DocumentsList" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><xs:simpleType
name="storageType"><xs:restriction base="xs:string"
/></xs:simpleType><xs:simpleType name="statusType"><xs:restriction
base="xs:string" /></xs:simpleType><xs:element
name="Documents"><xs:complexType><xs:sequence><xs:element
name="Document" minOccurs="0"
maxOccurs="unbounded"><xs:complexType><xs:sequence><xs:element
name="Subject" type="xs:string" msdata:Ordinal="1" /><xs:element
name="Received" type="xs:dateTime" msdata:Ordinal="2" /><xs:element
name="Description" type="xs:string" minOccurs="0" msdata:Ordinal="3"
/></xs:sequence><xs:attribute name="ID" type="xs:int" use="required"
/></xs:complexType></xs:element></xs:sequence><xs:attribute
name="storageMode" type="storageType" use="required" /><xs:attribute
name="status" type="statusType" use="required"
/></xs:complexType></xs:element><xs:element name="DocumentsList"
msdata:IsDataSet="true" msdata:Locale="fr-CA"><xs:complexType><xs:choice
maxOccurs="unbounded"><xs:element ref="Documents"
/></xs:choice></xs:complexType></xs:element></xs:schema><diffgr:diffgram
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">java.lang.Illeg
alStateException: Cannot set default namespace for elements in no
namespace

	at org.kxml2.io.KXmlSerializer.startTag(+167)
	at org.kxml2.kdom.Element.write(+56)
	at org.kxml2.kdom.Node.writeChildren(+101)
	at org.kxml2.kdom.Element.write(+102)
	at org.kxml2.kdom.Node.writeChildren(+101)
	at org.kxml2.kdom.Element.write(+102)
	at org.kxml2.kdom.Node.writeChildren(+101)
	at org.kxml2.kdom.Element.write(+102)
	at org.kxml2.kdom.Node.writeChildren(+101)
	at org.kxml2.kdom.Node.write(+5)
	at com.telussa.onthefly.OnTheFly.run(+220)


Regards, Simon

-----Original Message-----
From: Stefan Haustein [mailto:[email protected]] 
Sent: 26 novembre, 2003 16:14
To: Belanger, Simon
Cc: Aleksander Slominski; [email protected]
Subject: Re: [xmlpull-dev] [Fwd: Kxml: default namespace for elements in
no namespace]

Belanger, Simon wrote:

Hi Simon,

I think I have fixed this. Can you download the new version of the 
Serializer from

http://cvs.sourceforge.net/viewcvs.py/kxml/kxml2/src/org/kxml2/io/

and tell me if it works now?

Best regards,
Stefan



> Hi Stefan, Aleksander,
> 
> You are right, I think that the problem is from the kxml serializer. I
> put in attachment the xml data that I receive. You will see, the
> exception is throw when the serializer encounter :
> 
> <DocumentsList xmlns="">
> <Documents diffgr:id="Documents1" msdata:rowOrder="0"
> diffgr:hasChanges="inserted" storageMode="ModeFilesStorage"
> status="Inbox" msdata:hiddenDocuments_Id="0">
> ... 
> 
> There is my code :
> 
> 	...
> 	
>         	SoapEnvelope env = null;

>             env = new SoapEnvelope(SoapEnvelope.VER11);
>             ...
>          	
>             trans.call(soapAction, env);   
>             Writer writer =  new OutputStreamWriter(System.out);
>             KXmlSerializer xmlS = new KXmlSerializer();
>             xmlS.setOutput(writer);
>         
>             Node bodyIn = (Node)env.bodyIn;
>             bodyIn.write(xmlS);
> 
>             writer.flush();
>             writer.close();
> 
> 
> The stack trace is :
> 
> java.lang.IllegalStateException: Cannot set default namespace for
> elements in no namespace 
> 	at org.kxml2.io.KXmlSerializer.startTag(+167)
> 	at org.kxml2.kdom.Element.write(+56)
> 	at org.kxml2.kdom.Node.writeChildren(+101)
> 	at org.kxml2.kdom.Element.write(+102)
> 	at org.kxml2.kdom.Node.writeChildren(+101)
> 	at org.kxml2.kdom.Element.write(+102)
> 	at org.kxml2.kdom.Node.writeChildren(+101)
> 	at org.kxml2.kdom.Element.write(+102)
> 	at org.kxml2.kdom.Node.writeChildren(+101)
> 	at org.kxml2.kdom.Node.write(+5)
> 	at com.telussa.onthefly.OnTheFly.run(+250) 
> 
> Thanks, Simon
> 
> -----Original Message-----
> From: Aleksander Slominski [mailto:[email protected]] 
> Sent: 26 novembre, 2003 10:59
> To: [email protected]
> Cc: Belanger, Simon; [email protected]
> Subject: Re: [xmlpull-dev] [Fwd: Kxml: default namespace for elements
in
> no namespace]
> 
> hi Simon,
> 
> send us exception stack trace and enough code to reproduce it.
> 
> this greatly help to determine what is the problem and to fix it.
> 
> thanks,
> 
> alek
> 
> Stefan Haustein wrote:
> 
> 
>>Hi Simon,
>>
>>I do not fully understand the problem. To my understanding, the
> 
> Exception is a 
> 
>>Serializer exception, not a parser exception....? Can you provide some
> 
> more 
> 
>>information?
>>
>>I think the problem may be that the kxml serializer does not recognize
> 
> that 
> 
>>there is no contradiction in that special case. It may make sense to
> 
> add this 
> 
>>explicitly to the test case... I think I have now fixed this in the
> 
> current CVS 
> 
>>version (it will take some hours until it is available via the SF web
>>interface at
> 
> http://cvs.sourceforge.net/viewcvs.py/kxml/kxml2/src/org/kxml2/io/
> 
>>
>>Best regards
>>Stefan
>>
>>Simon Belanger wrote:
>>
>>I try to parse un xml file which contains elements with default
> 
> namespace = "".
> 
>>Ex:
>>
>><DocumentsList xmlns="">
>>       <Documents diffgr:id="Documents1" msdata:rowOrder="0" 
>>diffgr:hasChanges="inserted" storageMode="ModeFilesStorage"
> 
> status="Inbox" 
> 
>>msdata:hiddenDocuments_Id="0"/>
>></DocumentsList>
>>
>>I receive the IllegalStateException("Cannot set default namespace for
> 
> elements 
> 
>>in no namespace").  The problem is that I don't have any control on
the
> 
> xml 
> 
>>file, so how can I parse this file?
>>
>>Thanks,
>>
>>Simon
>>
>>------------------------ Yahoo! Groups Sponsor
> 
> ---------------------~-->
> 
>>Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
>>Printer at MyInks.com. Free s/h on orders $50 or more to the US &
> 
> Canada.
> 
>>http://www.c1tracking.com/l.asp?cid=5511
>>http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/2U_rlB/TM
>>---------------------------------------------------------------------~
-
>>
>>
>>To unsubscribe from this group, send an email to:
>>[email protected]
>>
>>
>>
>>Your use of Yahoo! Groups is subject to
> 
> http://docs.yahoo.com/info/terms/ 
> 
>> 
>>
>>
>>
> 
>
------------------------------------------------------------------------
> 
>>Subject:
>>Kxml: default namespace for elements in no namespace
>>From:
>>Simon Belanger <[email protected]>
>>Date:
>>Tue, 25 Nov 2003 16:58:00 -0500
>>To:
>>[email protected]
>>
>>
>>Hi,
>>
>>I try to parse un xml file which contains elements with default 
>>namespace = "".
>>
>>Ex:
>>
>><DocumentsList xmlns="">
>>       <Documents diffgr:id="Documents1" msdata:rowOrder="0" 
>>diffgr:hasChanges="inserted" storageMode="ModeFilesStorage" 
>>status="Inbox" msdata:hiddenDocuments_Id="0"/>
>></DocumentsList>
>>
>>I receive the IllegalStateException("Cannot set default namespace for 
>>elements in no namespace").  The problem is that I don't have any 
>>control on the xml file, so how can I parse this file?
>>
>>Thanks,
>>
>>Simon
>>
>>_______________________________________________
>>Kxml mailing list
>>[email protected]
>>http://www.enhydra.org/mailman/listinfo.cgi/kxml
> 
> 
> 
> 
> 
>
------------------------------------------------------------------------
> 
> <?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><ClientAppVers
ion
xmlns="http://www.telussa.com/TELUSSA.WIG.WebServicesLibrary.Data/SoapCl
ientAppVersionHeader"><Major>1</Major><Minor>0</Minor><Build>0</Build><P
ackageUrl>http://206.162.166.230:8080/ClientPackages/WIG/1.1.0/WIG.cab</
PackageUrl></ClientAppVersion></soap:Header><soap:Body><GetDocumensListR
esponse
xmlns="http://www.telussa.com/TELUSSA.WIG.WebServices/Synchronisation"><
GetDocumensListResult><xs:schema id="DocumentsList" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><xs:simpleType
name="storageType"><xs:restriction base="xs:string"
/></xs:simpleType><xs:simpleType name="statusType"><xs:restriction
base="xs:string" /></xs:simpleType><xs:element
name="Documents"><xs:complexType><xs:sequenc
e!
>  ><xs:element
>     name="Document" minO
> curs="0"
maxOccurs="unbounded"><xs:complexType><xs:sequence><xs:element
name="Subject" type="xs:string" msdata:Ordinal="1" /><xs:element
name="Received" type="xs:dateTime" msdata:Ordinal="2" /><xs:element
name="Description" type="xs:string" minOccurs="0" msdata:Ordinal="3"
/></xs:sequence><xs:attribute name="ID" type="xs:int" use="required"
/></xs:complexType></xs:element></xs:sequence><xs:attribute
name="storageMode" type="storageType" use="required" /><xs:attribute
name="status" type="statusType" use="required"
/></xs:complexType></xs:element><xs:element name="DocumentsList"
msdata:IsDataSet="true" msdata:Locale="fr-CA"><xs:complexType><xs:choice
maxOccurs="unbounded"><xs:element ref="Documents"
/></xs:choice></xs:complexType></xs:element></xs:schema><diffgr:diffgram
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><DocumentsList
xmlns=""><Documents diffgr:id="Documents1" msdata:rowOrder="0"
diffgr:hasChanges="in
s!
>  erted" stora
>    geMode="ModeFilesStor
> ge" status="Inbox" msdata:hiddenDocuments_Id="0"><Document
diffgr:id="Document1" msdata:rowOrder="0" diffgr:hasChanges="inserted"
ID="54926244"
msdata:hiddenDocuments_Id="0"><Subject>BMW-Demo.xml</Subject><Received>2
003-11-20T05:49:26.2440688-05:00</Received></Document><Document
diffgr:id="Document2" msdata:rowOrder="1" diffgr:hasChanges="inserted"
ID="54925222"
msdata:hiddenDocuments_Id="0"><Subject>CATSA-Demo.xml</Subject><Received
>2003-11-20T05:49:25.2226000-05:00</Received></Document><Document
diffgr:id="Document3" msdata:rowOrder="2" diffgr:hasChanges="inserted"
ID="54925543"
msdata:hiddenDocuments_Id="0"><Subject>Danone-Demo.xml</Subject><Receive
d>2003-11-20T05:49:25.5430608-05:00</Received></Document></Documents></D
ocumentsList></diffgr:diffgram></GetDocumensListResult></GetDocumensList
Response></soap:Body></soap:Envelope>