[wpkg-users] Invalid XML structure found

Rainer Meier r.meier at wpkg.org
Wed Feb 1 19:23:42 CET 2012


Hi to all reading this thread,

On 01.02.2012 19:03, Urs Rau (UK) wrote:
>> That was it, changed the tags accoridng to example files in new
>> (v1.3) wpkg package and it error message disappeared.
>>
>> Thx
>
> Glad it was that, I was pretty sure, but I still haven't got my head around it, to be totally honest. ;-) So it is a bit of "the blind leading the blind". ;-)

Actually the reason I might not have answered is that I am pretty busy right now 
and did not finish reading all threads.

The initial request contained the following "error" reported by WPKG:

"Invalid XML structure found. Root element 'profiles' does not match
expected element name of "wpkg'"


This is pretty clearly saying that an XML file read was having a wrong root 
element name. In this case it seems that the root element was named 'profiles' 
while WPKG was expecting it to be named 'wpkg'.

If you see this message this can only mean that WPKG was either reading 
hosts.xml or the local wpkg.xml. As these are the only XML files which are 
supposed to have a root element named 'wpkg'.
As wpkg.xml is written by WPKG itself I doubt that it is wrong. But host.xml of 
course might be.

So following this idea have a look at the expected structure of a hosts.xml file 
(either hosts.xml in WPKG root or any file placed in hosts/*.xml):

<?xml version="1.0" encoding="utf-8" ?>
<wpkg>
   <host name='host' profile-id='profile' />
   ...
</wpkg>

If you use namespace declarations the same might look as follows:

<?xml version="1.0" encoding="UTF-8"?>
<hosts:wpkg xmlns:hosts="http://www.wpkg.org/hosts"
             xmlns:wpkg="http://www.wpkg.org/wpkg"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.wpkg.org/hosts xsd/hosts.xsd">
   <host name='host' profile-id='profile' />
   ...
</hosts:wpkg>

In both cases the root element is called 'wpkg'. Just in second case it's 
declared to be in the 'hosts' (http://www.wpkg.org/hosts) namespace. But again, 
the root element is called 'wpkg'.


So if you're seeing the error message that the root element is named 'profiles' 
then it's very likely that you either messed up some hosts.xml file which is 
structured as follows:

<?xml version="1.0" encoding="utf-8" ?>
<profiles>
   <host name='host' profile-id='profile' />
   ...
</profiles>

Or even worse, you put a real profile specification in hosts/ folder or in 
hosts.xml. In both cases WPKG of course complains that the XML is not well 
formed and the expected root node of the XML document appears to be wrong.

Not an issue for WPKG however; but it will ignore the XML file of course as it 
does not specify any hosts.

So watch out hosts.xml and hosts/*.xml for invalidly formatted XML files (or XML 
files containing profile specifications rather than host specifications.


br,
Rainer



More information about the wpkg-users mailing list