users@jaxb.java.net

Re: QName parsing issue

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 14 May 2007 17:11:36 -0700

Andrew Fielden wrote:
> I've defined a schema which contains details of a WSDL. These details
> include the port name, service and operation. Here is a fragment of the
> XML which conforms to my schema -
>
> <Selected_Operation>
> <ns1:Service_Name
> xmlns:ns1="http://www.staffware.com/2002/WebServicesEAIPlugin"
> xmlns="http://xmlns.example.com/1169732524765">intfincoming_(1)-service<
> /ns1:Service_Name>
> </Selected_Operation>
>
>
> The Service_Name element is represented in my schema as type xs:QName,
> Where xs=http://www.w3.org/2001/XMLSchema.
>
> I can successfully marshal and serialize the schema. However when I try
> to unmarshal (de-serialize) it, I get a problem (see stack trace).
>
> The problem is being caused by the presence of the '(' and ')'
> characters. If I remove these, the XML parses ok. I've checked the W3C
> spec for QName, and it appears that these characters are not valid.

Right.

> The questions I have are:
>
> 1. Why can I serialize this XML structure, but not de-serialize it?

Because the marshaller doesn't enforce several rules.

> 2. Why is this QName valid in the context of a WSDL, but not valid when
> I try to use it in XML conforming to my schema?

It's not valid in the context of WSDL either.

> I'm using Jaxb1.4. It would be really helpful to have the source for
> this. Can anyone tell me where I can obtain this from?
>
> Thanks.
> Andrew.
>
>
> DefaultValidationEventHandler: [ERROR]: "intfincoming_(1)-service" does
> not satisfy the "QName" type
> Location:
> 0 [main] FATAL
> com.staffware.integration.eaidesigntime.guifactory.integrationwizard.SWI
> ntegrationWizardFactory - Unable to parse XML
> com.sun.msv.verifier.ValidityViolation: "intfincoming_(1)-service" does
> not satisfy the "QName" type
> at com.sun.msv.verifier.Verifier.onError(Verifier.java:367)
> at com.sun.msv.verifier.Verifier.onError(Verifier.java:363)
> at com.sun.msv.verifier.Verifier.verifyText(Verifier.java:146)
> at com.sun.msv.verifier.Verifier.endElement(Verifier.java:319)
> at
> com.sun.msv.verifier.VerifierFilter.endElement(VerifierFilter.java:102)
> at
> org.iso_relax.verifier.impl.ForkContentHandler.endElement(ForkContentHan
> dler.java:80)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(
> AbstractSAXParser.java:585)
> at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEnd
> Element(XMLNSDocumentScannerImpl.java:560)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$F
> ragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:15
> 55)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s
> canDocument(XMLDocumentFragmentScannerImpl.java:341)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML1
> 1Configuration.java:828)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML1
> 1Configuration.java:758)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.jav
> a:148)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Abstr
> actSAXParser.java:1178)
> at
> com.staffware.integration.eaishared.jaxb.eaiplugin.impl.runtime.Unmarsha
> llerImpl.unmarshal(UnmarshallerImpl.java:140)
> at
> javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmars
> hallerImpl.java:131)
> at
> com.staffware.integration.eaidesigntime.guifactory.integrationwizard.SWI
> ntegrationWizardFactory.parseStepData(SWIntegrationWizardFactory.java:68
> 1)
> at
> com.staffware.integration.eaidesigntime.guifactory.integrationwizard.SWI
> ntegrationWizardFactory.createWizard(SWIntegrationWizardFactory.java:615
> )
> at WebSvcsTestClient.testWizard(WebSvcsTestClient.java:143)
> at WebSvcsTestClient.main(WebSvcsTestClient.java:114)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com