in other words:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<tag1>
<tag1.1></tag1.1>
</tag1>
<tag2 />
<root>
is the same as:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<tag2 />
<tag1>
<tag1.1></tag1.1>
</tag1>
<root>
?
In as much detail as they are shown, your two examples are semantically the same.
It’s a common misunderstanding of XML that in a well-formed XML document the order of sibling elements is significant. The XML 1.0 spec specifies that attributes are unordered, however it says nothing about elements. Therefore an XML processor is free to report element siblings in any order it likes.
That said, I don’t think any commonly used XML processors report elements in a different order to the order they appear in a document.
You ask about a ‘valid’ document – this implies that a DTD or schema is in use, and therefore it may (or may not) be the case that the order is relevant. There are mechanisms for a DTD or schema to specify that element order is relevant within a document. However, your examples don’t show use of a DTD or schema.