> From: Vincent van Beveren <v.vanbeve...@rijnhuizen.nl>
>
> Hi Dave,
>
> Thank you for the new version. Unfortunately it doesn't seem to work for me 
> yet.
> I have the following definition:
>
> <xs:element name="MetaConstruct">
>     <xs:complexType>
>         <xs:attribute name="name" type="xs:string" />
>         <xs:attribute name="dataType" type="dataTypeEnum" />
>     </xs:complexType>               
> </xs:element>
>

[snip]

>
> I've looked through generateDS's code, and I found the following (line 1487):
>
>     elif childCount == 0:
>         s1 = "        outfile.write('>\\n')\n"
>         outfile.write(s1)
>         s1 = "        self.exportChildren(outfile, level + 1, namespace_,
>             name_)\n"
>         outfile.write(s1)
>         s1 = "        outfile.write('\\n' % (namespace_, name_))\n"
>         outfile.write(s1)
>
> I was wondering if this shouldn't say:
>
>     elif childCount == 0:
>         s1 = "            outfile.write(' />\\n')\n"
>         outfile.write(s1)
>
>
> Because you know it doesn't allow any children. Then you don't
> need to check for them.

Vincent -

Thanks for the fix.  I've applied your change.  It seems to work in
my tests.

However, I have a question: Your sample element definition
(MetaConstruct) can have no children (child elements).  Does
it also guarantee that a MetaConstruct element in an
instance document can have no character content?  For example,
could we have the following:

    <metaconstruct name="SampleType" dataType="ComplexType01">
        some character content 
        and other text
    </metaconstruct>

I don't believe that is allowed, given your element definition. 
But, if that is possible, then with your fix, the character content
("some character content ...") would not be exported.

What do you think?

I believe the relevant part of the specification is section 2.5.3
"Empty Content" in "XML Schema Part 0" --
http://www.w3.org/TR/xmlschema-0/

The 2nd example in that section:

    Shorthand for an Empty Complex Type
    <xsd:element name="internationalPrice">
      <xsd:complexType>
        <xsd:attribute name="currency" type="xsd:string"/>
        <xsd:attribute name="value"    type="xsd:decimal"/>
      </xsd:complexType>
    </xsd:element>

seems very similar to yours.  Am I right that the spec is saying
that this element definition allows *no* character content?

I have not attached a new version, because I assume that you have
patched your change into yours.

- Dave

--

Dave Kuhlman
http://www.rexx.com/~dkuhlman

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to