xsd

How to prevent autogeneration of JAXBElement for xs:choice using xsdtojava?

风流意气都作罢 提交于 2020-01-06 02:42:26
问题 I'm generating java classes from XSD using cxf-xjc-plugin and xsdtojava plugin. Problem: I have no control of the xsd , and one element has a xs:choice which results in a JAXBElement . Unfortunately my xml serializer jackson cannot handle JAXBElement s. So I'm trying to achieve autogeneration to an Object rather than JAXBElement . But how? The xsd I have no control of: <xs:element name="payment"> <xs:complexType> <xs:choice maxOccurs="2"> <xs:element name="creditcard"> ... </xs:element> <xs

Is creating separate XSD type for data item key good Web Service design, when data item can be identified by multiple attributes?

荒凉一梦 提交于 2020-01-06 02:38:27
问题 I have specified like this because I want different consumers to be able to identify data differently. External consumers don't know about id and internal do. <!-- all are minoccurs=0 because only data present will be updated --> <xs:complexType name="tSomeData"> <xs:sequence> <xs:element name="id" type="xs:int" minOccurs="0"/> <xs:element name="name" type="xs:string" minOccurs="0"/> <xs:element name="externalname" type="xs:string" minOccurs="0"/> <xs:element name="manufacturer" type="xs

Cannot generated enumeration class using JAXB

≡放荡痞女 提交于 2020-01-06 02:37:45
问题 I've a lot of difficulties generating some POJOs from an XSD (distributed as a standard that I don't have control and I cannot changed) using JAXB. The problem seems to be related to the way certain types are defined in that XSD. Below I've pasted a simple type defined in this XSD named TransactionCodeType which is a union of a token combined with an enumeration list of values, also defined as a token. <xs:element name="TransactionContentDetails"> <xs:complexType> <xs:sequence> <xs:element

How to write XML Schema to require self-closing tag in XML

大憨熊 提交于 2020-01-05 21:28:45
问题 The below XSD I have page-count element with attributes. <xs:element name="counts"> <xs:complexType> <xs:sequence> <xs:element name="page-count"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:NMTOKEN"> <xs:attribute name="count" use="required" type="xs:NCName"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> My problem is if I have <page-count id="blabla" name="count"></page-count> in XML there is no

How to write XML Schema to require self-closing tag in XML

牧云@^-^@ 提交于 2020-01-05 21:28:12
问题 The below XSD I have page-count element with attributes. <xs:element name="counts"> <xs:complexType> <xs:sequence> <xs:element name="page-count"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:NMTOKEN"> <xs:attribute name="count" use="required" type="xs:NCName"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> My problem is if I have <page-count id="blabla" name="count"></page-count> in XML there is no

validating SOAP-Request with a SOAPHandler

匆匆过客 提交于 2020-01-05 16:29:31
问题 I'm trying to validate a SOAP-Request against the Schemas defined in the WSDL. I'm using a SOAPHandler with a SOAP-Handler-Chain. It works the only problem is that when I'm validating the request, I get this error message: cvc-complex-type.2.4.a: Invalid content was found starting with element 'v1:latitude'. One of '{"http://schemas.domain.com/wsdl/fuelprice/v1/model":latitude}' is expected. The WSDL looks like this: <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap=

XMLunit Comparison failure because child nodes order

醉酒当歌 提交于 2020-01-05 12:32:35
问题 I'm comparing a generated XML file with another example using XMLunit, and Im having problems with ChildNodes Order and their attributes. (Linux and Mac generation differ) This is what I've tried: @Test public void testComparingXML() throws Exception { XMLUnit.setIgnoreWhitespace(true); String expectedXml = IOUtils.toString(ConnectorStrategyStudioXmlTest.class.getClassLoader().getResourceAsStream(EXPECTED_XML)); String actualXml = IOUtils.toString(ConnectorStrategyStudioXmlTest.class

XMLunit Comparison failure because child nodes order

99封情书 提交于 2020-01-05 12:32:11
问题 I'm comparing a generated XML file with another example using XMLunit, and Im having problems with ChildNodes Order and their attributes. (Linux and Mac generation differ) This is what I've tried: @Test public void testComparingXML() throws Exception { XMLUnit.setIgnoreWhitespace(true); String expectedXml = IOUtils.toString(ConnectorStrategyStudioXmlTest.class.getClassLoader().getResourceAsStream(EXPECTED_XML)); String actualXml = IOUtils.toString(ConnectorStrategyStudioXmlTest.class

Define new attribute to elements XSD

会有一股神秘感。 提交于 2020-01-05 11:02:43
问题 I have a question regarding defining new attribute for my elements in my xml schema (xsd) I have an element like this <xs:element name="xyz" type="xs:hexBinary" minOccurs="2"> I want to add a new attribute "size" where I can specify the size of the element "xyz". How can I define do this? Thanks for your help 回答1: Below is a simple valid XSD, built around your xyz element. <?xml version="1.0" encoding="utf-8" ?> <!-- XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com) --

Creating an XML document with more than 1 child element with XML schema

半世苍凉 提交于 2020-01-05 09:23:44
问题 I have come with an xml schema to create an xml document. The root node is movies . Now this root element has child elements called movie which contains other elements of a string type and every movie also has about three or four attributes. However after linking my XML document with the schema I am only able to create ONE movie node and no more than that. Here is my xml schema: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!--root element