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 206828 - Function Validate XML over XML file created from XML schema shows some errors
Summary: Function Validate XML over XML file created from XML schema shows some errors
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema (show other bugs)
Version: 7.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-01 20:13 UTC by debuggercz
Modified: 2012-06-15 08:26 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description debuggercz 2012-01-01 20:13:34 UTC
Product Version: NetBeans IDE Dev (Build 201112270601)
Java: 1.7.0_01; Java HotSpot(TM) 64-Bit Server VM 21.1-b02
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\deuggercz\.netbeans\dev
Cache directory: C:\Users\deuggercz\.netbeans\dev\var\cache

Steps:
1. Use File | New Project... to create new Web Application project located in
your home directory.
2. Invoke File | New File... from main menu.
3. Select XML category and XML Schema (empty) as file type. Push Next.
4. Type addressbook into File Name, change Folder field to src\java\schema (on
Windows platform is \ and on Un*x is / as separator) and press Finish.
5. Copy this content:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:simpleType name="EmailType">
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="[a-z.]*@[a-z]*.[a-z]*"/>
    </xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="FriendType">
    <xsd:sequence>
        <xsd:element name="email" type="EmailType" minOccurs="1"/>
    </xsd:sequence>
    <xsd:attribute name="nickname" use="required" type="xsd:string"/>
    <xsd:attribute name="birthday" type="xsd:date"/>
</xsd:complexType>

<xsd:element name="addressbook">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="friend" type="FriendType" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>
</xsd:schema>

into clipboard.
6. Invoke File | New File... from main menu.
7. Select XML category and XML Document as file type. Push Next.
8. Type addressbook into File Name, change Folder to src\java\schema (on Windows platform is \ and on Un*x is / as separator) and press Next.
9. Select XML Schema-Constrained Document option and push Next.
10. Push Browse and pick up addressbook.xsd. Also check Import during selecting addressbook.xsd
11. If everything is alright check Primary
12. Push Next and than Finish.
13. Right click editor area and choose Validate XML from popup menu.

There are several errors reported in Output - XML check window. 

For instance:
TargetNamespace.1: Expecting namespace 'null', but the target namespace of the schema document is 'null'. [2] 
cvc-elt.1: Cannot find the declaration of element 'ns1:addressbook'. [11]
Comment 1 Svata Dedic 2012-02-08 16:18:09 UTC
Understood - the defect is because the referenced schema has no namespace. Instead of declaring 'null' namespace and xsi:schemaLocation, the IDE should generate xsi:nonNamespaceSchemaLocation directive.
Comment 2 Svata Dedic 2012-02-08 16:46:40 UTC
Changeset: 24426a77c537
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-02-08 17:46
Message:   Issue #206828 - Function Validate XML over XML file created from XML schema shows some errors: fixed
xsi:noNamespaceSchemaLocation will be generated for namespace-less XML schemas. Wizard will show <none> for prefix and will prevent changes to the prefix.
Comment 3 Svata Dedic 2012-02-09 14:03:15 UTC
Changeset: 067770f22039
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-02-09 15:03
Message:   Issue #206828 - Function Validate XML over XML file created from XML schema shows some errors: fixed
Resolution of the starting element made also asynchronous