Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > web.xml / XML schema issue, why do some XML schema attributes disappear

Reply
Thread Tools

web.xml / XML schema issue, why do some XML schema attributes disappear

 
 
asciz@starmail.com
Guest
Posts: n/a
 
      02-19-2007
Hi

I'm trying to get my j2ee app to run on Jboss (version 3.2.3), but
Jboss complains there are some missing attributes in the web-app
element. The attributes are present in the XML file, but they seem to
be removed by the parser, also when I view the file in a web browser.

My XML below (I have cut out a lot of stuff for the purpose of this
post)

<?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"
xmlnssi="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, the only two attributes shown
are "version" and "xsi:schemaLocation".

Can anyone explain why this happens and whether it is the correct
behaviour?

Many thanks
asciz

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      02-20-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> <?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"
> xmlnssi="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, the only two attributes shown
> are "version" and "xsi:schemaLocation".
>
> Can anyone explain why this happens and whether it is the correct
> behaviour?


Namespace declarations are not attributes. "xmlns" and "xmlnssi" are
namespace declarations, not attributes. They allow the parser to recognize
elements and attributes. The first namespace is the default namespace, and it
allows the parser to recognize the "version" attribute, which does not have a
namespace prefix. The "xmlnssi" namespace declaration allows the parser to
recognize the "xsi:schemaLocation" attribute.

- Lew
 
Reply With Quote
 
 
 
 
asciz@starmail.com
Guest
Posts: n/a
 
      02-20-2007
On 20 Feb, 01:59, Lew <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > <?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"
> > xmlnssi="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, the only two attributes shown
> > are "version" and "xsi:schemaLocation".

>
> > Can anyone explain why this happens and whether it is the correct
> > behaviour?

>
> Namespace declarations are not attributes. "xmlns" and "xmlnssi" are
> namespace declarations, not attributes. They allow the parser to recognize
> elements and attributes. The first namespace is the default namespace, and it
> allows the parser to recognize the "version" attribute, which does not have a
> namespace prefix. The "xmlnssi" namespace declaration allows the parser to
> recognize the "xsi:schemaLocation" attribute.
>
> - Lew


Lew, thanks for explaining the difference between namespace
declarations and attributes.

I still don't understand, however, why my JBoss (version 3.2.3) does
not appear to "see" these declarations. I've based my web.xml on
examples that are supposed to work. I have not had the same problem on
JBoss 4.x.

Does anyone recognize this issue? I've seen some posts on similar
problem, but no explanation.

Thanks in advance,
-asciz

 
Reply With Quote
 
asciz@starmail.com
Guest
Posts: n/a
 
      02-20-2007
On 20 Feb, 09:43, (E-Mail Removed) wrote:
> On 20 Feb, 01:59, Lew <(E-Mail Removed)> wrote:
>
>
>
> > (E-Mail Removed) wrote:
> > > <?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"
> > > xmlnssi="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, the only two attributes shown
> > > are "version" and "xsi:schemaLocation".

>
> > > Can anyone explain why this happens and whether it is the correct
> > > behaviour?

>
> > Namespace declarations are not attributes. "xmlns" and "xmlnssi" are
> > namespace declarations, not attributes. They allow the parser to recognize
> > elements and attributes. The first namespace is the default namespace, and it
> > allows the parser to recognize the "version" attribute, which does not have a
> > namespace prefix. The "xmlnssi" namespace declaration allows the parser to
> > recognize the "xsi:schemaLocation" attribute.

>
> > - Lew

>
> Lew, thanks for explaining the difference between namespace
> declarations and attributes.
>
> I still don't understand, however, why my JBoss (version 3.2.3) does
> not appear to "see" these declarations. I've based my web.xml on
> examples that are supposed to work. I have not had the same problem on
> JBoss 4.x.
>
> Does anyone recognize this issue? I've seen some posts on similar
> problem, but no explanation.
>
> Thanks in advance,
> -asciz


Perhaps some debug output would be appropriate. I wonder if the fact
that the parser refers to "xmlns" as an 'attribute' is a clue; maybe
the parser does not understand namespaces etc?
Greatful for any suggestions.
-asciz

