I receive a large XML file and often the XML file do not validate to schema file.
Instead of droping the whole xml file I would like to remove the "invalid" content and save the rest of the XML file.
I'm using xmllint to validate the xml by this command:
xmllint -schema testSchedule.xsd testXML.xml
The XSD file (in this example named testSchedule.xsd):
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.testing.dk" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="MasterData">
<xs:complexType>
<xs:sequence>
<xs:element name="Items">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:integer" name="Id" minOccurs="1"/>
<xs:element type="xs:integer" name="Width" minOccurs="1"/>
<xs:element type="xs:integer" name="Height" minOccurs="0"/>
<xs:element type="xs:string" name="Remark"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
And the XML file (In this example named testXML.xml):
<?xml version="1.0" encoding="ISO-8859-1" ?>
<MasterData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.testing.dk">
<Items>
<Item>
<Id>1</Id>
<Width>10</Width>
<Height>100</Height>
<Remark>This is OK</Remark>
</Item>
<Item>
<Id>2</Id>
<Width>20</Width>
<Height>200</Height>
<Remark>This is OK - But is missing Height a non mandatory field</Remark>
</Item>
<Item>
<Id>3</Id>
<Height>300</Height>
<Remark>This is NOT OK - Missing the mandatory Width</Remark>
</Item>
<Item>
<Id>4</Id>
<Width>TheIsAString</Width>
<Height>200</Height>
<Remark>This is NOT OK - Width is not an integer but a string</Remark>
</Item>
<Item>
<Id>5</Id>
<Width>50</Width>
<Height>500</Height>
<Remark>This is OK and the last</Remark>
</Item>
</Items>
</MasterData>
Then I get the this result of the xmllint command:
testXML.xml:18: element Height: Schemas validity error : Element '{http://www.testing.dk}Height': This element is not expected. Expected is ( {http://www.testing.dk}Width ).
testXML.xml:23: element Width: Schemas validity error : Element '{http://www.testing.dk}Width': 'TheIsAString' is not a valid value of the atomic type 'xs:integer'.
testXML.xml fails to validate
And that is all correct - There is two errors in the XML file.
Now I would like to have a tool of some kind to remove entry 3 and 4 so I end up with this result:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<MasterData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.testing.dk">
<Items>
<Item>
<Id>1</Id>
<Width>10</Width>
<Height>100</Height>
<Remark>This is OK</Remark>
</Item>
<Item>
<Id>2</Id>
<Width>20</Width>
<Height>200</Height>
<Remark>This is OK - But is missing Height a non mandatory field</Remark>
</Item>
<Item>
<Id>5</Id>
<Width>50</Width>
<Height>500</Height>
<Remark>This is OK and the last</Remark>
</Item>
</Items>
</MasterData>
Does anybody in here have a tool that can do this?
I'm currently using bash scripting and the xmllint.
I really hope somebody can help.
You can achieve that with this XSLT stylesheet, which you can run in any environment which supports XSLT 1.0 (most languages), using an command line tool such as xsltproc (libxslt) or Saxon, a browser or an online tool. Here is an example.
If you feed your original XML file as input to a XSLT transformer with the following stylesheet it will produce the result you have shown in your second XML:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:t="http://www.testing.dk">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="t:Item[t:Id and not(number(t:Id))]"/>
<xsl:template match="t:Item[t:Width and not(number(t:Width))]"/>
<xsl:template match="t:Item[t:Height and not(number(t:Height))]"/>
<xsl:template match="t:Item[not(t:Width)]"/>
<xsl:template match="t:Item[not(t:Id)]"/>
<xsl:template match="t:Item[not(t:Remark)]"/>
</xsl:stylesheet>
The first <xsl:template> block simply copies all nodes from the source tree to the result tree. It has lower precedence than the specific templates which match nodes by their name.
Since matches are done in XPath which requires namespace-qualified selectors, your default namespace was declared in the <xsl:stylesheet> opening tag and mapped to a prefix that was used to qualify the tag names.
Each template uses an XPath expression to test if a specific child element is present or not in Item, or if that child is present, if it is a number (according to the XSD).
I'm using XSLT 1.0, which is more widely supported and should be easier to find in your environment. But if you can use a XSLT 2.0 processor, you could use XSLT 2.0 features such as support for XSD types, and instead of comparing your values to number type, you could compare them to specific types like xsd:integer.
You can verify the transformation performed on your example XML by that stylesheet in this XSLT Fiddle.
If you create a XML document containing the code above and place it in a file named stylesheet.xsl you can run the transformation using xsltproc (which probably exists in your environment) using:
xsltproc stylesheet.xsl testXML.xml > fixedXML.xml
Related
I have XML files that I need to validate against XSDs that are nested inside a <wsdl:types></wsdl:types> in a WSDL file retrieved from a web service.
Inside the <wsdl:types></wsdl:types> there are several <xs:schema>s. I am using the ruby gem nokogiri to load the XML files and validate them against said XSDs, however, I am getting following error when I run the program:
Element '{http://schemas.xmlsoap.org/soap/envelope/}Envelope': No
matching global declaration available for the validation root.
So far I have extracted out the <xs:schema>s (all 4 of them) and copied them into a schema.xsd file.
Code:
require 'rubygems'
require 'nokogiri'
def validate(document_path, schema_path)
schema = Nokogiri::XML::Schema(File.read(schema_path))
document = Nokogiri::XML(File.read(document_path))
schema.validate(document)
end
validate('data.xml', 'schema.xsd').each do |error|
puts error.message
end
So basically my schema.xsd has multiple <xs:schema>s in there, which I do not think in and of itself is a problem because nokogiri didn't throw errors when I instantiated the schema object.
schema.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType"/>
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
<!-- data in here -->
</xs:schema>
<!-- three more xs:schema tags removed for brevity -->
data.xml
<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header />
<env:Body>
<CreatePerson xmlns="https://person.example.com/">
<oMessageType xmlns:epa="http://schemas.datacontract.org/2004/07/whatever" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:array="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<person:bodyField>
<!-- data in here -->
</person:bodyField>
<!-- more data in here -->
</oMessageType>
</CreatePerson>
</env:Body>
</env:Envelope>
Yes, WSDL not the XSD scheam so you need to extract the schema partial manually or automatic by programming.
Here is the sample code, you need to refactor it and using in your codes.
str = <<EOF
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloService" targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
<element name="anyType" nillable="true" type="anyType"/>
<element name="anyURI" nillable="true" type="anyURI"/>
<!-- data in here -->
</schema>
</types>
<message name="SayHelloRequest">
<part name="firstName" type="xsd:string"/>
</message>
<message name="SayHelloResponse">
<part name="greeting" type="xsd:string"/>
</message>
<portType name="Hello_PortType">
<operation name="sayHello">
<input message="tns:SayHelloRequest"/>
<output message="tns:SayHelloResponse"/>
</operation>
</portType>
<binding name="Hello_Binding" type="tns:Hello_PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sayHello">
<soap:operation soapAction="sayHello"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:helloservice"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:helloservice"/>
</output>
</operation>
</binding>
<service name="Hello_Service">
<documentation>WSDL File for HelloService</documentation>
<port name="Hello_Port" binding="tns:Hello_Binding">
<soap:address location="http://www.examples.com/SayHello/"/>
</port>
</service>
</definitions>
EOF
require 'rubygems'
require 'nokogiri'
doc = Nokogiri::XML(str)
doc.root.children.each do |child|
if child.node_name == 'types'
types = child
# p types.inner_html
xsd_doc = Nokogiri::XML(types.inner_html)
# p xsd_doc.root
xsd = Nokogiri::XML::Schema.from_document xsd_doc.root
end
end
Say I have a valid XML instance file ("1") that contains only elements in the targetNamespace of its schema (Schema "A"). The instance is valid per this schema. Instance 1 has the correct namespace declaration for its schema on its (1's) root node, and nowhere else.
Now I take the same instance 1 and try to validate it against Schema "B".
B is identical to A except I changed elementFormDefault="unqualified" to elementFormDefault="qualified".
I am seeing 1 failing to validate against B. Why? What do I need to change in 1 (producing instance "2") to make it valid again against B?
Is the "qualified" flavor of an XML schema just for instances with an explicit namespace prefix on every single element?
Example schemas: All based on a minimal XML structure for communicating some data structures like file/record/info1. Unfortunately these seem to behave differently again from my real-world examples (which are too big to post here).
A: UNqualified schema
<?xml version="1.0" encoding="UTF-8"?>
<!-- The UNqualified version -->
<xs:schema elementFormDefault="unqualified" targetNamespace="http://example.com/xsd-prefixes-test"
xmlns:test="http://example.com/xsd-prefixes-test" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="file">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="test:record" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="record">
<xs:complexType>
<xs:sequence>
<xs:element ref="test:info1" />
<xs:element ref="test:info2" />
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required" />
<xs:attribute name="status" type="xs:NCName" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="info1">
<xs:complexType />
</xs:element>
<xs:element name="info2">
<xs:complexType />
</xs:element>
</xs:schema>
B: QUALIFIED schema
<?xml version="1.0" encoding="UTF-8"?>
<!-- The QUALIFIED version -->
<xs:schema elementFormDefault="qualified" targetNamespace="http://example.com/xsd-prefixes-test"
xmlns:test="http://example.com/xsd-prefixes-test" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="file">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="test:record" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="record">
<xs:complexType>
<xs:sequence>
<xs:element ref="test:info1" />
<xs:element ref="test:info2" />
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required" />
<xs:attribute name="status" type="xs:NCName" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="info1">
<xs:complexType />
</xs:element>
<xs:element name="info2">
<xs:complexType />
</xs:element>
</xs:schema>
Example schema instances:
Instance 1 - prefixes for the targetNamespace on all elements; validates against both schemas
<?xml version="1.0" encoding="UTF-8"?>
<!-- ALL prefixes -->
<test:file xmlns:test="http://example.com/xsd-prefixes-test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.com/xsd-prefixes-test xsd-prefixes-test_qualified.xsd">
<!-- validates against xsd-prefixes-test_UNqualified.xsd AND xsd-prefixes-test_qualified.xsd -->
<test:record id="1" status="ok">
<test:info1 />
<test:info2 />
<!-- etc... -->
</test:record>
<test:record id="1" status="ok">
<test:info1 />
<test:info2 />
<!-- etc... -->
</test:record>
<test:record id="1" status="duplicate_deprecated">
<test:info1 />
<test:info2 />
<!-- etc... -->
</test:record>
</test:file>
Instance 2: - no namespace prefixes anywhere but still validates against A and B!
<?xml version="1.0" encoding="UTF-8"?>
<!-- NO prefixes anywhere -->
<file xmlns="http://example.com/xsd-prefixes-test" xmlns:test="http://example.com/xsd-prefixes-test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.com/xsd-prefixes-test xsd-prefixes-test_qualified.xsd">
<!-- validates against BOTH xsd-prefixes-test_UNqualified.xsd AND xsd-prefixes-test_qualified.xsd -->
<record id="1" status="ok">
<info1 />
<info2 />
<!-- etc... -->
</record>
<record id="1" status="ok">
<info1 />
<info2 />
<!-- etc... -->
</record>
<record id="1" status="duplicate_deprecated">
<info1 />
<info2 />
<!-- etc... -->
</record>
</file>
Instance 3 - does not validate against either A or B - why not?
<?xml version="1.0" encoding="UTF-8"?>
<!-- NO prefixes anywhere -->
<test:file xmlns:test="http://example.com/xsd-prefixes-test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.com/xsd-prefixes-test xsd-prefixes-test_qualified.xsd">
<!-- validates against NEITHER xsd-prefixes-test_UNqualified.xsd NOR xsd-prefixes-test_qualified.xsd -->
<record id="1" status="ok">
<info1 />
<info2 />
<!-- etc... -->
</record>
<record id="1" status="ok">
<info1 />
<info2 />
<!-- etc... -->
</record>
<record id="1" status="duplicate_deprecated">
<info1 />
<info2 />
<!-- etc... -->
</record>
</test:file>
Error messages (same with both schemas A and B):
Instance 3 - cvc-complex-type.2.4.a: Invalid content was found starting with element 'record'. One of '{"http://example.com/xsd-prefixes-test":record}' is expected.
I am seeing this error or very similar with instance files along the pattern of both 1 and 2, when used with the schema of the "opposite" flavor (an instance with prefixes against a schema with unqualified).
Conversely I am seeing instances of style 3 that do validate against the qualified type schema.
Is there a dependency on what language/parser/validation engine is used?
There is this XSLT code in one of my projects
<xsl:template match="strategic-objectives/list/item" mode="table-of-contents">
<div class="toc">
<h3 class="report">Strategic objective: <xsl:value-of select="title"/></h3>
<xsl:variable name="flex_value" select="flex_value"/>
<xsl:apply-templates select="//root/data/operational-outcomes/list/item[sf = $flex_value]" mode="table-of-contents"/>
</div>
</xsl:template>
how much ever I try, the data for <operational-outcomes> does not match to sf = flex_value, but sf = '020000' matches.
I have checked the <flex_value> if proper in XML for the <strategic-objectives> item. It in fact also has 020000 as one of the values.
data
<data xsql-timing="3131">
<time>20 of April, 2014 (14:22) </time>
<strategic-objectives>
<list type="strategic_objective" xsql-timing="81">
<item num="1">
<context>PB08V6 </context>
<flex_value_set_name>ILO_AFF_SF </flex_value_set_name>
<attribute5>10 </attribute5>
<flex_value>010000 </flex_value>
<hierarchy_level>1 </hierarchy_level>
<title>Policy Making </title>
</item>
<item num="4">
<context>PB08V6 </context>
<flex_value_set_name>ILO_AFF_SF </flex_value_set_name>
<attribute5>10 </attribute5>
<flex_value>200000 </flex_value>
<hierarchy_level>1 </hierarchy_level>
<title>Employment </title>
<description> </description>
<text> </text>
</item>
</list>
</strategic-objectives>
<operational-outcomes>
<list type="outcome" xsql-timing="477">
<item num="9">
<context>PB08V6 </context>
<flex_value_set_name>ILO_AFF_SF </flex_value_set_name>
<flex_value>220025 </flex_value>
<parent_flex_value>220000 </parent_flex_value>
<hierarchy_level>3 </hierarchy_level>
<status>10 </status>
<attribute5>40 </attribute5>
<title>REVISED - Policies for growth, employment and poverty reduction </title>
<description></description>
<text> </text>
<sf>200000 </sf>
</item>
<item num="10">
<context>PB08V6 </context>
<flex_value_set_name>ILO_AFF_SF </flex_value_set_name>
<flex_value>740050 </flex_value>
<parent_flex_value>740000 </parent_flex_value>
<hierarchy_level>3 </hierarchy_level>
<status>10 </status>
<attribute5>40 </attribute5>
<title>DELETED - Internal Administration and Security </title>
<sf>700000 </sf>
</item>
</list>
</operational-outcomes>
</data>
Looking at your XML source, there's a white-space problem:
<flex_value>200000 </flex_value>
Every character matters, 200000␣␣␣␣ is not the same as 200000.
normalize-whitespace() strips leading and trailing whitespace, and collapses multiple subsequent whitespace characters within a string into one. Example:
<xsl:variable name="flex_value" select="normalize-space(flex_value)"/>
␣␣foo␣␣␣bar␣␣ becomes foo␣bar.
My requirement is like, consider the following sample xml
<user key="username" value="Test"/>
<user key="age" value="27"/>
<user key="email" value="my#my.com"/>
In this case all the element having same name, same number of attributes and same attribute names too..
but i need to validate the value attribute according to key. For example here first key is username and its value is a string type, second key is age and its value must be a positive integer and third key is email so the value should be an email address.
is there any way to achieve this.
I have come across similar question many times,
here are my accepted answers to the following post:
Restricting XML Elements Based on Another Element via XSD
XSD: How to validate the XML file according to value of some tag?
You can translate your XML data with a XSL transformation into a form which can be validated with a XSD schema. This does not require any special custom tools.
Your input data:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user key="username" value="Test"/>
<user key="age" value="27"/>
<user key="email" value="my#my.com"/>
</users>
Can be translated with the following transformation:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/users">
<users>
<xsl:apply-templates/>
</users>
</xsl:template>
<xsl:template match="//user">
<xsl:variable name="key" select="#key"/>
<xsl:variable name="value" select="#value"/>
<xsl:element name="{$key}">
<xsl:value-of select="$value"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
into the following form:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<username>Test</username>
<age>27</age>
<email>my#my.com</email>
</users>
And that can easily be validated with a standard XSD schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="users">
<xs:complexType>
<xs:sequence>
<xs:element name="username" type="xs:string"/>
<xs:element name="age" type="xs:positiveInteger"/>
<xs:element name="email">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value=".+#.+\.[^.]+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XSD doesn't support this kind of conditional validation. You need to use Schematron.
I have a.wsdl & b.wsdl where a.wsdl imports b.wsdl.
Now I have to customize the schema inside b.wsdl using wsimport and JAXB. but using below customization is giving error that "XPath evaluation of "wsdl:definitions/wsdl:types/xsd:schema[#targetNamespace='b']" results in an empty target node
I am not able to find a way to customize the inlined schema in imported b.wsdl when generating the client code using wsimport.
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema[#targetNamespace='b']"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<jaxb:globalBindings>
<jaxb:javaType name="java.util.Calendar" xmlType="xsd:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
printMethod="javax.xml.bind.DatatypeConverter.printDateTime" />
</jaxb:globalBindings>
</jaxws:bindings>
A.wsdl
<definitions targetNamespace="a"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:interface="b">
<import location="b.wsdl" namespace="b"/>
<service name="Service">
<port binding="interface:Binding" name="Port">
<soap:address location="https://localhost/sdk/vpxdService" />
</port>
</service>
</definitions>
B.wsdl
<definitions targetNamespace="b"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:b="b"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<schema
targetNamespace="b"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:b="b"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<complexType name="XYZ">
<sequence>
<element name="dynamicType" type="xsd:string" minOccurs="0" />
<element name="val" type="xsd:anyType" maxOccurs="unbounded" />
</sequence>
</complexType>
</types>
</schema>
</definitions>
After going through given website I modified the external binding file to use wsdlLocation="b.wsdl" instead of node="wsdl:definitions/wsdl:types/xsd:schema[#targetNamespace='b']" which did the magic.
This will make sure that the inline schema defined in WSDL will customized as required.
<bindings
xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"
version="2.0">
<bindings wsdlLocation="b.wsdl">
<globalBindings>
<javaType name="java.util.Calendar" xmlType="xsd:dateTime"
parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
printMethod="javax.xml.bind.DatatypeConverter.printDate"
/>
</globalBindings>
</bindings>
</bindings>
http://fusesource.com/docs/framework/2.1/jaxws/JAXWSCustomTypeMappingOverview.html
Have you tried adding the following attributes to the <jaxws:bindings> element?
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
and
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
You're referencing the xsd and wsdl namespaces in your xpath expression, but until you define the URI's for them, they won't match up with the URI's in the target documents.