xml and namespace

T

Tony

Hello!

I can't understand why I get warning on the Xml file below.
The warning is: The element 'p' in namespace 'http://www.w3.org/1999/xhtml'
has invalid child element 'name' in namespace
'http://www.sernaferna.com/employees'. List of possible elements expected:
'a, br, span, bdo, map, object, img, tt, i, b, big, small, em, strong, dfn,
code, q, samp, kbd, var, cite, abbr, acronym, sub, sup, input, select,
textarea, label, button, ins, del, script' in namespace
'http://www.w3.org/1999/xhtml'.
C:\Users\Tony\programmering\Websites\slask5\XMLFile.xml 7 25 C:\...\slask5\


<?xml version="1.0" ?>
<emp:employee xmlns:emp="http://www.sernaferna.com/employees"
xmlns:html="http://www.w3.org/1999/xhtml">
<emp:name>Jane Doe</emp:name>
<emp:notes>
<html:p>
I've worked with <emp:name>Jane Doe</emp:name> for over a
<em>year</em> now.
</html:p>
</emp:notes>
</emp:employee>

//Tony
 
A

Arne Vajhøj

I can't understand why I get warning on the Xml file below.
The warning is: The element 'p' in namespace
'http://www.w3.org/1999/xhtml' has invalid child element 'name' in
namespace 'http://www.sernaferna.com/employees'. List of possible
elements expected: 'a, br, span, bdo, map, object, img, tt, i, b, big,
small, em, strong, dfn, code, q, samp, kbd, var, cite, abbr, acronym,
sub, sup, input, select, textarea, label, button, ins, del, script' in
namespace 'http://www.w3.org/1999/xhtml'.
C:\Users\Tony\programmering\Websites\slask5\XMLFile.xml 7 25 C:\...\slask5\


<?xml version="1.0" ?>
<emp:employee xmlns:emp="http://www.sernaferna.com/employees"
xmlns:html="http://www.w3.org/1999/xhtml">
<emp:name>Jane Doe</emp:name>
<emp:notes>
<html:p>
I've worked with <emp:name>Jane Doe</emp:name> for over a <em>year</em>
now.
</html:p>
</emp:notes>
</emp:employee>

The error message is:

"The element 'p' in namespace
'http://www.w3.org/1999/xhtml' has invalid child element 'name' in
namespace 'http://www.sernaferna.com/employees'"

If you substitute the namespaces you get:

"The element 'html:p'
has invalid child element 'emp:name'"


Which means that you can not have an emp:name element
inside a html:p element.

This is defined in the schemas.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top