xsd

Datatype format exception for xsd:dateTime in SPARQL query with Jena?

你离开我真会死。 提交于 2020-01-04 01:58:17
问题 I am trying to apply a range query on a property of the RDF which is of xsd:dateTime format. This is my query: PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?x WHERE { ?y <DATE:> ?x . FILTER(?x>"2014-06-05T10:10:10+0530"^^xsd:dateTime) } It gives warning and nothing as result: WARN [main] (Log.java:78) - Datatype format exception: "2014-06-11T12:44:22+0530"^^xsd:dateTime I don't understand what the problem is? I have stored the property in xsd:dateTime format only. 回答1: I have stored

Why are attributes not supported with the DataContractSerializer?

爷,独闯天下 提交于 2020-01-03 21:09:10
问题 I create xsd's based upon client's documentation and all of the xsd's have attributes. I have been using xsd.exe to generate the classes from the xsd's, but I read that attributes aren't supported for the DataContractSerializer. Why not? Does this mean that I can only have an soap+xml file with just elements? This is not possible because I don't create the requests. Is there a way to specify to svcutil to recognize attributes? 回答1: DataContractSerializer was created with a "code-first"

Nesting XML elements from different namespaces in XSD

烂漫一生 提交于 2020-01-03 19:31:27
问题 Assume that I have an XML schema definition for elements of a namespace that I would like to use as child elements of XML elements within a second namespace. As an example, suppose we have file foo.xsd : <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns="urn:foo-ns" targetNamespace="urn:foo-ns" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="foo" type="fooType"/> <xs:complexType name="fooType"> <xs:attribute name="id" use="required"/> </xs

Simultaneously writing and validating XML

丶灬走出姿态 提交于 2020-01-03 17:47:36
问题 I have a Write method that serializes objects which use XmlAttributes. It's pretty standard like so: private bool WriteXml(DirectoryInfo dir) { var xml = new XmlSerializer(typeof (Composite)); _filename = Path.Combine(dir.FullName, _composite.Symbol + ".xml"); using (var xmlFile = File.Create(_filename)) { xml.Serialize(xmlFile, _composite); } return true; } Apart from trying to read the file I have just written out (with a Schema validator), can I perform XSD validation WHILE the XML is

Checking a java value with an xml schema

北城余情 提交于 2020-01-03 17:08:14
问题 is it possible to check a value in a java object with some rules in a xml schéma ? For exemple, I have a String txt = "blablabla" , and I should verify if it's ok for <xs:element name="foo" type="string32"/> , with string32 a restriction to 32 caract. length max. Is it possible ? If it's not possible with xml schema and jaxb, is there other schema langage which is possible ? Thanks. 回答1: You could do the following: import java.io.File; import javax.xml.XMLConstants; import javax.xml.bind

Parsing/Deserialize XML to JavaObjects

拈花ヽ惹草 提交于 2020-01-03 16:57:21
问题 i started a small new project and i want to deserialize objects from XML. i created a xsd: http://pastebin.com/n1pwjRGX and an example XML File : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <hdb> <country code="DE"> <variableHoliday daysAfterEaster="49" name="PENTECOAST" /> <fixedHoliday month="JANUARY" day="1" name="NEWYEAR" /> <region code="sa"> <fixedHoliday month="APRIL" day="1" name="FUNNYDAY" /> <variableHoliday daysAfterEaster="0" name="EASTERSUNDAY" /> </region> <region

@xmlschema jaxb package-info.java compilation error

跟風遠走 提交于 2020-01-03 16:57:16
问题 I'm trying to use annotations at package level but I get compilation erros from Eclipse. I have a class Head with the following package/annotation: @javax.xml.bind.annotation.XmlSchema ( xmlns = { @javax.xml.bind.annotation.XmlNs(prefix = "com", namespaceURI="http://es.indra.transporte.common"), @javax.xml.bind.annotation.XmlNs( namespaceURI="http://www.w3.org/2001/XMLSchema") }, namespace = "http://es.indra.transporte.common", elementFormDefault = javax.xml.bind.annotation.XmlNsForm

JAXB - List<Serializable>?

a 夏天 提交于 2020-01-03 16:57:15
问题 I made some classes using xjc. public class MyType { @XmlElementRefs({ @XmlElementRef(name = "MyInnerType", type = JAXBElement.class, required = false), }) @XmlMixed protected List<Serializable> content; public List<Serializable> getContent() { if (content == null) { content = new ArrayList<Serializable>(); } return this.content; } } But i cant add inner elements using getContent().add(newItem); because MyInnerType is not Serializable. Why its not a List of Objects? How do i add inner

Where to put copyright information in an XSD?

主宰稳场 提交于 2020-01-03 15:40:35
问题 When placing copyright information in an XML Schema Definition (XSD), is there an official (or semi-official, universally accepted) location for doing so? Based on Where to add a version to an XSD schema?, there's an official version attribute in the xs:schema element - is there something similar for copyright information? I have seen people using annotation/documentation elements (e.g. here) for something like this - is this the accepted way of doing this? <xsd:annotation> <xsd:documentation

Jaxb: Generate constant value for fixed-value attribute

人盡茶涼 提交于 2020-01-03 13:56:10
问题 I'm currently working on a xsd which uses the following contruct: <xs:attribute name="listVersionID" type="xs:normalizedString" use="required" fixed="1.0"> While not problematic per se, it is rather annoying to work with, since the fixed-value of this definition increases between releases of the xsd spec, and we need to modify the values in a seperate constants-class to keep them valid, although little if anything of interest in the xsd has changed. The xsd is maintained elsewhere, so just