Liquid XML Data Binder (C++, Java, VB6) / Using the Code / Working with XML snippets
In This Topic
    Working with XML snippets
    In This Topic

    An XML Snippet is a section of XML data containing an element. What makes if different from an XML Document is the element does not have to be declared as a root element in the XML Schema, it can be an element defined in-place within the schema or as a xs:complexType.

    So looking at the following example

     

    XML Document & XML Snippet
    Copy Code
    <Person>
       <Name>
          <Forename>Joe</Forename>
          <Surname>Blogs</Surname>
       </Name>
       <Address>
          <Line1>5</Line1>
          <Line2>Acacia Av</Line2>
          <Line3>Springfield</Line3>
       </Address>
    </Person>
    

     The element 'Person' is declared as a root element in the schema, so this is a valid XML document and is also an XML Snippet.

    XML Snippet
    Copy Code
    <Name>
       <Forename>Joe</Forename>
       <Surname>Blogs</Surname>
    </Name>
    

     The element 'Name' is declared inline within the definition for 'Person', and is NOT a root element.

    XML Snippet
    Copy Code
    <Address>
       <Line1>5</Line1>
       <Line2>Acacia Av</Line2>
       <Line3>Springfield</Line3>
    </Address>
    

    The element 'Address' is declared using the complexType 'AddressType', and is NOT a valid root element.

    Reading XML Snippets

    Special considerations and API methods should be used when reading XML Snippets, see

     Writing XML Snippets

     Special considerations and API methods should be used when writing XML Snippets, see