xsd

Javascript RegEx to XML Schema RegEx

这一生的挚爱 提交于 2019-12-24 00:26:23
问题 I have this Javascript pattern ^(\b[A-Z]\w*(\s|\.)*)+$ I tried using it on my XML Schema <xs:pattern value="^(\b[A-Z][a-z]*(\s|\.)*)+$"> But when I validate I received an error saying InvalidRegex: Pattern value '^(\b[A-Z][a-z] (\s|.) )+$' is not a valid regular expression. The reported error was: 'This expression is not supported in the current option setting.'. Is there a way for my Javascript pattern to work on my XML Schema pattern? 回答1: Is not always possible to transform JS regex to XSD

Define WCF XML response schema

不打扰是莪最后的温柔 提交于 2019-12-24 00:22:53
问题 I build a WCF Rest service to provide data for another process. suppose that his name is GetData. This one provide a xml response having this structure : <?xml version="1.0" encoding="utf-8"?> <GetDataResponse xmlns="http://tempuri.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <GetDataResult> <DataMessage> <a></a> <b></b> <c></c> </DataMessage> </GetDataResult> </GetDataResponse> the service interface : [XmlSerializerFormat]

XSD <xs:all> with multi occurrences unordered

牧云@^-^@ 提交于 2019-12-23 23:34:42
问题 I've the following XML <?xml version="1.0" encoding="UTF-8" standalone="no"?> <props> <id>someId</id> <file_size> <size>123</size> <unit>MB</unit> </file_size> <file_size> <size>123</size> <unit>MB</unit> </file_size> </props> And the corresponding XSD: <?xml version="1.0" encoding="UTF-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"> <xs:element name="props"> <xs:complexType> <xs:sequence> <xs:element type="xs

Specify sorting in lists of elements in XML Schema

江枫思渺然 提交于 2019-12-23 23:27:06
问题 Is there a way to specify in an XML Schema that the elements of a list must appear sorted by some text nodes? E.g.: I want to craft an xsd for which the following xml is valid: <root> <Users> <User> <Id>1</Id> <Username>lsuarez</Username> </User> <User> <Id>3</Id> <Username>dforlan</Username> </User> <User> <Id>7</Id> <Username>ecavanni</Username> </User> </Users> </root> But the following is not: <root> <Users> <User> <Id>7</Id> <Username>ecavanni</Username> </User> <User> <Id>1</Id>

Does anyone know where to get the XSD file describing the junitReport.xml file format expected by Hudson?

蓝咒 提交于 2019-12-23 23:15:01
问题 I need the XSD of junitReport.xml recognized by Hudson. Does anyone know where can it be found? Thanks. 回答1: I've create a junit.xsd for Ant's junit task. It was created by examining the relevant Java code in Ant 1.8.2 回答2: At this link, someone has already tried to analyse the JUnit code to check for any references for it's XML schema. But an XSD is no requirement to create XML and apparently, it doesn't use one. 来源: https://stackoverflow.com/questions/1385499/does-anyone-know-where-to-get

Compiling huge schema into Java

六月ゝ 毕业季﹏ 提交于 2019-12-23 21:19:47
问题 There are two major tools which provides a way to compile XSD schema into Java: xmlbeans and JAXB. The problem is the XSD schema is really huge: 30MB of XML files, most of the schema isn't used in my project, so I can comment out most of the code, but it not a good solution. Currently my project uses xmlbeans which compiles the schema with major changes. It produces ~60MB of classes and it takes ~30 min to compile. Another solution is to use JAXB, which generates ~14MB of code without need to

Formatting decimal values for XML

自作多情 提交于 2019-12-23 20:51:54
问题 I have a problem currently where a system we are connecting to expects to receive XML which contains, among other things, three double fields formatted to one decimal place. Personally I feel that our system should just be able to send values in default format and then it's up to other systems to format their own representation as they please, but alas this doesn't seem to be an option. My Java-based system is currently converting objects to XML through the use of XStream. We have an XSD

How do I find the number of elements in a <xs:list> using XSLT?

人走茶凉 提交于 2019-12-23 20:33:10
问题 I have an XML schema that contains the following type : <xs:simpleType name="valuelist"> <xs:list itemType="xs:double"/> </xs:simpleType> A sample XML fragment would be: <values>1 2 3.2 5.6</values> In an XSLT transform, how do I get the number of elements in the list? How do I iterate over the elements? 回答1: I. XPath 2.0 (XSLT 2.0) solution : count(tokenize(., ' ')) II. XPath 1.0 (XSLT 1.0) solution : string-length() - string-length(translate(normalize-space(), ' ', '')) + 1 As for iteration

XML unmarshalling using Jaxb with namespaces and schema

走远了吗. 提交于 2019-12-23 20:15:04
问题 I have an XML document that looks like this: <?xml version="1.0" encoding="UTF-8"?> <xs:msgdata xmlns:xs="http://www.myCompany.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.myCompany.com msgdata.xsd"> <xs:msgid>MsgID001</xs:msgid> <xs:msgHash>hlkJKLHljkhkjlHKJLHkjl6y987HJKH</xs:msgHash> </xs:msgdata> A schema document (called msgdata.xsd) was also sent to me. I am using JAXB to unmarshall the above xml document to a Java object. The unmarshalling

Defining recursive algebraic data types in XML XSD

[亡魂溺海] 提交于 2019-12-23 18:44:01
问题 Imagine I have a recursive algebraic data type like this (Haskell syntax): data Expr = Zero | One | Add Expr Expr | Mul Expr Expr I'd like to represent this in XML, and I'd like an XSD schema for it. I have figured out how to achieve this syntax: <Expr> <Add> <Expr> <Zero/> </Expr> <Expr> <Mul> <Expr> <One/> </Expr> <Expr> <Add> <Expr> <One/> </Expr> <Expr> <One/> </Expr> </Add> </Expr> </Mul> </Expr> </Add> </Expr> with this schema: <xs:complexType name="Expr"> <xs:choice minOccurs="1"