xsd

validating XML node over a XSD file

别说谁变了你拦得住时间么 提交于 2020-01-05 09:11:59
问题 I'm trying to validate XML nodes or fragments against an XML schema. I have read this article: Validating xml nodes, not the entire document but the chosen solution doesn't look like to work for me. private void ValidateSubnode(XmlNode node, XmlSchema schema) { XmlTextReader reader = new XmlTextReader(node.OuterXml, XmlNodeType.Element, null); XmlReaderSettings settings = new XmlReaderSettings(); settings.ConformanceLevel = ConformanceLevel.Fragment; settings.Schemas.Add(schema); settings

Generating jaxb classes with naming conflicts

我只是一个虾纸丫 提交于 2020-01-05 08:30:36
问题 I have created a new JAXB project and imported an xsd which I am trying to generate JAXB classes off of. When I select "Generate->JAXB Classes" I get a number of similar errors all which relate to naming conflicts: A class/interface with the same name "generated.Document" is already in use. Use a class customization to resolve this conflict. The above error is thrown from the following piece of the .xsd file <xs:complexType name="Document"> <xs:sequence> <xs:element ref="Document"/> </xs

SAX parsing through a jar file declares XML document invalid

自古美人都是妖i 提交于 2020-01-05 08:00:50
问题 The picture is self explanatory. When I validate the document using identical process in CMD, the document is declared valid. It is valid when checked manually. The jar file generates this message: Invalid schema_reference.4: Failed to read schema document 'E:/XML and Java/Pro XML Development with Java/schema.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. The question is: WHY? The process of validating

XML/XSD graphical representation of the tree

ぐ巨炮叔叔 提交于 2020-01-05 07:45:33
问题 I have constructed a XML file and generated a XSD file from it. The XML is almost empty as there are elements but without value : <parent> <child1/> <child2/> </parent> What I'm looking for is a soft that could convert my XML (or its associated schema) into a graphical representation as a tree : parent | | _______________________________ | | | | child1 child2 with cute boxes, colors and so on. Any suggestion ? Thanks 回答1: In general, it would be helpful to understand why you would be doing it

XSD.exe generating unwanted string values in enum type instead of just the digit values specified in the file

南楼画角 提交于 2020-01-05 07:14:28
问题 I have and xsd file that contains a enumerated type with options of 1 or 2. This is an extract of the file that contains the enum type CompanyCode <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="HOST"> <xs:complexType> <xs:sequence> <xs:element name="Header" type="Header" minOccurs="0"/> <xs:element name="MLC" minOccurs="0"> <xs:complexType> <xs:sequence> <xs

Exception: cvc-complex-type.2.4.a: Invalid content was found starting with eleme nt 'employee'. One of '{contractemployee}' is expected

霸气de小男生 提交于 2020-01-05 07:11:22
问题 So ..I have this ER diagram: Hence I wrote an company.xml as: <?xml version="1.0" encoding="UTF-8"?> <company xmlns="urn:company.Namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="urn:company.Namespace companyxsd.xsd"> <companyname>ABC company</companyname> <address>xyz street, India.</address> <department> <dname>Marketing</dname> <deptphoneno>9876543210</deptphoneno> <deptfaxno>0442456879</deptfaxno> <deptemail>marketing@abc.com</deptemail> <employee> <empid

Schema validation with maxOccurs element fails

ぐ巨炮叔叔 提交于 2020-01-05 05:49:07
问题 Schema for the element which occurs multiple (e.g. 2 times) times in XML,always fails giving the error "Schemas validity error : Element 'name': This element is not expected". "name" is an intermediate elements of XML file i.e. we have other elements in XML and "name" comes in mid of XML file. XML file have proper header as " " Sample "name" element in XML file : <name> <First>1</First> <last>1</last> </name> <name> <First>1</First> <last>1</last> </name> Sample Schema tried as below, but

Enumeration of a complex type

六眼飞鱼酱① 提交于 2020-01-05 05:31:06
问题 How can I make an enumeration of a complex type? For example, I want to store the following data into a xsd enumeration called Measurings description tag item item tag fileName each one of these attributes has an specific value and this set makes one registry in my ennumeration. But the problem is that as far as I know, it's allowed just the "value" attribute in an enumeration. 回答1: There is nothing like complex type enumeration in XML Schema. You'll need to organize it externally. See http:/

XML/XSD validation for a Word doc

送分小仙女□ 提交于 2020-01-05 04:58:35
问题 I have a document that will constantly be updated and consists of text and tables. The tables have two rows, one which ranges of numbers and the second with a single number. I would like to check if the number in row 2 is within the range given in row 1. I would like to do this using XMLs and XSDs. My original thought was to create an XSD from the word doc, then an XML from the word doc (save the file as a .xml) and then run both files through a vaidator. However, I am having trouble writing

How can allowed element values depend on other element values in XSD?

北战南征 提交于 2020-01-05 04:54:13
问题 I have a following task (in simple version): Describe in XSD temperatures. There are min, max and default values. Default should be placed inside of min...max values. How to describe these things with XSD? I mean: Min_Set_Temp [ Integer between 0 and 1000 ] Max Set Temp [ Integer between 0 and 1000 ] Default_Set_Temp [ Integer between Min Set Temp and Max Set Temp] XSD start: <xs:simpleType name="tSetTemperature"> <xs:restriction base="xs:unsignedShort"> <xs:minInclusive value="0"/> <xs