Hi,

there is a patch available for this problem which might solve your problem. You can find it at http://sourceforge.net/tracker/index.php?func=detail&aid=828966&group_id=16035&atid=316035 . I'll take a look at as soon as I have the time and commit it to CVS

Maarten

[EMAIL PROTECTED] wrote:

I try to use dom4j 1.4 to read a xml schema and then serialize back to a file.
That schema has namespace "xs" defiened, but the serizlize output has "xs:xs:" as it namespace instead of "xs".


I attached the source file and here is the simple problem that I am using:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
System.out.println( "Loading document with JAXP builder: " + builder );
org.w3c.dom.Document domDocument = builder.parse( "output.xsd" );
org.w3c.dom.Element element2 = domDocument.getDocumentElement();
DOMReader reader = new DOMReader();
Document document = reader.read(domDocument);
// use dom4j document as the source
Source source = new DocumentSource( document );
OutputFormat outformat = OutputFormat.createPrettyPrint();
XMLWriter writer = new XMLWriter(System.out, outformat);
writer.write(document);
writer.flush();


Here is the output, it has "xmlns:xs" twice also in the root node.

<?xml version="1.0" encoding="UTF-8"?>

<xs:xs:schema xmlns:xs="" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:tns="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3";>
<xs:xs:import xmlns:xs="" namespace="http://schemas.xmlsoap.org/soap/envelope/"; schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"/>
<xs:xs:simpleType xmlns:xs="" name="statusTextType">
<xs:xs:annotation>
<xs:xs:documentation>list of standard human-readable status descriptions</xs:xs:documentation>
</xs:xs:annotation>
<xs:xs:restriction base="xs:string"/>
</xs:xs:simpleType>
</xs:xs:schema>


Any help is appreciated.
Thank you.


------------------------------------------------------------------------


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3";  
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:tns="http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/REL-5-MM7-1-3"; elementFormDefault="qualified" 
attributeFormDefault="unqualified">

<xs:import namespace="http://schemas.xmlsoap.org/soap/envelope/"; 
schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"/>
        <xs:simpleType name="statusTextType">
                <xs:annotation>
                        <xs:documentation>list of standard human-readable status 
descriptions</xs:documentation>
                </xs:annotation>
                <xs:restriction base="xs:string"/>
        </xs:simpleType>
</xs:schema>




------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to