Tag: xsd

从Ant中的JAXB类文件生成XML模式

是否可以使用shemagen ant Task从类文件而不是源文件生成xsd模式?

使用“xs:any”获取“编译器无法遵守此javaType自定义”

我有以下xsd: 以及以下绑定: 但是当我运行xjc时…… xjc -p leif -b bindings.xml format.xsd 我收到以下错误: parsing a schema… [ERROR] compiler was unable to honor this javaType customization. It is attached to a wrong place, or its inconsistent with other bindings. line 9 of file:/C:/Users/leif/workspace/doughan/src/main/resources/bindings.xml [ERROR] (the above customization is attached to the following location in the schema) line 7 of […]

针对XML Schema(XSD)validationJSON

是否可以在Java中validationJSON和XSD? 我有一个应用程序,我收到JSON响应,我想对现有的XSD进行validation。 我的应用程序的另一部分使用XML,这就是为什么如果它们都可以对现有的XSD进行validation最简单的原因。

XMLSchema的解决方法不支持maxOccurs大于5000

我的问题是解析一个XSD Schema,它包含maxOccurs大于5000(但不是unbounded )的元素。 这实际上是Xerces(我正在使用的版本2.9.1)或JAXP中的一个已知问题,如下所述: http ://bugs.sun.com/view_bug.do;jsessionid=85335466c2c1fc52f0245d20b2e?bug_id= 4990915 我已经知道,如果我将XSD中的maxOccurs数字从大于5000的数字更改为unbounded一切正常。 遗憾的是,在我的情况下这不是一个选项 (我不能插入XSD文件)。 我的问题是: 有人知道Xerces中有关此问题的其他一些解决方法吗? 要么 有人可以推荐另一个没有此限制的XML解析器吗? 谢谢!

使用JAXB编译包含相同元素的重复定义的多个XSD

问题:如何让xjc / Jaxb为同一名称空间中包含重复elementdefinitions的几个模式生成propper javaclasses? 信息:我有三个.xsd架构:A,B和C.所有都有相同的targetnamespace。 他们都是给我的3个shemas,我不会以任何方式允许以任何方式改变它们。 它们有一些也可以在B或C中找到的元素(但是A也有很多自我声明的元素)例子:这是A和C的相同“代码”: 当使用xjc将它们编译成javaclasses时,我得到以下exception: [ERROR] ‘y_ym_ymdDatoType’ is already defined line 297 of file:../c.xsd [ERROR] (related to above error) the first definition appears here line 309 of file:../a.xsd 其他元素也是如此:arcgYearType,arcgYearMonthType和arcDateType。 我已经阅读了一个可能解决这个问题的绑定文件,但我不知道如何做到这一点,所以示例将是首选。

解析器配置exception从类路径资源解析XML

我正在尝试运行一个junit测试用例来测试applicationcontext是否已初始化并抛出以下错误。 它是与xml还是java版本相关的东西。 我该如何解决? org.springframework.beans.factory.BeanDefinitionStoreException: Parser configuration exception parsing XML from class path resource [tasospring-online-context.xml]; nested exception is javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.crimson.jaxp.DocumentBuilderFactoryImpl@82701e] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404) at […]

是否有标准的Java实用程序在运行时解析XSD文件?

我一直在寻找一种方法来以编程方式解析XSD文件以生成XML映射,这样我就可以获取任何XSD文件并创建一个解析器来解析任何符合它的XML文件,而我的google-fu已经来了做空。 XSOM看起来很有前途,因为它将解析XSD文件并以直接的方式使其所有属性可用。 是否有任何其他选项或标准库可用于从XSD文件生成XML文件解析器? [结论]感谢大家的回复,他们是真正的帮助。 我能够使用JAXP,Eclipses EMF和XSOM编写实现,所有这些都按照需要工作。 JAXP非常直接,易学易用。 EMF实际上是一个很难正常进行的痛苦,有很多jar子必须包括在内才能独立工作,我不推荐它。 XSOM甚至比JAXP实现更简单,所以我最终选择了它。

针对多个任意模式validationXML

考虑一个XML文档,它像下面的多个模式一样开始(这不是一个特定于Spring的问题;这只是一个方便的XML文档): 我想validation文档,但我不知道文档作者将使用哪些名称空间。 我相信文档作者,所以我愿意下载任意模式URL。 我如何实现我的validation器? 我知道我可以使用DocumentBuilderFactory实例指定我的模式我调用setAttribute(“http://java.sun.com/xml/jaxp/properties/schemaSource”, new String[] {…})但我不知道知道架构URL,直到解析文档。 当然,我可以在解析文档之后自己提取XSD URL,然后通过validation器运行它,如上所述指定”http://java.sun.com/xml/jaxp/properties/schemaSource” ,但肯定已经有了自动执行此操作的实现?

Java – Spring Ws – 在XSD文件中加载相对包含(Tomcat 8)

我创建了一个Spring Web服务,它使用以下代码从XSD文件集合创建动态WSDL: Resource[] schema = { new ClassPathResource( “schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/coreschemas/NarrativeBlock.xsd”), new ClassPathResource( “schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/coreschemas/datatypes-base.xsd”), new ClassPathResource( “schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/coreschemas/infrastructureRoot.xsd”), new ClassPathResource( “schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201305UV02.xsd”), new ClassPathResource( “schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/NE2008/multicacheschemas/PRPA_IN201306UV02.xsd”), new ClassPathResource( “schema/service/XCPD.SupportMaterials.v9/schema/IHE/XCPD_PLQ.xsd”), new ClassPathResource( “schema/service/XCPD.SupportMaterials.v9/schema/HL7V3/XCPD_PRPA.xsd”) }; CommonsXsdSchemaCollection collection = new CommonsXsdSchemaCollection( schema); collection.setInline(true); return collection; 用于创建动态WSDL的XSD文件包括使用include语句的其他各种模式文件,如下所示: 当我在Tomcat 8容器中运行代码时,我收到以下exception: Caused by: java.lang.IllegalArgumentException: The resource path [/../coreschemas/infrastructureRoot.xsd] has been normalized to [null] which is not […]

如何将XSD类型导入根模式?

这是我在foo.xsd现有XSD架构, foo.xsd声明了类型: 这是另一个声明元素的模式: 这是我从Java中的SAX解析器得到的: “The namespace attribute ‘foo’ of an element information item must not be the same as the targetNamespace of the schema it exists in.” 我究竟做错了什么?