Problem about XmlQName

Chun-Hsiung Tseng <[email protected]>
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <[email protected]>
Hello, when using XmlQName (and its related functionalities), I encountered
some weird behavior

First of all, the xml document (and schema) for test comes from an OASIS
spec:
http://docs.oasis-open.org/bpel4people/ws-humantask-1.1-spec-cd-06.html

schema files:
http://docs.oasis-open.org/bpel4people/ws-humantask.xsd
http://docs.oasis-open.org/bpel4people/ws-humantask-context.xsd
http://docs.oasis-open.org/bpel4people/ws-humantask-policy.xsd
http://docs.oasis-open.org/bpel4people/ws-humantask-types.xsd

xml document:
http://docs.oasis-open.org/bpel4people/ws-humantask-1.1-spec-cd-06.pdf (page
196)

Encountered Problem:

I've made three different tests; within all tests, "xmlDoc" refers to the
Document instance of the sample xml document
============================================================================================================
The first test:

Element
task=(Element)(XPathFactory.newInstance().newXPath().evaluate("//*[@name=\"ApproveClaim\"]",xmlDoc,
XPathConstants.NODE));
xmlObject=XmlObject.Factory.parse(task);
org.oasisOpen.docs.ns.bpel4People.wsHumantask.x200803.impl.TaskDocumentImpl
taskImpl=(TaskDocumentImpl) xmlObject;
System.out.println(taskImpl.getTask().getInterface().getPortType());

The result is: Invalid QName value: Can't resolve prefix 'cl'
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The second test:

Element
task=(Element)(XPathFactory.newInstance().newXPath().evaluate("//*[@name=\"ApproveClaim\"]",xmlDoc,
XPathConstants.NODE));
xmlObject=XmlObject.Factory.parse(task);
org.oasisOpen.docs.ns.bpel4People.wsHumantask.x200803.impl.TaskDocumentImpl
taskImpl=(TaskDocumentImpl) xmlObject;
System.out.println(taskImpl.getTask().getInterface().getDomNode().lookupNamespaceURI("cl"));

The result is: dom level 3 not implemented
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The third test:

XmlQName q=XmlQName.Factory.parse("<xml-fragment xmlns:cl=\"
http://www.example.com/claims/\">cl:sample</xml-fragment>");
System.out.println(q.getStringValue());
System.out.println(q.getQNameValue());

The result is:
cl:sample
{http://www.example.com/claims/}sample
============================================================================================================

Note that the result of the third test is correct while test1 and test2
failed.

Since according to the schema,
"taskImpl.getTask().getInterface().getPortType()" should return the value of
an attribute that has a QName type,
I assumed that taskImpl.getTask().getInterface().getPortType() also
leverages the functionality provided by XmlQName.

However, the result above appears inconsistent, is there any suggestions or
comments? Thanks!



-- 
XML to User Interface Binding: http://www.xuib.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.