![]() |
web.xml / XML schema issue, why do some XML schema attributes disappear
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" 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, 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 |
Re: web.xml / XML schema issue, why do some XML schema attributesdisappear
asciz@starmail.com 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" > 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, 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 "xmlns:xsi" 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 "xmlns:xsi" namespace declaration allows the parser to recognize the "xsi:schemaLocation" attribute. - Lew |
Re: web.xml / XML schema issue, why do some XML schema attributes disappear
On 20 Feb, 01:59, Lew <l...@nospam.lewscanon.com> wrote:
> a...@starmail.com 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" > > 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, 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 "xmlns:xsi" 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 "xmlns:xsi" 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 |
Re: web.xml / XML schema issue, why do some XML schema attributes disappear
On 20 Feb, 09:43, a...@starmail.com wrote:
> On 20 Feb, 01:59, Lew <l...@nospam.lewscanon.com> wrote: > > > > > a...@starmail.com 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" > > > 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, 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 "xmlns:xsi" 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 "xmlns:xsi" 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: 1148) at org.apache.commons.digester.Digester.parse(Digeste r.java: 1548) 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: 428) 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 "xmlns:xsi" must be declared for element type "web-app". org.xml.sax.SAXParseException: Attribute "xmlns:xsi" 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) .... |
| All times are GMT. The time now is 01:18 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.