xsd-validation

How to reuse elements from another Schema / Namespace (i.e. XHTML) with XML Schema?

可紊 提交于 2019-12-20 05:10:30
问题 I'm trying to define a Schema which allows the use of specific (X)HTML elements in certain places. The problem that I'm facing is that the Schema fails compiling. Here's the Schema: <?xml version="1.0"?> <xs:schema xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="http://www.w3.org/MarkUp/Schema/xhtml11.xsd" /> <xs:element name="foo"> <xs:complexType> <xs:sequence> <xs:element ref="html

Is it possible to get the type of an XML node as it was defined in XSD?

梦想与她 提交于 2019-12-19 21:46:10
问题 I'm parsing an XML in python. I've an XSD schema to validate the XML. Can I get the type of a particular node of my XML as it was defined in XSD? For example, my XML (small part) is <deviceDescription> <wakeupNote> <lang xml:lang="ru">Русский</lang> <lang xml:lang="en">English</lang> </wakeupNote> </deviceDescription> My XSD is (once again a small part of it): <xsd:element name="deviceDescription" type="zwv:deviceDescription" minOccurs="0"/> <xsd:complexType name="deviceDescription"> <xsd

XSD custom type with attribute and restriction

我与影子孤独终老i 提交于 2019-12-19 21:45:40
问题 I am developing an XSD document to validate XML Import files. Nearly all elements of the import file 'can' have an ID attribute (UPDATE). The UPDATE attribute must be limited to 4 possible values, so I have this pre-set type to use for the attribute restriction... <xs:simpleType name="MyUpDir"> <xs:restriction base="xs:string"> <xs:enumeration value="OVERWRITE"/> <xs:enumeration value="ADDONLY" /> <xs:enumeration value="NOERASE" /> <xs:enumeration value="IGNORE" /> </xs:restriction> </xs

XSD custom type with attribute and restriction

五迷三道 提交于 2019-12-19 21:45:06
问题 I am developing an XSD document to validate XML Import files. Nearly all elements of the import file 'can' have an ID attribute (UPDATE). The UPDATE attribute must be limited to 4 possible values, so I have this pre-set type to use for the attribute restriction... <xs:simpleType name="MyUpDir"> <xs:restriction base="xs:string"> <xs:enumeration value="OVERWRITE"/> <xs:enumeration value="ADDONLY" /> <xs:enumeration value="NOERASE" /> <xs:enumeration value="IGNORE" /> </xs:restriction> </xs

Validating XML files against XSD in FireMonkey

本秂侑毒 提交于 2019-12-19 19:52:20
问题 I am developing a cross-platform application (for Windows, Mac etc.) and for 32-bit and 64-bit machines. I have lots of XML files which I need to validate against their XSD . Is there any way of doing this in Delphi XE3? I have tried DTD validation but I'm always getting a "DTD prohibited" error. I have also tried solutions mentioned on lots of websites to resolve this error, but I've had no success. Thanks in advance. Below is the code I've used... function TForm2.ValidateXML(const xmlFile :

Restricting XML Elements Based on Another Element via XSD

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 06:53:29
问题 I believe this has to do with keyref but I'm not for sure, and I am really not sure that it can be done at all. For example, say I have myElement1 and myElement2. If there are no myElement2 in the XML file, then myElement1 must exist, otherwise it is optional. Is there any way to force this type of validation in my XSD file? 回答1: Similar questions have been asked several times .. in stackoverflow or any tech blogs .. but the answer is always not possible , cases like : (a) validating Element

What does elementFormDefault do in XSD?

谁说我不能喝 提交于 2019-12-17 03:01:50
问题 What does elementFormDefault do, and when should it be used? So I found some definitions for elementFormDefault values: qualified - elements and attributes are in the targetNamespace of the schema unqualified - elements and attributes do not have a namespace So from that definition I would think that if a schema is set to qualified then why must you prefix the type with the namespace? And what are the scenarios that you would even have one set to unqualified for that matter? I tried Googling,

xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?

你说的曾经没有我的故事 提交于 2019-12-17 02:21:17
问题 For the following XML fragment: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> What do the xmlns , xmlns:xsi , and xsi:schemaLocation attributes exactly mean? How are they related? What's the : for? And there are 2 URLs in the xsi:schemaLocation= http://maven.apache.org/POM/4.0.0 (it happens to be the same as xmlns but it gives a 404

XSD schema only one element appears multiple times while xs:all

China☆狼群 提交于 2019-12-14 03:58:37
问题 I have a schema which looks like: <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Contacts"> <xs:complexType> <xs:sequence> <xs:element name="Contact" maxOccurs="unbounded"> <xs:complexType> <xs:all> <xs:element name="Id"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minLength value="1"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="Name"> <xs:simpleType> <xs:restriction

Validating XML where element names contain sequence numbers

独自空忆成欢 提交于 2019-12-14 03:26:11
问题 I'm trying to create an XSD for validating XML we receive from our customer. The XML looks something like this: <someElement> <items> <item1 name=”abc” /> <item2 name =”def” /> <item3 name =”ghi” /> </items> </someElement> Note that for whatever reason the item names also contain a number. The number of items isn't specified and will vary by file. Because of the line numbers in the element names something like this doesn't work: <xs:sequence> <xs:element name="items" type="item" maxOccurs=