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

Discussion in 'Java' started by asciz@starmail.com, Feb 19, 2007.

  1. Guest

    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
     
    , Feb 19, 2007
    #1
    1. Advertising

  2. Lew Guest

    Re: web.xml / XML schema issue, why do some XML schema attributesdisappear

    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, Feb 20, 2007
    #2
    1. Advertising

  3. Guest

    On 20 Feb, 01:59, Lew <> wrote:
    > 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
     
    , Feb 20, 2007
    #3
  4. Guest

    On 20 Feb, 09:43, wrote:
    > On 20 Feb, 01:59, Lew <> wrote:
    >
    >
    >
    > > 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.createSAXParseException(ErrorHandlerWrapper.java:
    232)
    at
    org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:
    173)
    at
    org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:
    362)
    at
    org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:
    296)
    at
    org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(XMLDTDValidator.java:
    2166)
    at
    org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:
    2885)
    at
    org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:
    792)
    at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:
    752)
    at org.apache.xerces.impl.XMLDocumentScannerImpl
    $ContentDispatcher.scanRootElementHook(XMLDocumentScannerImpl.java:
    927)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl
    $FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:
    1519)
    at
    org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
    333)
    at
    org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:
    529)
    at
    org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:
    585)
    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:
    147)
    at
    org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:
    1148)
    at org.apache.commons.digester.Digester.parse(Digester.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.fireLifecycleEvent(LifecycleSupport.java:
    166)
    at
    org.apache.catalina.core.StandardContext.start(StandardContext.java:
    3582)
    at
    org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
    821)
    at
    org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:
    807)
    at
    org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
    at
    org.jboss.web.tomcat.tc4.EmbeddedTomcatService.createWebContext(EmbeddedTomcatService.java:
    549)
    at
    org.jboss.web.tomcat.tc4.EmbeddedTomcatService.performDeploy(EmbeddedTomcatService.java:
    309)
    at
    org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:
    428)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:
    832)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:
    824)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:
    642)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:
    605)
    at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown
    Source)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at
    org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:
    284)
    at
    org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.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.AbstractDeploymentScanner
    $ScannerThread.doScan(AbstractDeploymentScanner.java:201)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner
    $ScannerThread.loop(AbstractDeploymentScanner.java:212)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner
    $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.createSAXParseException(ErrorHandlerWrapper.java:
    232)
    at
    org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:
    173)
    ....
     
    , Feb 20, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,677
    Markus
    Nov 23, 2005
  2. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,335
    Stanimir Stamenkov
    Apr 25, 2005
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    998
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,270
    Smokey Grindel
    Dec 2, 2006
  5. Replies:
    5
    Views:
    539
    Dimitre Novatchev
    Feb 19, 2007
Loading...

Share This Page