xsd

XJC Java class generation for <xs:choice> element which is not unbounded

笑着哭i 提交于 2020-01-02 10:04:39
问题 After this similar question yesterday I have another question concerning inheritance in XML schema and XJC bindings. Given the following choice element such that Book and Journal have a common parent type ( Publication ). <xsd:choice > <xsd:element name="Book" type="Book" /> <xsd:element name="Journal" type="Journal" /> </xsd:choice> The Java class properties which are generated are like: private Book book; private Journal journal; Since <xsd:choice> means that there might be either a Book or

Dynamical enumeration in XSD

微笑、不失礼 提交于 2020-01-02 10:04:21
问题 I have such xml structure: <main> <objects> <object name="book" /> <object name="table" /> </objects> <actions> <action input="book" /> <action input="table" /> <action input="book" /> </actions> </main> This is a simplified example. I want to create xsd schema which invalidates such xml: <main> <objects> <object name="book" /> <object name="table" /> </objects> <actions> <action input="book" /> <action input="table" /> <action input="fruit" /> </actions> </main> because of there is no object

Validating XSD Schema with Schematron and xsltproc

痞子三分冷 提交于 2020-01-02 09:55:36
问题 I'm having difficulty validating an SXD schema combined with Schematron. Following the steps described in this guide I've incorporated schematron between the <xs:appinfo> tags in an XSD document as follows: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Test"> <xs:annotation> <xs:appinfo> <sch:pattern name="Testing schematron" xmlns:sch="http://purl.oclc.org/dsdl/schematron"> <sch:rule context="Test"> <sch:assert test="

What backward-compatible XSD changes can be made?

风流意气都作罢 提交于 2020-01-02 09:36:05
问题 How can I make changes to an XML Schema for a REST interface without impacting consuming applications (if they do not upgrade)? 回答1: Just don't alter the existing schema and structures to ensure backward compatibility. Only add optional elements and attributes as required to extend the functionality. Always version your services - either URL way or Content-Type way! This is to ensure maintainability. 回答2: Here are some examples of request XSD changes that you can and cannot do to maintain

Timezone added with type=“xs:dateTime”

元气小坏坏 提交于 2020-01-02 08:04:31
问题 When I fill my date field with 28/12/12 08:51:51 and generate an XML file, I get the output 2028-12-12T08:51:51+00:00 . In my XSD file, the type of this field is set as xs:dateTime . The problem is that I only want the Date and Time, and not the time zone. So the output should be 2028-12-12T08:51:51 Does anybody know where this format is set? 回答1: Use the pattern as YYYY-MM-DDThh:mm:ss Do this way:- <xsd:simpleType> <xsd:restriction base="xsd:dateTime"> <xsd:pattern value="\d{4}-\d\d-\d\dT\d

How to specify format of XML output when writing from a DataTable?

為{幸葍}努か 提交于 2020-01-02 07:11:22
问题 In C#, I'm creating an XML file from a DataTable using dataTable.WriteXml(filePath), and get the following: <?xml version="1.0" encoding="utf-8" ?> <ExperienceProfiles> <ExperienceProfile> <Col1>blah</Col1> <Col2>4ed397bf-a4d5-4ace-9d44-8c1a5cdb0f34</Col2> </ExperienceProfile> </ExperienceProfiles> How can I get it to write the XML in the following format?: <?xml version="1.0" encoding="utf-8" ?> <ExperienceProfiles> <ExperienceProfile Col1="blah" Col2="blah" ></ExperienceProfile> <

“http://annox.dev.java.net” customizations require the “-Xannotate” switch

谁都会走 提交于 2020-01-02 06:52:52
问题 I am trying to run a real schema through hyperjaxb. I have tested the schema repeatedly using jaxb, and jaxb imports the schema correctly every time. However, when I try to get hyperjaxb to generate hibernate-annotated java classes from the same schema, I get the following error: [ERROR] Error while parsing schema(s).Location [ file:/C:/path/to/src/main/resources/schema.xsd{4,32}]. org.xml.sax.SAXParseException; systemId: file:/C:/path/to/src/main/resources/schema.xsd; lineNumber: 4;

Xml Schema for repeating sequence of elements

夙愿已清 提交于 2020-01-02 05:27:50
问题 I have xml as follows <Search> <Term /> <And /> <Term /> <And /> <Term /> </Search> There can be n number of Terms and n-1 Ands (n > 0) in the sequence as shown. I tried the following xml schema but above xml would not get validated against the schema. Error: cvc-complex-type.2.4.b: The content of element 'Search' is not complete. One of '{And}' is expected. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="Search"> <xs:complexType> <xs

What tool can I use to merge wsdl and xsd file?

空扰寡人 提交于 2020-01-02 05:20:09
问题 I have two files, one with webservice description (wsdl), second with data structures used in webservice (xsd). I have nothing more, webservice doesn't work yet. I need to merge them into one, because Delphi 7 WSDL Importer doesn't handle included xsd files to well. Where can I find tool to do it? EDIT I copied xsd content into <types> section and it works. I tried it before, but I must have made a mistake and Delphi WSDL import didn't work. I have to improve my copy/paste skills. 回答1: You

can you validate xsd against xml in vs 2010?

▼魔方 西西 提交于 2020-01-02 04:05:28
问题 How do I validate an xml document against an xsd in Visual Studio 2010? Thanks. 回答1: Open you XML file in VS2010; in the Properties tool window (F4) there is a Schemas property. List the XSD you want in there. Once done, the errors/warnings will show up in the Error List tool window. 回答2: There are a few things you need. First the XML Document must be associated with the Schema: <XmlDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Code\Schema