xsd

XSD sequence compile to different lists

主宰稳场 提交于 2020-01-15 12:32:21
问题 I have XSD schema like this: <xs:complexType name="Element" abstract="true"> <xs:sequence maxOccurs="unbounded"> <xs:element name="resistor" type="vs:Resistor" maxOccurs="unbounded"/> <xs:element name="capacitor" type="vs:Capacitor" maxOccurs="unbounded"/> <xs:element name="inductor" type="vs:Inductor" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> And when I process this schema through JAXB I get a field like this: @XmlElements({ @XmlElement(name = "resistor", required = true, type

How to create an XSD choice without an element name

半腔热情 提交于 2020-01-15 09:46:42
问题 I'm struggling with my XML Schema and staring at the screen isn't helping. The XML I'm trying to create a schema for looks like this: <root> <command>FOO|BAR|BLOOP</command> <parameters> <param1>val</param1> <param2>val</param2> </parameters> <root> Depending on whether the command value = FOO, BAR or BLOOP a different set of parameters needs to be in the parameters-tag and it may be empty. The set of parameters that needs to appear for a certain command is defined and some command-names have

JAXB unmarshalling not tolerating whitespace around token enumerations

青春壹個敷衍的年華 提交于 2020-01-15 09:13:51
问题 JAXB 2 (Oracle / Metro version 2.2.7 and I suspect others as well) doesn't seem to tolerate whitespace around values in enumeration elements. Minimal example follows. Both xmllint and Xerces validate the instance against the schema. The puzzling think is that JAXB validation doesn't complain but returns null when trying to access the value. How can I configure it to return the value properly? update: I 've tried associating an XmlAdapter to trim the strings, as suggested here, but the result

JAXB unmarshalling not tolerating whitespace around token enumerations

那年仲夏 提交于 2020-01-15 09:13:00
问题 JAXB 2 (Oracle / Metro version 2.2.7 and I suspect others as well) doesn't seem to tolerate whitespace around values in enumeration elements. Minimal example follows. Both xmllint and Xerces validate the instance against the schema. The puzzling think is that JAXB validation doesn't complain but returns null when trying to access the value. How can I configure it to return the value properly? update: I 've tried associating an XmlAdapter to trim the strings, as suggested here, but the result

cvc-complex-type.2.3: Element 'group' cannot have character [children], because the type's content type is element-only

ぃ、小莉子 提交于 2020-01-15 08:26:39
问题 I need to create XML from this XSD: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="group"> <xs:complexType> <xs:sequence> <xs:element name="person" minOccurs="5" maxOccurs="20" type="xs:string"/> </xs:sequence> <xs:attribute name="name" use="required" type="xs:string"/> </xs:complexType> </xs:element> </xs:schema> Here is the XML I've tried: <?xml version="1.0" ?> <group name="abcd"> xmlns="www.example.org" xmlns:xsi="http:/

cvc-complex-type.2.3: Element 'group' cannot have character [children], because the type's content type is element-only

梦想与她 提交于 2020-01-15 08:26:12
问题 I need to create XML from this XSD: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="group"> <xs:complexType> <xs:sequence> <xs:element name="person" minOccurs="5" maxOccurs="20" type="xs:string"/> </xs:sequence> <xs:attribute name="name" use="required" type="xs:string"/> </xs:complexType> </xs:element> </xs:schema> Here is the XML I've tried: <?xml version="1.0" ?> <group name="abcd"> xmlns="www.example.org" xmlns:xsi="http:/

Neo4j: Enforcing schema with XSD

核能气质少年 提交于 2020-01-15 08:19:26
问题 I was wondering if there exists a tool for Neo4j that can read an XSD file and use it to enforce a schema on Neo4j. I'm newbie on graph databases but I'm starting to appreciate the schema-less approach. There's a lot of projects out there that have been pumping in a lot of non-sequential data and making sense of it all which is really cool. I've come across some requirements that call for control on what properties a node or edge can have given a certain label and what labels an edge can have

How create references between elements in XML

核能气质少年 提交于 2020-01-15 06:37:09
问题 Is possible do reference to an existing element in xml file? I searched on Google but have not found the answers I was hoping for. I start immediately explaining my goal: <Car id="car1"> <plate>AAA</plate> <mark>Peugeot</mark> </Car> <Truck id="truck1"> <plate>BBB</plate> <mark>Scania</mark> </Truck> <Trailer id="trailer1"> <plate>CCC</plate> <mark>Menci</mark> </Trailer> <TrailerTruck> <Truck id="truck1"/> <Trailer id="trailer1"> </TrailerTruck> ... in this way I don't duplicate nothing. Can

How to reference an attribute in xsd

南楼画角 提交于 2020-01-15 05:43:07
问题 I tried to define an attribute that could be referenced in subsequent element definitions. <xs:attribute name="ridref" type="xs:string"/> Later I use it like this: <xs:element name="coordRegRef"> <xs:complexType> <!--xs:attribute name="ridref" type="xs:string"/ this works but I want to use ref --> <xs:attribute ref="ridref" use="required"/> </xs:complexType> </xs:element> XSD compiles fine with xmllint xmllint --schema pc-ar.xsd pc-ar.xml But xmllint says pc-ar.xml:41: element coordRegRef:

How to reference an attribute in xsd

梦想的初衷 提交于 2020-01-15 05:43:07
问题 I tried to define an attribute that could be referenced in subsequent element definitions. <xs:attribute name="ridref" type="xs:string"/> Later I use it like this: <xs:element name="coordRegRef"> <xs:complexType> <!--xs:attribute name="ridref" type="xs:string"/ this works but I want to use ref --> <xs:attribute ref="ridref" use="required"/> </xs:complexType> </xs:element> XSD compiles fine with xmllint xmllint --schema pc-ar.xsd pc-ar.xml But xmllint says pc-ar.xml:41: element coordRegRef: