Nested tags (sub-tags)

Hi,

Is it possible to create nested tags (sub-tags) as LiquiBase extension?

I have got problem with this kind of tags. LiquiBase can’t recognise nested tags.

For example, my tag’s schema:

                                                                             

      <xsd:element name=“Update”>
        xsd:complexType
        xsd:sequence
          <xsd:element ref=“column” minOccurs=“1”/>
        </xsd:sequence>
        <xsd:attribute name=“updateCondition” type=“xsd:string”/>
        <xsd:attribute name=“deleteCondition” type=“xsd:string”/>
        </xsd:complexType>
      </xsd:element>

    <xsd:element name=“Insert”>
          xsd:complexType
              xsd:sequence
                  <xsd:element ref=“column” maxOccurs=“unbounded”/>
              </xsd:sequence>
              <xsd:attribute name=“insertCondition” type=“xsd:string”/>
          </xsd:complexType>
      </xsd:element>

dalt

We should allow it if it is not.  Is it an xml validation error you are getting, or a different error?  Do you get a stack trace if you run liquibase with --logLevel=DEBUG ?

Nathan

There’s no XML validation errors.
I think that I don’t know how to represent sub-tags in LiquiBase code and how LiquiBase distinguishes attributes from sub-tags?

I wonder if you could explain that.

dalt

I see what you mean.  That is actually something I had not included support for.  I will try to get it in this weekend.  It is definitely something we want.

Nathan

Although not fully committed yet, what you will need to do is create methods on your change object to construct objects based on given tag.  For example, if you have a nested tag called “column”, you will need to create a “public Object createColumn()” method that will return the correct type.  Liquibase will then call the setters on the new object based on the attributes of the tags.

I’m hoping to have a new beta version out later this week which will include this change.

Nathan

Sounds Great! I will be waiting for this release.

dalt