Why do XML schema attributes disappear?

A

asciz

Hi

I'm having a problem with an XML file, most likely because of my lack
of understanding of XML schemas

I have the following XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Hello</display-name>
</web-app>

When I view it in a browser for example, some of the attributes of the
<web-app> element are missing. The only two attributes shown are
"version" and "xsi:schemaLocation".

Does anyone know why the other attributes are removed when viewed?

Many thanks
asciz
 
D

Dimitre Novatchev

Hi

I'm having a problem with an XML file, most likely because of my lack
of understanding of XML schemas

I have the following XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Hello</display-name>
</web-app>

When I view it in a browser for example, some of the attributes of the
<web-app> element are missing. The only two attributes shown are
"version" and "xsi:schemaLocation".

Does anyone know why the other attributes are removed when viewed?

That simply means that the "pretty-printing" your browser is using is quite
wrong!

Try viewing this xml file with (for examle) IE6 or IE7 and you'll see that
all attributes are displayed.

Of course, I'd not recommend trusting your browser (BTW, which one is it?)
for viewing xml!


Cheers,
Dimitre Novatchev
 
M

Martin Honnen

I have the following XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Hello</display-name>
</web-app>

When I view it in a browser for example, some of the attributes of the
<web-app> element are missing. The only two attributes shown are
"version" and "xsi:schemaLocation".

Does anyone know why the other attributes are removed when viewed?

Which browser is that, Mozilla or Firefox? In that case you are better
off to directly view the source of the loaded XML.
 
A

asciz

Hi, thanks for reply

I'm using Firefox version 1.5.0.7

I also have some other software that seem to do it, hence my problem.
It is JBoss version 3.2.3 that complains that the attributes are
missing, even though they are actually there in the XML file

Thanks
-asciz
 
M

Martin Honnen

I'm using Firefox version 1.5.0.7

Firefox uses a default XSLT stylesheet to transform the XML document to
some collapsible HTML pretty printing but unfortunately the XSLT
processor Mozilla has does not support the namespace axis so that is why
xmlns or xmlns:prefix attributes are not shown.
I also have some other software that seem to do it, hence my problem.
It is JBoss version 3.2.3 that complains that the attributes are
missing, even though they are actually there in the XML file

I don't know JBoss so I can't help. But not displaying attributes and
complaining that they are not there are different issues
 
D

Dimitre Novatchev

Firefox uses a default XSLT stylesheet to transform the XML document to
some collapsible HTML pretty printing but unfortunately the XSLT processor
Mozilla has does not support the namespace axis so that is why xmlns or
xmlns:prefix attributes are not shown.

The "lack of namespace axis support" is not the reason -- the default
stylesheet is simply not doing what it's expected to do.

For comparison, see how the XPath Visualizer for Firefox (Mozilla) handles
and displays namespace nodes without problems:

http://www.topxml.com/code/default.asp?p=3&id=v20021221025528

Cheers,
Dimitre Novatchev
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top