xsd

Marshalling with XSD choice field in class

萝らか妹 提交于 2019-12-24 07:36:09
问题 I use a Java class to generate the WSDL schema dynamically. I have this as one of my fields: @XmlElements({ @XmlElement(name = "A", type = String.class), @XmlElement(name = "B", type = Integer.class), @XmlElement(name = "C", type = String.class), @XmlElement(name = "D", type = String.class) }) protected Object aOrBOrCOrD; During marshalling, when the single choice property aOrBOrCOrD is set, which tag name(A, B, C or D) would be set in the XML? Since there's only one field which would contain

How do I parse XML content that may or may not have a namespace?

*爱你&永不变心* 提交于 2019-12-24 07:35:21
问题 I need to parse some XML content for which I have the XSD. In general, this is straight-forward. However, in one particular case, the XML sometimes includes the XML namespace and sometimes it does not. Further, it is not really practical to require the XML namespace, as the supplied XML comes from multiple sources. So I'm stuck with trying to find a way around this. As noted, I have the XSD for the XML and I have used XJC (from JAXB) to generate the corresponding XML entity classes from the

Refer to specific element of an XSD model group?

六眼飞鱼酱① 提交于 2019-12-24 07:33:14
问题 Can we create a group and refer to element of that group? For example, we have a group say <xs:group name="custGroup"> <xs:sequence> <xs:element name="customerId" type="xs:string"/> <xs:element name="customerName" type="xs:string"/> <xs:element name="Address1" type="xs:string"/> <xs:element name="Address2" type="xs:string"/> <xs:element name="mobile" type="xs:string"/> </xs:sequence> </xs:group> Suppose I want to create another element to have only customerId and mobile : <xs:element name=

Generate castor xml from xsd

社会主义新天地 提交于 2019-12-24 07:13:51
问题 I am currently using the Jaxb for Marshalling/Unmarshalling. However I need to use castor due to "demands" and use castor xml instead of castor java classes. I found castor's SourceGeneratorMain which generates xsd to java classes, but I cannot find anything that generates castor xml from xsd. I would just type it out but the xsd im working is huge with more than 2500 lines and over a hundered parameter various arrays in there. Im sure Im going to screw up something, if I type it out. Has any

at least one of these elements, but some at most one

情到浓时终转凉″ 提交于 2019-12-24 07:06:56
问题 I would like my XSD to be able to enforce that at least one of a set of elements must be present. Some of those elements can appear unlimited times, some are limited. None of the elements are compulsory by themselves but at least one must be present. Finally the elements can appear in any order. i.e. the order should neither be enforced nor have any impact on the processing of the document My attempt at this: <xs:element name="Root"> <xs:complexType> <xs:choice> <xs:element minOccurs="0"

XML Schema Creation Error - What is JAXB Doing?

为君一笑 提交于 2019-12-24 05:57:42
问题 I'm working on a project that involves a simple web service, and have had a slew of little problems. It's an Apache CXF webservice (using JAX-WS, over SOAP). The service itself is pretty simple: receive a request, insert the request into a database, and return whether the insert was successful. I'd like to rely on XML validation to enforce a number of constraints on the request. Full XML validation is very important to this project. So far, I've been unable to properly validate, though my

XML Schema Creation Error - What is JAXB Doing?

别等时光非礼了梦想. 提交于 2019-12-24 05:57:32
问题 I'm working on a project that involves a simple web service, and have had a slew of little problems. It's an Apache CXF webservice (using JAX-WS, over SOAP). The service itself is pretty simple: receive a request, insert the request into a database, and return whether the insert was successful. I'd like to rely on XML validation to enforce a number of constraints on the request. Full XML validation is very important to this project. So far, I've been unable to properly validate, though my

Analyzing XML schemas using org.eclipse.xsd and Maven2

﹥>﹥吖頭↗ 提交于 2019-12-24 05:35:09
问题 I'm trying to implement the sample code to this article from 2002 (I know..), but cannot get the schema to load. import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.xsd.util.XSDResourceImpl; ResourceSet resourceSet = new ResourceSetImpl(); // I replaced the deprecated createDeviceURI with createURI as recommended in JavaDoc

how to get max depth of a xsd using xsom\dom\jaxb?

荒凉一梦 提交于 2019-12-24 04:46:08
问题 how to get max depth of a xsd using xsom. For e.g: total number of elements under each complex types of the xsd? Also if as complex types is there under that complex types the number of element + attributes under that......using dom\xsom\jaxb <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="root" type="root"> <xs:annotation> <xs:documentation> Comment describing

Is DTD deprecated?

天涯浪子 提交于 2019-12-24 04:30:07
问题 In What is difference between XML Schema and DTD?, two answerers state that DTD "is deprecated". One of them, user vtd-xml-author, states that DTD is pretty much deprecated because it is limited in its usefulness [...] at which user Jesse Chisholm comments Deprecated? No. [XDR is deprecated] Going out of fashion? Maybe [...] In What is DTD exactly?, user AlexR comments on an answer as follows: Note that DTD is deprecated in favor of the more declarative and powerful XSD. In this case, no-one