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]

Reply via email to