xsd

How to add an attribute “type” for default data type of elements in XSLT transformation

好久不见. 提交于 2019-12-24 03:50:49
问题 For Example : Input XML: <employee> <name>Ragu</name> <city>Chennai</city> <age>25</age> </employee> Data type for above request xml element has been defined in request Schema file. name is string, city is string and age is int data type. Output of transformation should be like: <employee> <name type="string">Ragu</name> <city type="string">Chennai</city> <age type="int">25</age> </employee> Please anyone give the solution for this transformation. Thanks in Advance 回答1: You can use document()

xsd: define an element that can be repeated an even number of times

不打扰是莪最后的温柔 提交于 2019-12-24 03:41:15
问题 with xsd, is there a way in which we can define an element that is repeated an even number of times? with my information it is not possible with the attributes minOcurs and maxOccurs. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:element name="A"> <xs:complexType> <xs:sequence> <xs:element name="B" maxOccurs="?" minOccurs="?"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> 回答1: How about this: <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element name="B"

Not sure why my XML file is coming up as invalid/no grammar found and why my schema is not validating either?

对着背影说爱祢 提交于 2019-12-24 03:37:17
问题 I am somewhat new to XML, but I have been unable to figure out these errors. This is my first time attempting to create "advanced" schemas, but I was uncertain about importing and how exactly to reference the "urlset" in the schema... These are the errors: Ln 14 Col 7 - Document is invalid: no grammar found. Ln 14 Col 7 - Document root element "sites", must match DOCTYPE root "null". 2 Errors ... Ln 31 Col 98 - s4s-att-invalid-value: Invalid attribute value for 'ref' in element 'element'.

How to Programmatically Update and Add Elements to an XSD

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 03:27:27
问题 I need to programatically update an an existing XSD in java that looks like this: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns="com/company/common" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="com/company/common/" elementFormDefault="qualified"> <xs:include schemaLocation="DerivedAttributes.xsd" /> <xs:element name="MyXSD" type="MyXSD" /> <xs:complexType name="Containter1"> <xs:sequence> <xs:element name="element1" type="element1" minOccurs="0" maxOccurs="unbounded"

XML Schema: Extend xsd:choice so that union (not sequence) of choices is created

懵懂的女人 提交于 2019-12-24 03:25:52
问题 I have the following XML Schema <xsd:complexType name="SimpleThing"> <xsd:choice maxOccurs="unbounded"> <xsd:group ref="simpleContent" /> </xsd:choice> </xsd:complexType> <xsd:complexType name="ExtendedThing"> <xsd:complexContent> <xsd:extension base="SimpleThing"> <xsd:choice maxOccurs="unbounded"> <xsd:element name="qux" /> </xsd:choice> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:group name="simpleContent"> <xsd:choice> <xsd:element name="foo" /> <xsd:element name="bar"

Is it possible to validate XML against an XSD in Silverlight 3?

喜欢而已 提交于 2019-12-24 03:15:44
问题 Is seems like all the commonly-used classes for XMLValidation, for example XmlValidatingReader, are absent (or present "for interface compatibility only") in Silverlight. Is there any way to validate XML against an XSD schema in Silverlight? 回答1: Sorry, but I still don't think this is still possible in SL3: http://forums.silverlight.net/forums/p/53434/138536.aspx If you really , really need to reuse a .NET assembly in SL you can do so, but it means packaging that up with your application. I

How to make “use” attribute (required/optional) depend on another value?

醉酒当歌 提交于 2019-12-24 02:25:10
问题 I'm trying to do some specific stuff in an XSD XML Schema. I want to set an element as use="required" , only if there a specific value to an attribute of another element. Example: <udi att1="all"> <name att2="dsd"/> <phone att3="dsd"/> </udi> I want the phone element to be required, only if the att1 value is all . I was told that XPath could work for this - or is there a better way? 回答1: XML is not relational, it's hierarchical. Schemas are designed to enforce rules on nesting, not on rules

Can an element in xsd have an arbitrary name?

穿精又带淫゛_ 提交于 2019-12-24 02:24:13
问题 I am new to xsd validation, and am trying to validate if a choice tag has a specific group of elements but also has ones with arbitrarily named. Something like the following: ... <xs:choice> <xs:element name="test1" type="xs:string" /> <xs:element name="test2" type="xs:string" /> <xs:element name="-some regex or something to specify arbitrary name here" type="xs:string" /> </xs:choice> ... Xml: ... <test1>example text</test1> <test2>example text again</test2> <exampleNode>example text<

Adding XML elements in the right order

别说谁变了你拦得住时间么 提交于 2019-12-24 01:49:43
问题 I want to add elements to the XDocument object and the order of the elements for that XML I want to build is defined in a XSD e.g. <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Address"> <xs:complexType> <xs:sequence> <xs:element name="Recipient"/> <xs:element name="City"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Now I want to add the following two XElements XDocument doc = new XDocument(new XElement(

WCF Generics - Why do DataContract and CollectionDataContract allow formatted naming, but not DataMember, OperationContract or ServiceContract?

北城余情 提交于 2019-12-24 01:09:18
问题 Basically as the title says: [DataContract(Name = "{0}Item")] //This will format properly public class GenericItem<T> { [DataMember(Name = "The{0}")] //This will NOT format properly public T TheItem { get; set; } } [CollectionDataContract(Name = "{0}Items")] //This will format properly public SpecialCollection<T> : Collection<T> { } [ServiceContract(Name = "{0}Service")] //This will NOT format properly public interface IGenericService<T> { [OperationContract(Name = "Get{0}")] //This will NOT