Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Schema default value not honored for complex type
Schema default value not honored for complex type [message #906675] Sun, 02 September 2012 02:59
Derek Wallace is currently offline Derek Wallace
Messages: 5
Registered: March 2012
Junior Member
Hi,
I have a simple schema.
I have some elements with simple type and an element as a complex type. The complex type consists of a number of simple type elements.

All elements have a default value.

When i use the Outline view in Eclipse to add elements, the default value is honored for simple types but not for the elements in the complex type.

Ive attached the .xml file and the .xsd.

If i use File - New - Other - XML and follow the wizard to create the initial .xml based on the schema, it adds the elements (simple and complex) and the default of the simple and complex types are honored.

here is how thie file first looks.
<?xml version="1.0" encoding="UTF-8"?>
<del:bookstore xmlns:del="xxxxdel" xmlns:xsi="xxxxXMLSchema-instance" xsi:schemaLocation="xxxxxdel example2.del.xsd ">
<del:Simple>789</del:Simple>
<del:SimpleList>DSSEA</del:SimpleList>
<del:Complex>
<del:Age>39</del:Age>
<del:Color>White</del:Color>
</del:Complex>
</del:bookstore>


If i now manually add a 2nd instance of the Simple type (via the Outline window, righ click, add after, Simple) it is correct.
<?xml version="1.0" encoding="UTF-8"?>
<del:bookstore xmlns:del="xxxxdel" xmlns:xsi="xxxxXMLSchema-instance" xsi:schemaLocation="xxxxdel example2.del.xsd ">
<del:Simple>789</del:Simple>
<del:Simple>789</del:Simple>
<del:SimpleList>DSSEA</del:SimpleList>
<del:Complex>
<del:Age>39</del:Age>
<del:Color>White</del:Color>
</del:Complex>
</del:bookstore>


If i now manually add a 2nd instance of the Complex type (via the Outline window) it is NOT correct.


<?xml version="1.0" encoding="UTF-8"?>
<del:bookstore xmlns:del="xxxx/del" xmlns:xsi="xxxxXMLSchema-instance" xsi:schemaLocation="xxxxxdel example2.del.xsd ">
<del:Simple>789</del:Simple>
<del:Simple>789</del:Simple>
<del:SimpleList>DSSEA</del:SimpleList>
<del:Complex>
<del:Age>39</del:Age>
<del:Color>White</del:Color>
</del:Complex>
<del:Complex>
<del:Age>del:Age</del:Age>
<del:Color>del:Color</del:Color>

</del:Complex>
</del:bookstore>


Im using Eclipse Helios.
Version: 3.7.1
Build id: M20110909-1335

Thx
Derek

[Updated on: Sun, 02 September 2012 03:04]

Report message to a moderator

Previous Topic:Forcing StructuredTextEditor to recognize XML
Next Topic:cannot drag and drop text in .css/.dtd/.xml editors
Goto Forum:
  


Current Time: Fri Apr 18 11:58:33 EDT 2014

Powered by FUDForum. Page generated in 0.02329 seconds