How to Make an XML in CMS

How to Make an XML in CMS thumbnail
Open-source blogging sites, such as those provided by WordPress, are popular CMS.

A content management system (CMS) allows users to post content to a website. For example, certain sites may allow users to create a blog, a store or a newspaper. Many content management systems utilize Extensible Markup Language (XML) data either for configuration, data storage or to publish content in RSS format. You can make your own XML file for a CMS if you follow a few simple rules. The XML format can store data of any type, especially repeating hierarchical data.

Things You'll Need

  • Text editor
Show More

Instructions

    • 1

      Create a new file in the text editor of your choice.

    • 2

      Type a "<" followed by the name of the type of data you wish to represent, and a ">" to create an opening tag. Store data that represents an animal on a farm, for example, by typing "<animal>." Begin a new line, and create a closing tag by typing a "</" followed by the name of the type of data you wish to represent and a ">." All information placed between the opening and closing tags should pertain to the item named in the tags. This means that all information should pertain to the animal. Check to ensure your code includes both opening and closing tags:

      <animal>

      </animal>

      Represent any type of data you like in your tags: XML is a very extensible format, so you can make tags to represent sports teams, blog posts or even abstract ideas. Refer to each set of tags and all associated information as an "element."

    • 3

      Add attributes to opening tags to provide additional information. Add an attribute by typing the name of the attribute, an equals sign, and the attribute data in quotes. You can add attributes to an opening tag, but never to a closing tag:

      <animal name="Bessie" species="cow">

      </animal>

    • 4

      Add content between the opening and closing tag, if you wish:

      <paragraph format="normal">

      This is paragraph containing comments in XML.

      </paragraph>

      Use attributes, content or both to store data in XML tags. Either is acceptable.

    • 5

      Add children to the element by placing an entirely new element inside your element. Refer to elements that exist inside of other elements as "child elements." Add as many child elements as necessary:

      <warship class="carrier">

      <crewMember rank="admiral">

      Admiral Smith

      </crewMember>

      <crewMember rank="ensign">

      Ensign Brown

      </crewMember>

      </warship>

    • 6

      Add child elements inside of child elements, adding as many child elements as necessary to define your data:

      <farm>

      <department attribute="livestock">

      <cow type="milkcow">

      Bessie

      </cow>

      </department>

      </farm>

    • 7

      Add comments to your XML file by typing "<!--' '-->"; comments help others understand your XML file:

      <!-- This XML file is for CMS selling plastic figurines -->

Related Searches:

References

  • Photo Credit Thinkstock Images/Comstock/Getty Images

Comments

Related Ads

Featured