logo       

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

java.enhydra.kxml

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

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:aslom@xxxxxxxxxxxxxx]
Sent: 26 novembre, 2003 10:59
To: xmlpull-dev@xxxxxxxxxxxxxxx
Cc: Belanger, Simon; kXML@xxxxxxxxxxx
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:
>xmlpull-dev-unsubscribe@xxxxxxxxxxxxxxx
>
>
>
>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 <simon.belanger@xxxxxxxxxxx>
> Date:
> Tue, 25 Nov 2003 16:58:00 -0500
> To:
> kXML@xxxxxxxxxxx
>
>
> 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
> Kxml@xxxxxxxxxxx
> http://www.enhydra.org/mailman/listinfo.cgi/kxml



--
The best way to predict the future is to invent it - Alan Kay


Attachment: output.xml
Description: output.xml

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise