Bugs item #599708, was opened at 2002-08-24 18:24
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=599708&group_id=16035

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Draier (draier)
Assigned to: Nobody/Anonymous (nobody)
Summary: bug in DatatypeDocumentFactory

Initial Comment:
When using a DatatypeDocumentFactory with a 
document that contains a schema definition with 
noNamespaceSchemaLocation, everything works fine - 
but if schemaLocation is used instead the schema is 
not automatically parsed. Moreover, the schema parser 
always create qnames with empty namespaces.

I've added a namespace var in SchemaParser : 

    private Namespace namespace;

    void setNamespace(Namespace namespace) {
        this.namespace = namespace;
    }

Then modified the getQName method :

    protected QName getQName( String name ) {
        if (namespace != null) {
            return documentFactory.createQName(name, 
namespace);
        } else {
            return documentFactory.createQName(name);
        }
    }

And finally added an else if clause in 
DatatypeDocumentFactory.createAttribute : 

} else if ( autoLoadSchema && qname.equals( 
XSI_SCHEMA_LOCATION ) ) {
            Document document = (owner != null) ? 
owner.getDocument() : null;
            Namespace namespace = 
owner.getNamespaceForURI(value.substring
(0,value.indexOf(' ')));
            schemaBuilder.setNamespace(namespace);
            loadSchema( document, value.substring
(value.indexOf(' ')+1) );
            schemaBuilder.setNamespace(null);
        }

That seems to work fine with that fix.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=599708&group_id=16035


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to