xml-validation

Local XML validation with DTD or XSD using a relative path?

我怕爱的太早我们不能终老 提交于 2019-12-06 06:18:35
问题 An XML file can be defined and validated with an Document Type Description (DTD) or XML Schema (xsd) as follows: <?xml version='1.0' encoding='UTF-8'?> <annotation xmlns="http://www.xyz.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xyz.com file:system.xsd" > or <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE annotation SYSTEM "http://www.xyz.de/system.dtd"> Both ways define a URL where the DTD or XSD is found. Is there a way to give a relative or

Validate xml via dtd, different directory for dtd

好久不见. 提交于 2019-12-06 05:02:42
问题 I am trying to validate an xml file via a .dtd. I have write this validator: public bool Validation(XmlDocument xmlDoc) { var xml = XmldocToString(xmlDoc); var r = new XmlTextReader(new StringReader(xml)); var settings = new XmlReaderSettings(); var sb = new StringBuilder(); settings.ProhibitDtd = false; settings.ValidationType = ValidationType.DTD; settings.ValidationEventHandler += (a, e) => { sb.AppendLine(e.Message); _isValid = false; }; XmlReader validator = XmlReader.Create(r, settings)

XML validation with XMLDSIG using XadES-BES algorithm

Deadly 提交于 2019-12-06 04:18:33
Some information a program is using uses input files in xml format. The files have the following structure. <?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns="urn:envelope"> <MyData Id="MyDataId"> <!-- some data --> </MyData> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig-more#rsa-sha256" /> <Reference URI="#MyDataId"> <Transforms> <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> <

XSD: default integer value range

社会主义新天地 提交于 2019-12-05 19:41:55
问题 Is there an implied default value range when defining an element of a specific data type in an XSD file? For example if I define an element of type integer: <xs:element name="MyIntegerElement" type="xs:integer"/> Does this have an implied min and max value that it will validate to? I know I can explicitly define the valid ranges like so: <xs:element name="MyIntegerElement"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="1"/> <xs:maxInclusive value="16"/> </xs

Newbie: XSLT Transformation to validate rules in XML document

爱⌒轻易说出口 提交于 2019-12-05 01:49:56
问题 I'm a newbie to XSLT. I've an XML document and I need to come up with xslt to validate certain rules in the XML document. The XML and xsl file will be used in xsltproc tool and the output will be a simple Pass or Fail. Sample XML: ... <Manager mincount="4" grade="10"...> <Employee id="1" grade="9" .... /> <Employee id="2" grade="8" .... /> ..... </Manager> The number of children under Manager (Employee in this case) must be equal to or greater than the value of mincount attribute. All the

XSD - how to specify element structure depending on its attribute value?

本秂侑毒 提交于 2019-12-04 22:13:17
I have an XML which I validate by an XSD schema. inside the XML, I have the element . depending on value of stereotype attribute, I want to have different inner structure for the element; take following two variations: 1) <step stereotype="checkerStep" taskType="tableChecker"> <tableName>employee</tableName> </step> 2) <step stereotype="branchStep"> <branchName>whichStep</branchName> </step> as you can see, if stereotype is "checkerStep", as taskType attribute would be necessary, and a tableName inner element is expected. on the other hand, if stereotype is "branchStep", no attribute should be

Is it possible to enable schema validation for inbound or outbound xml only in Apache CXF 2.5.2?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 19:20:39
I have created a web service endpoint using Apache CXF 2.5.2, but I am having some issues with schema validation and MTOM interacting. If I enable MTOM and schema validation I must use the base64Binary type directly, however I am trying to conform to a fixed spec where the MTOM field also has a "contentType" attribute. <jaxws:properties> <entry key="mtom-enabled" value="true"/> <entry key="schema-validation-enabled" value="true"/> </jaxws:properties> Is it possible to only enable schema validation for inbound or outbound messages? For example something like: <entry key="schema-validation

Validate JSON against XML Schema (XSD)

做~自己de王妃 提交于 2019-12-04 18:47:08
问题 Is it possible to validate JSON with an XSD in Java? I have an application where I receive JSON response, and I would like to validate it against existing XSD. Another part of my application uses XML, which is why it would be easiest if they both could validate against the existing XSD. 回答1: No , XML Schema (XSD) is for validating XML; to validate JSON, see JSON Schema. I recommend generating schemas by hand for full understanding and full control over the constraints. However, here are some

Local XML validation with DTD or XSD using a relative path?

故事扮演 提交于 2019-12-04 11:31:47
An XML file can be defined and validated with an Document Type Description (DTD) or XML Schema (xsd) as follows: <?xml version='1.0' encoding='UTF-8'?> <annotation xmlns="http://www.xyz.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xyz.com file:system.xsd" > or <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE annotation SYSTEM "http://www.xyz.de/system.dtd"> Both ways define a URL where the DTD or XSD is found. Is there a way to give a relative or local path? So I can store them allong with the XML files instead of relying on a server? It's easy.

How to set up catalog files for xmllint?

拈花ヽ惹草 提交于 2019-12-04 11:09:44
Ok. I want to set up catalog files for xmllint to fix things so that the dcterms xml namespace is validated from a local document. I believe that I have done everything right, but it simply doesn't seem to be working. I am running OSX. I have created a directory /etc/xml $ mkdir /etc/xml $ cd /etc/xml I have downloaded dcterms.xsd to that directory $ ls -l -rw-r--r-- 1 ibis wheel 12507 24 Jul 11:42 dcterms.xsd I have created a file named "catalog" $ xmlcatalog --create > catalog I have added the dcterms namespace to the catalog file $ xmlcatalog --noout --add uri http://purl.org/dc/elements/1