relaxng

RelaxNG enumerated element names

只愿长相守 提交于 2019-12-12 03:19:14
问题 If I have element names that must look like this: <myElem> <subElem_n/> <subElem_n+1/> <subElem_n+2/> </myElem> Where 'n' = 0; How would I enforce this is RelaxNG? The tricky part is the dynamically generated element names. 回答1: Concerning your XML sample file : The XML you provide is not well formed. The + is not allowed in XML names. See here, have a look at PrefixedName and UnprefixedName to have precise syntax. Concerning your validation case : As far as I know, you can't add dynamically

How can I generate basic documentation from a Relax NG Schema

◇◆丶佛笑我妖孽 提交于 2019-12-11 06:29:06
问题 I'm trying to generate very simple documentation from the annotations in a Relax NG XML Schema. For example, given the following Relax NG: <?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <start> <element name="topNode"> <ref name="topNode-ref"/> </element> </start> <define name="topNode-ref"> <a:documentation>This is the top of

Jing Relaxng length Validation for String

风格不统一 提交于 2019-12-11 05:52:02
问题 I am Using Jing API for RelaxNG and xml Validation. I am Unable to Validate length of String which I have specified relaxng. I have Written the below standalone code in java. In the relaxng file i have specified minLength validation as 3 and in Code I am passing empty string still jing api is not throwing any error.The validation of string is not happing.I am using Jing API. My Code: public static void main(String[] args) throws JAXBException, IOException, SAXException,

Need help grasping RelaxngValidatingReader in Commons.Xml.Relaxng

北城以北 提交于 2019-12-11 05:28:19
问题 Environment: RelaxngValidatingReader .Net 2.0 Framework I can't seem to get the validator to equal false, no matter how much I change the xml around. Am I missing some concept here? Resource https://github.com/mono/mono/tree/master/mcs/class/Commons.Xml.Relaxng rnc compact format start = root root = element root { parent1* & parent2* } parent1 = element parent1 { element field { attribute usecase_123 {text} } } parent2 = element parent2 { element field { attribute usecase_AAA {text} } } xml

XSD sequence shows as ambiguous

对着背影说爱祢 提交于 2019-12-11 01:45:24
问题 I have an XSD which was transformed from a RELAX NG schema with a few errors I am trying to fix. The big issue I have it with the following <xs:element name="list"> <xs:complexType> <xs:sequence> <xs:choice> <xs:sequence> <xs:element minOccurs="0" ref="preamble"/> <xs:element minOccurs="0" ref="title"/> </xs:sequence> <xs:sequence> <xs:element minOccurs="0" ref="title"/> <xs:element minOccurs="0" ref="preamble"/> </xs:sequence> </xs:choice> <xs:group maxOccurs="unbounded" ref="block

How to validate xml document against relaxNG schema in libxml++

萝らか妹 提交于 2019-12-11 00:11:10
问题 I'm rather new to parsing xml in c++ and to xml in general. I'm trying to parse my document with SAXParser from libxml++ library, however, I would also like it to validate my document against a relaxNG schema. I've found that libxml2, which is underneath libxml++, has a relaxNG module, but I was unable to find out how to use its libxml++ binding. Any clues or code snippets would be appreciated. 回答1: After several tries it occured to me, that there is no relaxNG wrapper in libxml++, that is

relaxng: invalid schema definition?

Deadly 提交于 2019-12-10 19:00:53
问题 I'm trying to write a schema for some XML documents using RELAX-NG, and when I use it with jing, I get an error message I don't understand: C:\tmp\xml>java -jar jing.jar -c list-test2.rnc list-test.xml C:\tmp\xml\list-test2.rnc:6:10: error: repeat of "string" or "data" element Can anyone explain why and help me with a workaround? Here is a sample document (contrived for simplicity): list-test.xml: <?xml version="1.0" encoding="UTF-8"?> <list-test> <list name="list1"> foo.bar.baz quux be.bop.a

How to check that attributes are unique with RelaxNG?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 13:09:14
问题 With RelaxNG, can I check whether or not the value of an attribute is unique within an enclosing element? For example, this castle should validate: <castle> <room> <door to="North" /> <door to="South" /> </room> <room> <door to="North" /> </room> </castle> But this should not (duplicate door in same room ): <castle> <room> <door to="Dungeon" /> <door to="Dungeon" /> </room> </castle> I'm using RelaxNG (compact). I don't know the attribute values 'ahead of time', only that they should be

Validating xml against relax ng in ANSI C

穿精又带淫゛_ 提交于 2019-12-06 03:32:17
问题 Is it possible to validate an xml file against a Relax NG schema in ANSI C? I have come across this library called libxml2 but all help I could get from it is with respect to how to parse an xml file. Please help. And if it can be done, what are the steps? Utterly ignorant about this w.r.t. the C environment. 回答1: Here is a minimalistic example (you should of course add your own error checking): #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <libxml/xmlmemory.h>

Maintaining Consistency Between JavaScript and C# Object Models

点点圈 提交于 2019-12-05 08:41:15
I'm working on an ASP.NET web application that uses a lot of JavaScript on the client side to allow the user to do things like drag-drop reordering of lists, looking up items to add to the list (like the suggestions in the Google search bar), deleting items from the list, etc. I have a JavaScript "class" that I use to store each of the list items on the client side as well as information about what action the user has performed on the item (add, edit, delete, move). The only time the page is posted to the server is when the user is done, right before the page is submitted I serialize all the