I am using JAXB with the following customized binding :
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="2.0" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jaxb:globalBindings typesafeEnumMaxMembers="2000">
<jaxb:serializable />
</jaxb:globalBindings>
<jaxb:bindings schemaLocation="test.xsd" node="/xs:schema//xs:complexType[#name='EN']//xs:element[#name='family']">
<jaxb:property>
<jaxb:baseType name="java.lang.String" />
</jaxb:property>
</jaxb:bindings>
</jaxb:bindings>
to handle this schema (test.xsd):
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:complexType name="EN" mixed="true">
<xsd:complexContent>
<xsd:extension base="ANY">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="family" type="en.family"/>
</xsd:choice>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="en.family" mixed="true">
<xsd:complexContent>
<xsd:restriction base="ENXP">
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ENXP" mixed="true">
<xsd:complexContent>
<xsd:extension base="ST">
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ST" mixed="true">
<xsd:complexContent>
<xsd:restriction base="ED">
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ED" mixed="true">
<xsd:complexContent>
<xsd:extension base="BIN">
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="BIN" abstract="true" mixed="true">
<xsd:complexContent>
<xsd:extension base="ANY">
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ANY" abstract="true">
<xsd:attribute name="nullFlavor" type="xsd:string" use="optional">
</xsd:attribute>
</xsd:complexType>
</xsd:schema>
And I experiencing this problem :
[ERROR] compiler was unable to honor this property customization. It is attached to a wrong place, or its inconsistent with other bindings.
line 6 of file://home/user/test/jaxbelem_binding.xml
[ERROR] (the above customization is attached to the following location in the schema)
line 7 of file://home/user/test/test.xsd
Failed to parse a schema.
What's wrong with my binding file?
It's yaling about jaxb:property, but when the latter is deleted, no overriding happens!
Any help will be really appreciated, thanks in advance folks!
I have had luck nesting the jxb:bindings node tag inside of the jxb:bindings schemaLocation tag like this:
<?xml version="1.0" encoding="US-ASCII" ?>
<jxb:bindings version="2.0"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
>
<jxb:bindings schemaLocation="test.xsd">
<jxb:bindings node="//xs:element[#name='family']">
<jxb:property >
<jxb:baseType name="java.lang.String"></jxb:baseType>
</jxb:property>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
also:
while your note xpath to 'family' works, it seems overly complicated. I updated it to one that works given your example xsd (as long as there is only one element with name='family' it will work)
Related
I am building a Node system where as per requirement wsdl from other source(Siebel) is getting consumed. Am using soap npm to build this, but while sending request to Siebel error appears like "Error: Inbound SOAP Message - Session Token is missing or invalid or has expired". Googled it out and looks like related to authentication issue, so added "client.setSecurity(new soap.WSSecurity('username', 'password'))" in the code. Final code looks like as below:
var soap = require('soap');
var url = 'http___siebel.com_xml_CustomPay_AAA Payment Service BS.WSDL';
var args = {
amount:'100',
transactionReference:'abc123',
orderId:'50',
customerId:'112211',
merchantTransactionDateTime:'22/01/2020',
RequestHeader: {serviceName:'Pay',
operation: 'Create',
reqSystemName: 'Node',
originatorID: '112205',
originatorIP: 'aa.aa.aa.aa',
hostName: 'siebelbuild'}
}
//client.addSoapHeader(RequestHeader,"","tns","http://siebel.com/xml/CustomPay")
soap.createClient(url, function(err, client) {
client.setSecurity(new soap.WSSecurity('username', '****word'))
client.Upsert1(args, function(err, result) {
console.log(result);
});
});
WSDL file looks like:
<?xml version="1.0" encoding="UTF-8" ?>
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsdLocal1="http://www.siebel.com/xml/XXXGovPayRequest" targetNamespace="http://siebel.com/xml/CustomPay" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsdLocal2="http://www.siebel.com/xml/XXXGovPayResponse" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://siebel.com/xml/CustomPay">
- <types>
- <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://www.siebel.com/xml/XXXGovPayResponse" xmlns:xsdLocal2="http://www.siebel.com/xml/XXXGovPayResponse" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:annotation>
<xsd:documentation>Copyright (C) 2001-2004 Siebel Systems, Inc. All rights reserved. Siebel XSD Generation</xsd:documentation>
</xsd:annotation>
<xsd:element name="XXXGovPayResponse" type="xsdLocal2:XXXGovPayResponse" />
+ <xsd:complexType name="XXXGovPayResponseTopElmt">
- <xsd:sequence>
<xsd:element name="XXXGovPayResponse" maxOccurs="1" minOccurs="1" type="xsdLocal2:XXXGovPayResponse" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="XXXGovPayResponse">
- <xsd:sequence>
<xsd:element name="OneOffPaymentDetailResponse" maxOccurs="unbounded" minOccurs="1" type="xsdLocal2:OneOffPaymentDetailResponse" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="OneOffPaymentDetailResponse">
- <xsd:sequence>
<xsd:element name="transactionReference" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="ResponseHeader" maxOccurs="1" minOccurs="0" type="xsdLocal2:ResponseHeader" />
<xsd:element name="Response" maxOccurs="1" minOccurs="0" type="xsdLocal2:Response" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="ResponseHeader">
- <xsd:sequence>
<xsd:element name="sourceObjectId" maxOccurs="1" minOccurs="0" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="Response">
+ <xsd:sequence>
<xsd:element name="responseCode" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="responseMessage" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="ResponseDetails" maxOccurs="1" minOccurs="0" type="xsdLocal2:ResponseDetails" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="ResponseDetails">
- <xsd:sequence>
<xsd:element name="errorCode" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="errorDescription" maxOccurs="1" minOccurs="0" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
- <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xsdLocal1="http://www.siebel.com/xml/XXXGovPayRequest" targetNamespace="http://www.siebel.com/xml/XXXGovPayRequest" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:annotation>
<xsd:documentation>Copyright (C) 2001-2004 Siebel Systems, Inc. All rights reserved. Siebel XSD Generation</xsd:documentation>
</xsd:annotation>
<xsd:element name="XXXGovPayRequest" type="xsdLocal1:XXXGovPayRequest" />
- <xsd:complexType name="XXXGovPayRequestTopElmt">
- <xsd:sequence>
<xsd:element name="XXXGovPayRequest" maxOccurs="1" minOccurs="1" type="xsdLocal1:XXXGovPayRequest" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="XXXGovPayRequest">
- <xsd:sequence>
<xsd:element name="oneOffPaymentDetailRequest" maxOccurs="1" minOccurs="1" type="xsdLocal1:oneOffPaymentDetailRequest" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="oneOffPaymentDetailRequest">
- <xsd:sequence>
<xsd:element name="paymentInputs" maxOccurs="1" minOccurs="1" type="xsdLocal1:paymentInputs" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="paymentInputs">
- <xsd:sequence>
<xsd:element name="acquirerResponseCode" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="acquirerResponseDescription" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="amount" maxOccurs="1" minOccurs="1" type="xsd:string" />
<xsd:element name="RequestHeader" maxOccurs="1" minOccurs="0" type="xsdLocal1:RequestHeader" />
<xsd:element name="cardScheme" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="chargeAmount" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="creditDebitIndicator" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="maskedPan" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="merchantTransactionDateTime" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="orderAmount" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="responseCode" maxOccurs="1" minOccurs="1" type="xsd:string" />
<xsd:element name="responseDescription" maxOccurs="1" minOccurs="1" type="xsd:string" />
<xsd:element name="transactionDateTime" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="authorizationCode" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="merchantId" maxOccurs="1" minOccurs="1" type="xsd:string" />
<xsd:element name="transactionReference" maxOccurs="1" minOccurs="1" type="xsd:string" />
<xsd:element name="orderId" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="customerId" maxOccurs="1" minOccurs="1" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="RequestHeader">
- <xsd:sequence>
<xsd:element name="serviceName" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="operation" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="reqSystemName" maxOccurs="1" minOccurs="1" type="xsd:string" />
<xsd:element name="originatorID" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="originatorIP" maxOccurs="1" minOccurs="0" type="xsd:string" />
<xsd:element name="sourceObjectId" maxOccurs="1" minOccurs="1" type="xsd:string" />
<xsd:element name="hostName" maxOccurs="1" minOccurs="0" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
- <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://siebel.com/xml/CustomPay" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.siebel.com/xml/XXXGovPayResponse" />
<xsd:import namespace="http://www.siebel.com/xml/XXXGovPayRequest" />
- <xsd:element name="Upsert1_Input">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element ref="xsdLocal1:XXXGovPayRequest" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="Upsert1_Output">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element ref="xsdLocal2:XXXGovPayResponse" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
- <message name="Upsert1_Input">
<part name="Upsert1_Input" element="tns:Upsert1_Input" />
</message>
- <message name="Upsert1_Output">
<part name="Upsert1_Output" element="tns:Upsert1_Output" />
</message>
- <portType name="XXXPaymentServiceBS">
- <operation name="Upsert1">
<input message="tns:Upsert1_Input" />
<output message="tns:Upsert1_Output" />
</operation>
</portType>
- <binding name="XXXPaymentServiceBS" type="tns:XXXPaymentServiceBS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <operation name="Upsert1">
<soap:operation soapAction="document/http://siebel.com/xml/CustomPay:Upsert1" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <service name="XXX_spcPayment_spcService_spcBS">
- <port binding="tns:XXXPaymentServiceBS" name="XXXPaymentServiceBS">
<soap:address location="http://aa.aa.bb.bb.:8080/eai_enu/start.swe?SWEExtSource=WebService&SWEExtCmd=Execute&WSSOAP=1" />
</port>
</service>
</definitions>
Also imported the wsdl in soapUI tool to check but result is same.
Could someone please help.
Depends on how the provider has setup the security. Try passing userid and password as SOAP headers. Try these soap headers
<UsernameToken>{username}</UsernameToken>
<PasswordText>{password}<PasswordText>
When extending the Oasis BaseFaultType from another xsd of a different namespace would the xsd:any ##other by default put all of the extended class members within it?
This is the relevant part of Oasis BaseFaultType
<xsd:element name="BaseFault" type="wsrf-bf:BaseFaultType" />
<xsd:complexType name="BaseFaultType">
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax" />
<xsd:element name="Timestamp" type="xsd:dateTime" />
<xsd:element minOccurs="0" name="Originator" type="wsa:EndpointReferenceType" />
<xsd:element minOccurs="0" name="ErrorCode">
And here is the example of the extension
<xsd:schema xmlns:ws-bf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:cmn="http://customer.com/schema/common/v1" xmlns:tns="http://customer.com/contract/vfo/fault/v1" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://customer.com/contract/vfo/fault/v1" version="1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import schemaLocation="./bf-2.xsd" namespace="http://docs.oasis-open.org/wsrf/bf-2" />
<xsd:import schemaLocation="./Meta.xsd" namespace="http://customer.com/schema/common/v1" />
<xsd:import schemaLocation="./CodeLists.xsd" namespace="http://customer.com/schema/common/v1" />
<xsd:element name="Fault" type="tns:FaultType">
</xsd:element>
<xsd:complexType name="FaultType">
<xsd:complexContent mixed="false">
<xsd:extension base="ws-bf:BaseFaultType">
<xsd:sequence>
<xsd:element minOccurs="0" name="Name" type="xsd:normalizedString">
</xsd:element>
Which is part of a parent XSD
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:cmn="http://customer.com/schema/common/v1" xmlns:tns="http://customer.com/contract/vho/header/v1" xmlns:vfo="http://customer.com/contract/vfo/fault/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://customer.com/contract/vho/header/v1" version="1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import schemaLocation="./Fault.xsd" namespace="http://customer.com/contract/vfo/fault/v1" />
<xsd:element name="Source" type="tns:SourceType" />
<xsd:element name="Destination" type="tns:DestinationType" />
<xsd:element name="Correlation" type="tns:CorrelationType" />
<xsd:element name="Cache" type="tns:CacheType" />
<xsd:element name="ServiceDocumentation" type="tns:ServiceDocumentationType" />
<xsd:element name="ResultStatus" type="vfo:FaultType" />
What I need is an XSD expert to tell me if this complies to W3C standard when the xml response expected is as follows :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<tns:ResultStatus xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:vfo="http://customer.com/contract/vfo/fault/v1" xmlns:cmn="http://customer.com/schema/common/v1" xmlns:ns3="http://www.w3.org/2005/08/addressing" xmlns:ns2="http://docs.oasis-open.org/wsrf/bf-2" xmlns:ns1="urn:un:unece:uncefact:documentation:standard:CoreComponentType:2" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://customer.com/contract/vho/header/v1">
<vfo:Name>1006</vfo:Name>
<vfo:Message>Invalid ChargeAccountNumber (not found).</vfo:Message>
<ns2:Timestamp>2017-06-19T10:18:48.467+01:00</ns2:Timestamp>
</tns:ResultStatus>
</soapenv:Header>
<soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" />
</soapenv:Envelope>
In this cut for brevity example, would the Name value belong to the Any structure of BaseFaultType or the parent extension FaultType? And if not, why not?
Are there any tools that would allow me to report on the validity of the response against the schema?
BaseFault cannot be extended outside of its own namespace. The flaw was never corrected during early design :
https://lists.oasis-open.org/archives/wsrf/200506/msg00060.html
In the below xsd, I want to make the EDI_DC element as mandatory.I tried by using minOccurs="1" and nillable="false" but it is not working.
please suggest me any other way here to make this element as mandatory.
xsd:
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
xmlns:tns="http://TargetNamespace.com/sdg"
targetNamespace="http://www.oracle.com/ias/processconnect"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
nxsd:stream="chars"
nxsd:version="NXSD">
<xsd:element name="Root-Element">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="EDI_DC" nxsd:startsWith="EDI_DC" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="tabnam"
type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="4"
/>
<xsd:element name="mandt"
type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="3"
/>
<xsd:element name="docnum"
type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="16"
/>
<xsd:element name="docrel"
type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="4"
/>
<xsd:element name="EDI_DCeol"
type="xsd:string"
nxsd:style="terminated"
nxsd:terminatedBy="${eol}" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="E2EDL20" nxsd:startsWith="E2EDL20">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="segnam_ver" type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="23"
/>
<xsd:element name="mandt" type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="3" />
<xsd:element name="docnum" type="xsd:string"
nxsd:style="fixedLength"
nxsd:length="16" />
<xsd:element name="E2EDL20EOL" type="xsd:string"
nxsd:style="terminated"
nxsd:terminatedBy="${eol}"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
folks, i need your help with the following.
my xml looks like this:
<Images>
<Image ImageId="1" ImageFile="a.png"/>
<Image ImageId="2" ImageFile="b.png"/>
<Image ImageId="3" ImageFile="c.png"/>
<Image ImageId="4" ImageFile="d.png"/>
<Image ImageId="5" ImageFile="e.png"/>
</Images>
<Banners>
<Banner BannerId="1" ImageId="2"/>
<Banner BannerId="43" ImageId="3"/>
<Banner BannerId="45" ImageId="4"/>
<Banner BannerId="596" ImageId="2"/>
<Banner BannerId="6" ImageId="2"/>
</Banners>
i need to create an xsd that will restrict ImageId values in Banner elements to those appearing in Images. Is it possible?
Yes; the XML schema components you need are key/keyref:
<?xml version="1.0" encoding="utf-8"?>
<!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="sample">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Images">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="Image">
<xsd:complexType>
<xsd:attribute name="ImageId" type="xsd:unsignedByte" use="required"/>
<xsd:attribute name="ImageFile" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Banners">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="Banner">
<xsd:complexType>
<xsd:attribute name="BannerId" type="xsd:unsignedShort" use="required"/>
<xsd:attribute name="ImageId" type="xsd:unsignedByte" use="required"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:key name="PK">
<xsd:selector xpath="Images/Image"/>
<xsd:field xpath="#ImageId"/>
</xsd:key>
<xsd:keyref name="FK" refer="PK">
<xsd:selector xpath="Banners/Banner"/>
<xsd:field xpath="#ImageId"/>
</xsd:keyref>
</xsd:element>
</xsd:schema>
Sample error message:
The key sequence '8' in Keyref fails to refer to some key.
xsd-restriction-by-value.xml is XSD 1.0 invalid.
i trying the following but getting an error
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xsd:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml.xsd" />
<xsd:element name="book" type="bookType"/>
<xsd:complexType name="bookType">
<xsd:all>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="author" type="xsd:string"/>
<xsd:element ref="xhtml:pre"/>
<xsd:element ref="xhtml:ul"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
its returning an error on <xsd:element ref="xhtml:pre"/>
Try this:
<xsd:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd" />
Instead of your import. It will validate in XML Spy.