MichielCM / xsd2html2xml

Generates plain HTML5 forms from XML schemas (XSDs). Transforms filled-in forms into XML.
MIT License
95 stars 42 forks source link

value of top level element not displayed in generated form #21

Open kgi-github opened 5 years ago

kgi-github commented 5 years ago

I have noticed that when creating a filled form from an xml document the value of a top level element (if it's a type such as xs:integer or a simpleType) is not displayed.

I have two files. The first is test.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">

    <xs:element name="myThing" type="xs:integer"/>

</xs:schema>

The second file is myTest.xml:

<myThing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="test.xsd">
    1974
</myThing>

The value 1974 is not shown on the generated form after processing with xsd2html2xml. I am using version 3.3. Have I made a mistake somewhere?

MichielCM commented 5 years ago

That doesn't have to do with it being the top-level element. It's because of the whitespace around the integer. Change it to ...>1974</... and it works.

kgi-github commented 5 years ago

Doh! I thought I was missing something. Thanks.

MichielCM commented 5 years ago

You're welcome. Let's leave this one open, because according to the specification, your XML with the whitespace is valid.