This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 150435

Summary: Netbean XML schema validation doesn't recognize <!DOCTYPE schema/>
Product: xml Reporter: mpei <mpei>
Component: Schema ToolsAssignee: Svata Dedic <sdedic>
Status: RESOLVED WONTFIX    
Severity: blocker    
Priority: P3    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description mpei 2008-10-16 20:14:03 UTC
I uses NetBeans IDE 5.5 for XML schema validation. My sample schema file imports well known W3C XMLDSIG schema file.
Schema validation complains that the XMLDSIG schema "3) the root element of the document is not <xsd:schema>". See
below. The XMLDSIG schema document http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xs starts
with the following:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE schema
  PUBLIC "-//W3C//DTD XMLSchema 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd"
 [
   <!ATTLIST schema 
     xmlns:ds CDATA #FIXED "http://www.w3.org/2000/09/xmldsig#">
   <!ENTITY dsig 'http://www.w3.org/2000/09/xmldsig#'>
   <!ENTITY % p ''>
   <!ENTITY % s ''>
  ]>

<schema xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
        targetNamespace="http://www.w3.org/2000/09/xmldsig#"
        version="0.1" elementFormDefault="qualified"> 
...

where <schema> is after <!DOCTYPE schema ...>

Here is error from IDE XML Check window:

schema_reference.4: Failed to read schema document
'file:/X:/docs/strongauth/OATH/IETF/KeyProv/PSKC/v1.6/v1.6/nbproject/private/cache/retriever/www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd',
because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not
<xsd:schema>.

Here is my sample schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
 xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc:1.0" 
 xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
 xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" 
 targetNamespace="urn:ietf:params:xml:ns:keyprov:pskc:1.0" 
 elementFormDefault="qualified" attributeFormDefault="unqualified" 
 version="1.0">

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#"
schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"/>

</xs:schema>
Comment 1 mpei 2008-10-16 20:16:12 UTC
BTW, I did check that it is NetBeans XML schema validation issue. If I downloaded the xmldsig schema file, manually
remove the <!DOCTYPE ...> that sits between the first line and <schema ...>, then schema validation will pass.
Comment 2 Samaresh Panda 2008-10-17 17:42:40 UTC
Doesn't seem like a bug. We're just using javax.xml.validation APIs and the errors/warnings are being displayed in the
output. If it is a bug, it has to be fixed in JDK. I do not think I can do much about this.

This certainly is a corner case of xml/schema validation and hence I'll keep it open as a P3. It'll be worthwhile to
follow it up on JDK side. Let me see what I can do. For now, please use the workaround you mentioned.
Comment 3 Samaresh Panda 2008-11-18 18:36:06 UTC
I have filed a bug (id 1394940) against JDK. Lets wait and watch.
Comment 4 Martin Balin 2016-07-07 09:56:32 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss