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 139763 - Generate Sample XML document does not work for noNamespace shcema
Summary: Generate Sample XML document does not work for noNamespace shcema
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Tools (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Sonali Kochar
URL:
Keywords:
: 132452 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-11 20:12 UTC by tonybeckham
Modified: 2008-07-17 19:31 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 tonybeckham 2008-07-11 20:12:51 UTC
Generating sample XML document from a schema with no namespace does not generate elements.

System:
Product Version: NetBeans IDE Dev (Build 200807101204)
Java: 1.6.0_05; Java HotSpot(TM) 64-Bit Server VM 1.6.0_05-b13-52
System: Mac OS X version 10.5.4 running on x86_64; MacRoman; en_US (nb)

Steps:
1. Create a schema and clear the namespace field this creating a schema with no namespace
2. Add a complex type and some elements to the complex type
3. Add an element of built-in type of the complex type just created
4. In projects window right click the schema and choose Generate Smaple XML
5. XML sample doc is created but lacks element generation
6. You can repeat 1-4 but keep namespace for the schema and elemebts are generated.
Comment 1 tonybeckham 2008-07-11 20:18:58 UTC
*EDIT* for step 3 select use existing type not built-in type
Comment 2 Sonali Kochar 2008-07-11 22:19:06 UTC
Tony, even with namespace, the elements are not getting generated. Pls can you confirm? Also, let me know what is
displayed in the Root Element drop down box in both cases? thx
Comment 3 tonybeckham 2008-07-11 22:40:59 UTC
With a namespace elements are getting created for me, but not exactly correctly, see issue 139764
When there is no namespace then there are zero elements created.

In both cases the rootElement displayed newElement

Followed these steps for nonamespace schema and schema with namespace
1. New Complex type
2. add two elements to the complex type 
3. Add a global element of type of your complex type
5. save
6. generate sample XML
Comment 4 Samaresh Panda 2008-07-11 23:26:08 UTC
*** Issue 132452 has been marked as a duplicate of this issue. ***
Comment 5 Sonali Kochar 2008-07-16 17:48:40 UTC
This is working for me. Can you confirm that after adding a global element of type of the complex type, you are not
using prefix i.e ur xsd should not have something like this:
xsd:element name="newElement" type="tns:newComplexType"></xsd:element>

Here the element is using a "tns" prefix which cannot be mapped to any namespace. The xsd is incorrect and hence, a
empty xml is generated.
Comment 6 tonybeckham 2008-07-16 17:56:31 UTC
Correct, there is not anything like that.  Here is the XSD

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

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <xsd:complexType name="newComplexType">
        <xsd:sequence>
            <xsd:element name="newElement"/>
            <xsd:element name="newElement1"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="newElement" type="newComplexType"></xsd:element>
</xsd:schema>
Comment 7 Sonali Kochar 2008-07-16 21:44:53 UTC
fixed
changeset 8014120dbe39 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=8014120dbe39
Comment 8 Quality Engineering 2008-07-17 04:42:51 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #324 build
Changeset: http://hg.netbeans.org/main/rev/8014120dbe39
User: sonali@netbeans.org
Log: Fix for issue#139763 Generate Sample XML document does not work for noNamespace shcema
Comment 9 tonybeckham 2008-07-17 19:31:09 UTC
Fix Verified

Product Version: NetBeans IDE Dev (Build 200807170007)
Java: 1.6.0_05; Java HotSpot(TM) 64-Bit Server VM 1.6.0_05-b13-52
System: Mac OS X version 10.5.4 running on x86_64; MacRoman; en_US (nb)