xsd

Tool to convert xsd to c++ code

我的梦境 提交于 2021-01-28 04:21:44
问题 Is there any tool to convert xsd to c++ code. The generated code can be used for serialization and parsing the xml. It should also be run as a independent. I saw some opensource tools like CodeSynthesis but it has covered by GPL license. I am looking for a tool which will generate code that could run independently. 回答1: xsd.exe generates code for C++\CLI too. It is not added in \languages in the documentation. But when executing xsd.exe in VS CommandPrompt, in the \languages section you could

XSD requiring a specific root element exist in an XML document?

余生长醉 提交于 2021-01-28 03:35:03
问题 I want to validate a XML file and to make sure it has a root element called speak like this: <speak> <!--other node here...--> </speak> the speak element must exist in XML and must appears only once. I try to add code below in my XSD file: <xsd:element name="speak" type="speak" minOccurs="1" maxOccurs="1"/> But it does not work. 回答1: In the schema itself, you can't put a constraint on what the root element must be. (That's by design, though not everyone thinks it's a good design.) Any global

XSD define element by name or alternate attribute

自作多情 提交于 2021-01-28 00:43:42
问题 Consider two possible implementations of a "tag group": Authors are allowed to use either an element named <tag-group> or any element with attribute role="tag-group" . I'd like to write an XSD schema that will validate either case. Ideally, the schema can also validate that children are valid within a given parent. The "tag group", for example, allows children to be either an element named <tag> or any element with attribute role="tag" . So the ideal schema would validate, that given <tag

Error: It was detected that X is in namespace Y, but components from this namespace are not referenceable from schema document

泄露秘密 提交于 2021-01-27 22:02:02
问题 What's wrong in this xsd elements? <?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="MessageInfoType"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="1" name="TimeStamp" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:element name="GetData"> <xsd:annotation> <xsd:documentation>Send data</xsd:documentation> </xsd:annotation> <xsd

How to define a simple element and attribute in XSD

别来无恙 提交于 2021-01-27 13:23:42
问题 My XML looks like this: <test attri="value">content</test> I have trouble building this in XML Schema, since I can't give a complexType content and can't give a simpleType an attribute. I feel like there should be a very simple solution to this that I am overlooking. 回答1: use the following: <xs:element name="test "> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="attri" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs

XSD Error: This element is not expected

情到浓时终转凉″ 提交于 2021-01-27 05:30:31
问题 I was writing an XSD to validate a XML, but when I was validating this error appeared: Output - error Validation of current file using XML Schema: ERROR: Element '{http://www.w3.org/2001/XMLSchema-instance}Gasto': This element is not expected. Expected is ( Gasto ) ... and I'm not understanding the error Here is a sample of my XML: <?xml version="1.0" encoding="UTF-8"?> <Armazem> <Lista_Gastos xmlns:artGasto="http://www.w3.org/2001/XMLSchema-instance" artGasto:noNamespaceSchemaLocation=

How to improve speed large xml validation against xsd in Java?

旧巷老猫 提交于 2021-01-27 05:24:07
问题 I'm trying to validate a very XML (~200MB) against XSD. It's taking almost 3 hours. I'm not sure what am I doing wrong here? SchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI); Schema schema = sf.newSchema(new File(this.productExtraInfoXsd)); DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse(new File(filePath)); DOMSource

How to improve speed large xml validation against xsd in Java?

半腔热情 提交于 2021-01-27 05:23:38
问题 I'm trying to validate a very XML (~200MB) against XSD. It's taking almost 3 hours. I'm not sure what am I doing wrong here? SchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI); Schema schema = sf.newSchema(new File(this.productExtraInfoXsd)); DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse(new File(filePath)); DOMSource

How to improve speed large xml validation against xsd in Java?

我是研究僧i 提交于 2021-01-27 05:21:30
问题 I'm trying to validate a very XML (~200MB) against XSD. It's taking almost 3 hours. I'm not sure what am I doing wrong here? SchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI); Schema schema = sf.newSchema(new File(this.productExtraInfoXsd)); DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse(new File(filePath)); DOMSource

How can I generate java classes for xml deserialization using an xml schema?

旧街凉风 提交于 2021-01-21 04:26:07
问题 I'd like an easy way to generate Java classes from a schema so that I can easily deserialize xml and interpret using the objects. Using Jaxb would be great, but I'm open to any framework that will accomplish the same thing. The schema is the HL7 CDA Schema. It's very complex and I'm guessing that's why I'm having problems with it. I tried using xjc and JAXB (this would be ideal) but I get an the following error xjc -d ~/code/ccd/java -p net.msdelta.cda -xmlschema -verbose CDA.xsd parsing a