Why you want to become a coder when working with Mews Commander. How to install a new hotel, how to create a nice confirmation e-mail, bill, registration card, ...
2. mewssystems.com
CODING FOR MEWS
How to install a new hotel?
How to create a nice confirmation e-mail?
How to format T&C’s?
How to make custom bill headers?
How to format the text on the registration card?
XML
HTML
4. mewssystems.com
HOTEL INSTALLATION
Why installing via an XML file?
1) You can re-use the same file for Demo and Production.
2) You can send the file to a colleague for a review!
3) If something goes wrong, you can send the file to MEWS
for an analysis of the problem.
4) You can re-use parts of the file when installing a similar hotel.
7. mewssystems.com
XML – BASIC TERMINOLOGY
<element>Text content.</element>
opening tag closing tag
name of the element
no whitespace
This is an XML element. It has 3 parts – opening tag, closing tag and content. The content can be a text, or another XML element. Always make sure that there
is no space within your opening tag. A space is a separator between attributes in XML. That’s why you cannot use it in the name of the element. Always make
sure that the name of the closing tag matches the name of the opening tag. Case sensitive – capital letters matter. The forward slash always needs to be at the
start of the closing tag.
8. mewssystems.com
XML – BASIC TERMINOLOGY
<price>300</price>
Q: What is the name of this element?
Q: What is the content of this element?
9. mewssystems.com
XML – BASIC TERMINOLOGY
<element/>
This is an element without content. It’s called empty element or, also, self-closing element. The opening tag is also a closing one. That’s why the slash is present
at the end of the opening/closing tag.
10. mewssystems.com
XML – BASIC TERMINOLOGY
<soldOut/>
The meaning of the self closing tag, when it does not have any content is its presence itself. If you have such an element inside of an element called
roomCategory, it probably means that all the rooms of that category are sold. If the element is not there, it’s not sold out.
11. mewssystems.com
XML – BASIC TERMINOLOGY
<element attribute=“value”>Content</element>
attribute name
no whitespace
attribute value
Attributes are another way how to structure information. You can add more informatin about the element.
13. mewssystems.com
XML – BASIC TERMINOLOGY
<price currency=“EUR” vat=“19”>300</element>
An element can have more attributes. Those are separated by space. That’s, again, why the name of the attribute cannot contain a space. Also, the value of the
attribute needs to be enclosed in quotes. The application that reads such a file will then recognize, where the value starts and where it ends.
Q: What’s the error here?
14. mewssystems.com
XML – BASIC TERMINOLOGY
<hotel name=“Luxury Suites”>
<room number=“A101”/>
</hotel>
You can nest elements into each other. Always make sure that one element is nested in another one. You cannot cross them. If you open an element hotel and
then an element room, you need to close them in the order room, hotel. If you do otherwise, those are interleaved and your XML is not valid.
15. mewssystems.com
XML – BASIC DOCUMENT STRUCTURE
<?xml version=“1.0” encoding=“UTF-8”?>
<root>
</root>
<child>
</child>
<childOfChild>
Text content of an element.
</childOfChild>
<anotherChild />
<child-with-attribute attributeName=“value” />
<!-- This is an XML comment -->
16. mewssystems.com
XML – EXAMPLE
<?xml version=“1.0” encoding=“UTF-8”?>
<animals>
<wild>
<dog owner=“Matt” kind=“Jack Russel”>
Beyoncé
</dog>
<anonymousCat/>
<cat knownAs=“Gucci” />
<!-- No more animals in this XML file. -->
</wild>
</animals>
17. mewssystems.com
XML – COMMON MISTAKES
<?xml version=“1.0” encoding=“UTF-8”?>
<root>
<child>
<dog>
Beyoncé
</cat>
<hi>
<hello reason=To be kind>
Greetings!
</hi>
</hello>
<dog known As=“Gucci” nickname=“Big “G””>
<!- No more animals in this XML file. -->
</Child>
<root>
<animals>
</animals>
There are 10 errors. Identify them.
18. mewssystems.com
XML – COMMON MISTAKES
<?xml version=“1.0” encoding=“UTF-8”?>
<root>
<child>
<dog>
Beyoncé
</cat>
<hi>
<hello reason=To be kind>
Greetings!
</hi>
</hello>
<dog known As=“Gucci” nickname=“Big “G””>
<!- No more animals in this XML file. -->
</Child>
<root>
<animals>
</animals>
19. mewssystems.com
XML – COMMON MISTAKES
<?xml version=“1.0” encoding=“UTF-8”?>
<root>
<child>
<dog>
Beyoncé
</dog>
<hi>
<hello reason=“To be kind”>
Greetings!
</hello>
</hi>
<dog knownAs=“Gucci” nickname=“Big "G"” />
<!-- No more animals in this XML file. -->
</child>
<root>
If you need to use quotes in the value of an attribute, you need to use so-called XML Entities that represent quotes.
20. mewssystems.com
XML VALIDATION
Always make sure that your file is well-formed
Use some XML editor (Atom, Notepad++, SublimeText, …)
Use some XML validator, e.g. https://validator.w3.org/
Cross-validate your files with your colleagues.
Do not use format-aware text editors like Word, TextEdit, Google Docs, …
21. mewssystems.com
MEWS XML INSTALLATION FILE
Before you start:
1) Choose an XML editor
2) Remember, how a well-formed XML looks like.
3) Get the Excel config file from the customer and validate it.
4) Obtain the current version of the installer file template.
25. mewssystems.com
HTML
Special case of XML.
A way of telling a browser (web browser, e-mail client, …),
how a document should look like.
We highly recommend to use just a very small subset
(or a web developer).
E-mail clients often support a very small subset of HTML. You need someone with experience to make an advanced confirmation e-mail.
29. mewssystems.com
HTML TEMPLATES
Some fields in MEWS expect you to fill them in with an HTML
template. Moreover, the HTML can contain special
{placeholders}
that are automatically replaced when MEWS generates the
corresponding document.
30. mewssystems.com
HTML TEMPLATES
<p>
Dear {Name}, <br />
welcome to our luxury hotel! Pleasure to meet you!
</p>
{DetailsHtml}
<p>
Kind regards, <br />
the team of the {EnterpriseName} hotel
</p>