xsd

XmlCodeExporter and nullable types

╄→尐↘猪︶ㄣ 提交于 2020-01-13 07:36:07
问题 System.Xml.Serialization.XmlCodeExporter generates code (in code CodeDom form) from an XSD schema. But it does it with some quirks. For example an optional element: <xs:element name="Something" type="xs:decimal" minOccurs="0" maxOccurs="1"/> I would expect this to generate a corresponding code member of type Nullable<decimal> , but it actually creates a member of type decimal , and then a separate SomethingSpecified field which should be toggled separately to indicate a null value. This is

(FInite State Machine) - Implementing a XML schema validator in javascript

二次信任 提交于 2020-01-13 01:42:10
问题 I have been working on a project for a month or so now to develop a XML validator (XSD) in javascript. I have gotten really close but keep running into problems. The only thing I have working well is normalizing schema structures into FSA that I store in the DOM. I have tried several methods to validate my xml structures against the FSA and come short each time. The validator is being used to run a client side WYSIWYG XML editor so it has to meet the following requirements Must be efficient (

Spring如何解析XML文件——Spring源码之XML初解析

主宰稳场 提交于 2020-01-12 20:00:56
首先,在我的 这篇博客 中已经说到容器是怎么初步实现的,并且要使用 XmlBeanDefinitionReader 对象对 Xml 文件进行解析,那么 Xml 文件是如何进行解析的,将在这片博客中进行一些陈述. 数据准备阶段 准备的目的是封装 resource 参数,目的是为了考虑到 Resource 可能存在编码要求的情况,其次,通过 SAX 读取 XML 文件的方式来准备 InputSource 对象,最后将参数传递到 最核心的实现部分 doLoadBeanDefinitions(inputSource,encodedResource.getResource()) 封装Resource 调用 XmlBeanDefinitionReader 的 loadBeanDefinitions(Resource resource) 方法时,首先将resource对象进行再次封装成 EncodedResource ,查看源码可以发现里面增加了字符集和编码的封装,从命名上来看也可以体现出来,将资源封装完成后,就调用重载的同名函数 loadBeanDefinitions(EncodedResource resource) 进行正式的解析. 数据准备操作 在重载方法里面首先通过 Set<EncodedResource> currentResources 属性来记录已经加载的资源,其次,从

Distribute XSD files over multiple Maven Artifacts

故事扮演 提交于 2020-01-12 03:52:51
问题 Here is a small Example of what I would like to achieve: Maven Artifact A is one of many Webservices and defines a XSD Schema with definitions for Requests and Responses. (src/main/resources/xsd) Artifact A depends on Artifact B wich is a simple JAR Project and contains a multitude of Master XSDs with low level Type descriptions. (src/main/resources/xsd) The XSDs in Artifact A use the type definitions (include) that are specified once in Artifact B. If at all possible I would really like to

Is svcutil.exe a replacement for xsd.exe?

社会主义新天地 提交于 2020-01-11 15:46:58
问题 I am using xsd.exe to generate some c# classes from a .xsd file. I ran into the same issue that is covered here and on other sites where xsd.exe generates Type[] arrays instead of generic List collections for types in the .xsd file. Some people have suggested that svcutil.exe can be used as a replacement for xsd.exe if you pass the /dataContractOnly parameter to svcutil.exe. However, it seems like those people are mistaken because svcutil.exe actually generates System.Xml.XmlNode[] array

xsd: How to extend a type with an unordered list of elements

≯℡__Kan透↙ 提交于 2020-01-11 08:17:06
问题 This is a part of my xml schema <xs:complexType name="Friend"> <xs:all> <xs:element name="name" type="xs:string" /> <xs:element name="phone" type="xs:string" /> <xs:element name="address" type="xs:string" /> </xs:all> </xs:complexType> <xs:complexType name="Coworker"> <xs:all> <xs:element name="name" type="xs:string" /> <xs:element name="phone" type="xs:string" /> <xs:element name="office" type="xs:string" /> </xs:all> </xs:complexType> For better maintainability, I would like to have the

Cannot generate classes because no top-level elements with complex type where found

蹲街弑〆低调 提交于 2020-01-11 02:09:07
问题 I am trying to create a class from a xsd file using the XSD.EXE tool. but for some reason i get this error. Warning: cannot generate classes because no top-level elements with complex type were found. I have looked around on stack and seen that i could put a type on the complex type element but i cannot seem to get i to work. here is the xsd file <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.unece.org/cefact/namespaces

JAXB 2.1 - Customize xs:any binding

孤人 提交于 2020-01-10 19:29:55
问题 I want to generate java code from xsd using JAXB 2.1 XJC. I have an xsd schema provided and I can't change it. I would like to use xjc:simple mode while generating java classes from xml schema. In the xsd there are elements: <xs:any namespace="##other" processContents="lax"/> As it is stated here: http://jaxb.java.net/guide/Mapping_of__xs_any___.html I expected that these elements will be binded to: @XmlAnyElement(lax=true) public Object any; but when I use simple binding mode xjc:simple I

Proper use of HTTP status codes in a “validation” server

谁说胖子不能爱 提交于 2020-01-09 12:51:10
问题 Among the data my application sends to a third-party SOA server are complex XMLs. The server owner does provide the XML schemas ( .xsd ) and, since the server rejects invalid XMLs with a meaningless message, I need to validate them locally before sending. I could use a stand-alone XML schema validator but they are slow, mainly because of the time required to parse the schema files. So I wrote my own schema validator (in Java, if that matters) in the form of an HTTP Server which caches the

XML Schema: what's the default type of an xsd:attribute?

狂风中的少年 提交于 2020-01-09 11:38:09
问题 In EBUCore schema (http://en.wikipedia.org/wiki/Metadata_standards) there is an attribute named 'version' defined as <attribute name="version" default="1.5"> <annotation> <documentation> The version of the schema for e.g. OAI management.</documentation> </annotation> </attribute> As you see, there is no 'type' defined for it and I wonder, what's the default type for it - anyType , anySimpleType , string , float , double , ... W3C spec (http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/