xsd-validation

Validate XML against XSD with JavaScript on client side

谁说我不能喝 提交于 2021-01-20 04:25:43
问题 I am required to show a user an XMLfile in a friendly way as a result I am creating a tree like structure such as: http://thecodeplayer.com/walkthrough/css3-family-tree instead of showing the user the raw XML. Right now when creating a new node I am validating that on the server side. If the server validates the new proposed XML(tree) then I go ahead and create a new node for example. Anyways now I will like to allow the user to drag these nodes. When dragging the nodes if I validate the

XML validation and namespaces in .NET

时光总嘲笑我的痴心妄想 提交于 2020-12-05 08:51:28
问题 What I'm trying to do is to validate XML against an XSD. This is all pretty straightforward, but I'm having a problem with XML's without a namespace. C# only validates the xml if the namespace matches the targetnamespace of the XSD. This seems right, but an XML with no namespace or a different one then the SchemaSet should give an exception. Is there a property or a setting to achieve this? Or do I have to get the namespace manually by reading the xmlns attribute of the xml? An example to

XML validation and namespaces in .NET

醉酒当歌 提交于 2020-12-05 08:48:21
问题 What I'm trying to do is to validate XML against an XSD. This is all pretty straightforward, but I'm having a problem with XML's without a namespace. C# only validates the xml if the namespace matches the targetnamespace of the XSD. This seems right, but an XML with no namespace or a different one then the SchemaSet should give an exception. Is there a property or a setting to achieve this? Or do I have to get the namespace manually by reading the xmlns attribute of the xml? An example to

Where does xsd:attribute declaration go in global xsd:complexType?

混江龙づ霸主 提交于 2020-11-29 09:55:04
问题 I want to declare an attribute of an element already defined. I would like that the element person could have 2 attributes ( name , id ) I have this: <xs:element name="person" type="perso" /> <xs:complexType name="perso"> <!-- I tried to declare the attribute here.Not working--> <xs:sequence> <!-- I tried to declare the attribute here.Not working--> <xs:element name="description" type="xs:string" /> </xs:sequence> </xs:complexType> I am looking to declare a global, not local, complex type. I

Where does xsd:attribute declaration go in global xsd:complexType?

核能气质少年 提交于 2020-11-29 09:54:08
问题 I want to declare an attribute of an element already defined. I would like that the element person could have 2 attributes ( name , id ) I have this: <xs:element name="person" type="perso" /> <xs:complexType name="perso"> <!-- I tried to declare the attribute here.Not working--> <xs:sequence> <!-- I tried to declare the attribute here.Not working--> <xs:element name="description" type="xs:string" /> </xs:sequence> </xs:complexType> I am looking to declare a global, not local, complex type. I

Empty elements for primitve datatypes forbidden in XSD

ぐ巨炮叔叔 提交于 2020-01-24 15:51:31
问题 I encountered a parsing error with Apache CXF while processing a webservice response. What it comes down to is an empty element being returned: <myValue /> The element definition is as follows: <xsd:element name="myValue" type="xsd:float" minOccurs="0"> Now I've read on the CXF mailing list that an empty value is not allowed by the XSD-spec: Well, there isn't a workaround for this as it's not a bug. An empty element is not valid for any Decimal or Date type or anything like that. Thus, it

XSD from variable number of XML elements

风流意气都作罢 提交于 2020-01-16 19:38:35
问题 I'm creating a xml document based on some conditions in my app. the number of elements inside my xml is always variable. For instance, one time it may look like: <TransactionTypes> <X value="false" text="" /> <O value="false" text="" /> <E value="false" text="" /> <P value="false" text="" /> <C value="false" text="" /> <K value="false" text="" /> </TransactionTypes> and the other time like: <TransactionTypes> <TT value="false" text="" /> <EP value="false" text="" /> <PY value="false" text=""

No declaration found for element

旧城冷巷雨未停 提交于 2020-01-16 16:48:13
问题 I have a simple XML and XSD files. I am using Xerces to generate .h/cpp files but when I run the application it gives an error: no declaration found for element 'x:books' My XML file is: <?xml version="1.0"?> <x:books xmlns:x="urn:books" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:BookStore books.xsd"> <book id="bk001"> <author>Writer</author> <title>The First Book</title> <genre>Fiction</genre> <price>44.95</price> <pub_date>2000-10-01</pub_date> <review>An

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:/