Sandy, JDK version didn't even cross my mind. Yes, I use JDK 1.3 and that's probably what I should say next time right in the begining. Thank you for your help, I appreciate it.
Tomas -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, February 22, 2002 3:40 PM To: [EMAIL PROTECTED] Cc: Elena Litani Subject: Re: [Fwd: RE: XMLSerializer problem] Hi Cirip, After struggling for more than an hour, Elena and I finally found the cause of the problem. And it turned out to be a very interesting one: it doesn't occur on JDK 1.2.2, and does occur on JDK 1.3 when the program is debugged. Anyway, Elena will put down the fix soon, and hopefully when you download the new jar files next week (or tomorrow), you'll see the fix. Cheers, Sandy Gao Software Developer, IBM Canada (1-905) 413-3255 [EMAIL PROTECTED] -------- Original Message -------- Subject: RE: XMLSerializer problem Date: Thu, 21 Feb 2002 14:20:46 -0500 From: Cirip Tomas <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> Elena, I've downloaded lates jars (Feb 21, 2002) and still have the same problem. Find attached XML document, schema file, java code and result. I noticed there is a bug posted in Bugzilla - Thank you { DOMParser parser = new DOMParser(); parser.parse("file:///d:\\tc\\xmlparadise\\xml\\test_schema.xml"); Document doc = parser.getDocument(); OutputFormat outputFormat = new OutputFormat(doc); outputFormat.setIndenting(true); XMLSerializer serializer = new XMLSerializer(System.out, outputFormat); serializer.serialize(doc); } -------------------------------------------------- XML File: <?xml version="1.0" encoding="UTF-8"?> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\tc\xmlparadise\xml\test.xsd"> <node1 attr1="cvirko"> <node11/> <node12/> </node1> <node2> <node21/> <node22/> </node2> </root> -------------------------------------------------- Result is <?xml version="1.0" encoding="UTF-8"?> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\tc\xmlparadise\xml\test.xsd"> <node1 attr1="cvirko"> <node11/> <node12/> </node1> <node2> <node21/> <node22/> </node2> </root> -------------------------------------------------- XML Schema file is <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="root"> <xs:complexType> <xs:sequence> <xs:element name="node1"> <xs:complexType> <xs:sequence> <xs:element name="node11"/> <xs:element name="node12"/> </xs:sequence> <xs:attribute name="attr1" type="xs:string" use="optional"/> </xs:complexType> </xs:element> <xs:element name="node2"> <xs:complexType> <xs:sequence> <xs:element name="node21"/> <xs:element name="node22"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="attr1" type="xs:string" use="optional"/> </xs:complexType> </xs:element> </xs:schema> -----Original Message----- From: Elena Litani [mailto:[EMAIL PROTECTED] Sent: Thursday, February 21, 2002 12:50 PM To: [EMAIL PROTECTED] Subject: Re: XMLSerializer problem Hi, I could not reproduce your problem with the newest jars: http://gump.covalent.net/jars/latest/xml-xerces2/ Can you verify that it is fixed in the new version? Thank you! Elena Cirip Tomas wrote: > > Hi, > > I am trying to use XMLSerializer to write XML document to a file. In the > result I get xmlns:xsi attribute twice. I used it before and I think it was > working ok before. I downloaded latest xerces jars. Any ideas? > > Java code: > > DOMParser parser = new DOMParser(); > parser.parse("file:///d:\\tc\\xml\\test_schema.xml"); > Document doc = parser.getDocument(); > > OutputFormat outputFormat = new OutputFormat(doc); > outputFormat.setIndenting(true); > > XMLSerializer serializer = new XMLSerializer(System.out, > outputFormat); > serializer.serialize(doc); > > XML Document: > > <?xml version="1.0" encoding="UTF-8"?> > <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:noNamespaceSchemaLocation="D:\tc\xml\test.xsd"> > <node1 attr1="cvirko"> > <node11/> > <node12/> > </node1> > <node2> > <node21/> > <node22/> > </node2> > </root> > > Result after serialization: > > <?xml version="1.0" encoding="UTF-8"?> > <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:noNamespaceSchemaLocation="D:\tc\xmlparadise\xml\test.xsd"> > <node1 attr1="cvirko"> > <node11/> > <node12/> > </node1> > <node2> > <node21/> > <node22/> > </node2> > </root> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Elena Litani / IBM Toronto --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <?xml version="1.0" encoding="UTF-8"?> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\tc\xmlparadise\xml\test.xsd"> <node1 attr1="cvirko"> <node11/> <node12/> </node1> <node2> <node21/> <node22/> </node2> </root> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
