我正在尝试使用XSD验证xml有效负载,其中该XSD引用另一个,另一个引用另一个。像嵌套引用一样。
当我在.xsd
路径中包含所有Validate Schema
时,我仍然得到:
根异常堆栈跟踪:org.xml.sax.SAXParseException; schema_reference:无法读取架构文档“ MPProduct.xsd”, 因为由于设置了限制,所以不允许“文件”访问 accessExternalSchema属性。 om.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) 在 com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) 在 com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400) 在 com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306) 在 com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4160) 在 com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaFatalError(XSDHandler.java:4135) 在 com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2172) 在 com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(XSDHandler.java:2100) 在 com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:1104) 在 com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:623) 在 com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:613) 在 com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:572) 在 com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:538) 在 com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:255) 在 org.mule.module.xml.internal.operation.SchemaValidatorOperation $ 2.create(SchemaValidatorOperation.java:142) 在 org.mule.module.xml.internal.operation.SchemaValidatorOperation $ 2.create(SchemaValidatorOperation.java:132) 在 org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:58) 在 org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:888) 在 org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:432)
请问有解决此问题的建议吗?
在本地运行时,我尝试在VM参数中添加-Djavax.xml.accessExternalSchema=all
<flow name="mytestingFlow" doc:id="4efe5074-da20-4164-843a-06ca9a2a9979" >
<http:listener doc:name="Listener" doc:id="74f4f199-00cb-460d-b72f-df3497f26e6a" config-ref="HTTP_Listener_config" path="/service/path/one"/>
<set-payload value="#["<MPItemFeed xmlns=\"http://walmart.com/\"><MPItemFeedHeader><version>3.2</version></MPItemFeedHeader><MPItem><processMode>CREATE</processMode><sku>10145802</sku><productIdentifiers><productIdentifier><productIdType>UPC</productIdType><productId>123456789123</productId></productIdentifier></productIdentifiers><MPProduct><SkuUpdate>NO</SkuUpdate><msrp>183.99</msrp><productName>CARQUEST Platinum Professional Ceramic Brake Pads - Front (4-Pad Set)</productName><ProductIdUpdate>YES</ProductIdUpdate><category><Vehicle><VehiclePartsAndAccessories><shortDescription>Ceramic Brake Pads - Front (4-Pad Set)</shortDescription><keyFeatures><keyFeaturesValue>Premium brake pad underlayer reduces vibration for silent braking Industry leading number of application specific formulations for maximum performance Revolutionary burnishing compound strip allows for proper break-in of pads and rotors.</keyFeaturesValue></keyFeatures><brand>CARQUEST Platinum Professional</brand><manufacturer>CARQUEST Platinum Professional</manufacturer><manufacturerPartNumber>PXD1210H</manufacturerPartNumber><mainImageUrl>http://pdfifsvcprd.corp.advancestores.com/assets/epc50x50/std.lang.all/1012147531.jpg</mainImageUrl><isProp65WarningRequired>Yes</isProp65WarningRequired><prop65WarningText>cancer and reproductive</prop65WarningText><hasWarranty>YES</hasWarranty><warrantyText>LIMITED LIFETIME REPLACEMENT</warrantyText></VehiclePartsAndAccessories></Vehicle></category></MPProduct><MPOffer><price>182.99</price><ShippingWeight><measure>4</measure><unit>lb</unit></ShippingWeight><ProductTaxCode>2038710</ProductTaxCode></MPOffer></MPItem><MPItem><processMode>CREATE</processMode><sku>11395545</sku><productIdentifiers><productIdentifier><productIdType>UPC</productIdType><productId>123456789123</productId></productIdentifier></productIdentifiers><MPProduct><SkuUpdate>NO</SkuUpdate><msrp>183.99</msrp><productName>CARQUEST Platinum Brake Rotor - Front</productName><ProductIdUpdate>YES</ProductIdUpdate><category><Vehicle><VehiclePartsAndAccessories><shortDescription>Brake Rotor - Front</shortDescription><keyFeatures><keyFeaturesValue>Engineered to withstand 120 hours of salt spray testing Manufactured to exacting quality and dimensional specifications for Superior Stopping Power Exceeds ISO manufacturing guidelines (International Organization for Standardization)</keyFeaturesValue></keyFeatures><brand>CARQUEST Platinum</brand><manufacturer>CARQUEST Platinum</manufacturer><manufacturerPartNumber>YH145232P</manufacturerPartNumber><mainImageUrl>http://pdfifsvcprd.corp.advancestores.com/assets/epc50x50/std.lang.all/1017931756.jpg</mainImageUrl><isProp65WarningRequired>No</isProp65WarningRequired><prop65WarningText/><hasWarranty>YES</hasWarranty><warrantyText>2 YR REPLACEMENT IF DEFECTIVE</warrantyText></VehiclePartsAndAccessories></Vehicle></category></MPProduct><MPOffer><price>182.99</price><ShippingWeight><measure>4</measure><unit>lb</unit></ShippingWeight><ProductTaxCode>2038710</ProductTaxCode></MPOffer></MPItem><MPItem><processMode>CREATE</processMode><sku>10556036</sku><productIdentifiers><productIdentifier><productIdType>UPC</productIdType><productId>123456789123</productId></productIdentifier></productIdentifiers><MPProduct><SkuUpdate>NO</SkuUpdate><msrp>183.99</msrp><productName>CARQUEST Premium Lube Element with Lid</productName><ProductIdUpdate>YES</ProductIdUpdate><category><Vehicle><VehiclePartsAndAccessories><shortDescription>Lube Element with Lid</shortDescription><keyFeatures><keyFeaturesValue>Environmental cartridge lube filter High efficiency and durable cellulose/synthetic blended media for longer drain intervals Silicone anti-drain back valve has 3X the durability verses nitrile for engine start-up protection</keyFeaturesValue></keyFeatures><brand>CARQUEST Premium</brand><manufacturer>CARQUEST Premium</manufacturer><manufacturerPartNumber>84312</manufacturerPartNumber><mainImageUrl>http://pdfifsvcprd.corp.advancestores.com/assets/epc50x50/std.lang.all/1015772990.jpg</mainImageUrl><isProp65WarningRequired>Yes</isProp65WarningRequired><prop65WarningText>cancer and reproductive</prop65WarningText><hasWarranty>YES</hasWarranty><warrantyText>REPLACE OR REFUND AT MGR DISCRETION</warrantyText></VehiclePartsAndAccessories></Vehicle></category></MPProduct><MPOffer><price>182.99</price><ShippingWeight><measure>4</measure><unit>lb</unit></ShippingWeight><ProductTaxCode>2038710</ProductTaxCode></MPOffer></MPItem><MPItem><processMode>CREATE</processMode><sku>20471798</sku><productIdentifiers><productIdentifier><productIdType>UPC</productIdType><productId>123456789123</productId></productIdentifier></productIdentifiers><MPProduct><SkuUpdate>NO</SkuUpdate><msrp>183.99</msrp><productName>Denso Air-Fuel Ratio Sensor 4 Wire, Direct Fit, Heated, Wire Length: 10.63</productName><ProductIdUpdate>YES</ProductIdUpdate><category><Vehicle><VehiclePartsAndAccessories><shortDescription>Air-Fuel Ratio Sensor 4 Wire, Direct Fit, Heated, Wire Length: 10.63</shortDescription><keyFeatures><keyFeaturesValue>Specifically designed to meet the increasing demands of today's engines 100% checked for high temperature signal output, air tightness, continuity, and heat resistance for optimal efficiency and performance Double protection cover helps maintain proper unit temperature for quicker response times, which is critical to your vehicle's fuel efficiency</keyFeaturesValue></keyFeatures><brand>Denso</brand><manufacturer>Denso</manufacturer><manufacturerPartNumber>234-9001</manufacturerPartNumber><mainImageUrl>http://pdfifsvcprd.corp.advancestores.com/assets/epc50x50/std.lang.all/524891.jpg</mainImageUrl><isProp65WarningRequired>No</isProp65WarningRequired><prop65WarningText/><hasWarranty>YES</hasWarranty><warrantyText>1 YR REPLACEMENT IF DEFECTIVE</warrantyText></VehiclePartsAndAccessories></Vehicle></category></MPProduct><MPOffer><price>182.99</price><ShippingWeight><measure>4</measure><unit>lb</unit></ShippingWeight><ProductTaxCode>2038710</ProductTaxCode></MPOffer></MPItem></MPItemFeed>
"]" doc:name="Set Payload" doc:id="b16a5f07-fa58-4c36-837a-3533eecdcccd" mimeType="application/xml"/>
<ee:transform doc:name="Transform Message" doc:id="a6d22ddb-1e3a-4519-a22f-41987f9b5049" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/xml
---
payload]]></ee:set-payload>
</ee:message>
</ee:transform>
<xml-module:validate-schema doc:name="Validate schema" doc:id="c5dbaef9-d4f3-4aeb-b15a-516aa0eb2479" schemas="Animal.xsd,ArtAndCraftCategory.xsd,Baby.xsd,CarriersAndAccessoriesCategory.xsd,ClothingCategory.xsd,Electronics.xsd,FoodAndBeverageCategory.xsd,FootwearCategory.xsd,FurnitureCategory.xsd,GardenAndPatioCategory.xsd,HealthAndBeauty.xsd,Home.xsd,JewelryCategory.xsd,Media.xsd,MPCommons.xsd,MPItem.xsd,MPItemFeed.xsd,MPItemFeedHeader.xsd,MPOffer.xsd,MPProduct.xsd,MusicalInstrument.xsd,OccasionAndSeasonal.xsd,OfficeCategory.xsd,OtherCategory.xsd,Photography.xsd,SportAndRecreation.xsd,ToolsAndHardware.xsd,ToysCategory.xsd,Vehicle.xsd,WatchesCategory.xsd" config-ref="XML_Config"/>
<logger level="INFO" doc:name="Logger" doc:id="a74dbf49-d111-4eb3-84c3-598845ecaf48" />
</flow>