09:48:04,000 INFO [EmbeddedTomcatService] deploy, ctxPath=/myapp,
warUrl=file:/C:/bin/jboss-3.2.3/server/all/tmp/deploy/
tmp51713MyApp.ear-contents/MyApp.war/
09:48:04,265 ERROR [Digester] Parse Error at line 7 column 219:
Attribute "xmlns" must be declared for element type "web-app".
org.xml.sax.SAXParseException: Attribute "xmlns" must be declared for
element type "web-app".
at
org.apache.xerces.util.ErrorHandlerWrapper.createS AXParseException(ErrorHandlerWrapper.java:
232)
at
org.apache.xerces.util.ErrorHandlerWrapper.error(E rrorHandlerWrapper.java:
173)
at
org.apache.xerces.impl.XMLErrorReporter.reportErro r(XMLErrorReporter.java:
362)
at
org.apache.xerces.impl.XMLErrorReporter.reportErro r(XMLErrorReporter.java:
296)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDD efaultAttrsAndValidate(XMLDTDValidator.java:
2166)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleS tartElement(XMLDTDValidator.java:
2885)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.startEl ement(XMLDTDValidator.java:
792)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanStartElement(XMLDocumentFragmentScannerImp l.java:
752)
at org.apache.xerces.impl.XMLDocumentScannerImpl
$ContentDispatcher.scanRootElementHook(XMLDocument ScannerImpl.java:
927)
at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl
$FragmentContentDispatcher.dispatch(XMLDocumentFra gmentScannerImpl.java:
1519)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanDocument(XMLDocumentFragmentScannerImpl.ja va:
333)
at
org.apache.xerces.parsers.StandardParserConfigurat ion.parse(StandardParserConfiguration.java:
529)
at
org.apache.xerces.parsers.StandardParserConfigurat ion.parse(StandardParserConfiguration.java:
585)
at org.apache.xerces.parsers.XMLParser.parse(XMLParse r.java:
147)
at
org.apache.xerces.parsers.AbstractSAXParser.parse( AbstractSAXParser.java:
114
at org.apache.commons.digester.Digester.parse(Digeste r.java:
154
at
org.jboss.web.tomcat.tc4.SingleSignOnContextConfig .applicationConfig(SingleSignOnContextConfig.java:
299)
at
org.jboss.web.tomcat.tc4.SingleSignOnContextConfig .start(SingleSignOnContextConfig.java:
741)
at
org.jboss.web.tomcat.tc4.SingleSignOnContextConfig .lifecycleEvent(SingleSignOnContextConfig.java:
255)
at
org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:
166)
at
org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:
3582)
at
org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:
821)
at
org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:
807)
at
org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:595)
at
org.jboss.web.tomcat.tc4.EmbeddedTomcatService.cre ateWebContext(EmbeddedTomcatService.java:
549)
at
org.jboss.web.tomcat.tc4.EmbeddedTomcatService.per formDeploy(EmbeddedTomcatService.java:
309)
at
org.jboss.web.AbstractWebContainer.start(AbstractW ebContainer.java:
42
at org.jboss.deployment.MainDeployer.start(MainDeploy er.java:
832)
at org.jboss.deployment.MainDeployer.start(MainDeploy er.java:
824)
at org.jboss.deployment.MainDeployer.deploy(MainDeplo yer.java:
642)
at org.jboss.deployment.MainDeployer.deploy(MainDeplo yer.java:
605)
at sun.reflect.GeneratedMethodAccessor26.invoke(Unkno wn
Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.jboss.mx.capability.ReflectedMBeanDispatcher.i nvoke(ReflectedMBeanDispatcher.java:
284)
at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyE xt.java:
177)
at $Proxy6.deploy(Unknown Source)
at
org.jboss.deployment.scanner.URLDeploymentScanner. deploy(URLDeploymentScanner.java:
302)
at
org.jboss.deployment.scanner.URLDeploymentScanner. scan(URLDeploymentScanner.java:
476)
at org.jboss.deployment.scanner.AbstractDeploymentSca nner
$ScannerThread.doScan(AbstractDeploymentScanner.ja va:201)
at org.jboss.deployment.scanner.AbstractDeploymentSca nner
$ScannerThread.loop(AbstractDeploymentScanner.java :212)
at org.jboss.deployment.scanner.AbstractDeploymentSca nner
$ScannerThread.run(AbstractDeploymentScanner.java: 191)
09:48:04,343 ERROR [Digester] Parse Error at line 7 column 219:
Attribute "xmlnssi" must be declared for element type "web-app".
org.xml.sax.SAXParseException: Attribute "xmlnssi" must be declared
for element type "web-app".
at
org.apache.xerces.util.ErrorHandlerWrapper.createS AXParseException(ErrorHandlerWrapper.java:
232)
at
org.apache.xerces.util.ErrorHandlerWrapper.error(E rrorHandlerWrapper.java:
173)
....

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do XML schema attributes disappear? asciz@starmail.com XML 5 02-19-2007 04:30 PM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Outlook Express Messages Disappear, Bookmarks in Internet Explorer Disappear rchrdcarlisle@NOTyahoo.com Computer Support 19 07-30-2006 09:41 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM



Advertisments