dtd

Validate an Xml file against a DTD with a proxy. C# 2.0

放肆的年华 提交于 2019-12-11 06:26:53
问题 I have looked at many examples for validating an XML file against a DTD, but have not found one that allows me to use a proxy. I have a cXml file as follows (abbreviated for display) which I wish to validate: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.018/InvoiceDetail.dtd"> <cXML payloadID="123456" timestamp="2009-12-10T10:05:30-06:00"> <!-- content snipped --> </cXML> I am trying to create a simple C# program to validate the xml

In XML DTD, how can an attribute have two values?

雨燕双飞 提交于 2019-12-11 05:54:47
问题 Trying to achieve something like this ATTLIST employee role (leader|analyst|leader,analyst) where I can't change it into an element; it needs to be an attribute. It seems like DTD doesn't like commas in its expressions. 回答1: An attribute in XML cannot contain elements. You're really going against the grain to try to add structure to attributes in any way. If you must do it, keep it simple: You can represent a list via space or comma-separated values. Going any further runs into requiring a

Generating cXML classes from xsd throws error “The element 'uri:ds:Signature' is missing.”

夙愿已清 提交于 2019-12-11 05:42:27
问题 I'm trying to generate cXML classes for version cXML 1.2.034 as per http://cxml.org/ XSD (converted by visual studio). I converted the cXML.dtd to xsd. Then Tried running: xsd.exe cXML.xsd /c /language:CS /n:MyNamespace But it threw an error: Error: Error generating classes for schema 'cXML'. - The element 'uri:ds:Signature' is missing. Then I found this issue here: Generating C# classes from XSD which seems relevant. So I downloaded xmldsig-core-schema.xsd from http://www.w3.org/TR/xmldsig

Does LINQ to XML ignore includes from a DTD?

走远了吗. 提交于 2019-12-11 04:36:46
问题 I'm using the MathML DTD for parsing MathML using System.Xml.Linq. While the ordinary MathML stuff gets recognized fine, the MMLEXTRA include in the DTD gets ignored and I get errors. Here's the code I'm using: if (!string.IsNullOrWhiteSpace(mathML)) { try { const string preamble = "<!DOCTYPE mml:math PUBLIC \"-//W3C//DTD MathML 2.0//EN\"\n" + "\"http://www.w3.org/Math/DTD/mathml2/mathml2.dtd\" [\n" + "<!ENTITY % MATHML.prefixed \"INCLUDE\">\n" + "<!ENTITY % MATHML.prefix \"mml\"> \n" + "]>";

XML file with DTD displays fine in web browser after invalid change

浪尽此生 提交于 2019-12-11 02:59:46
问题 I am new to XML and DTD. I have written an XML file with DTD. Here is it. <?xml version="1.0"?> <!DOCTYPE note[ <!ELEMENT note (page , author ,company)> <!ELEMENT page (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT company (#PCDATA)> <!ATTLIST note type CDATA #IMPLIED> ]> <note typ="single"> <page>1000</page> <author>devan</author> <author>devan</author> <company>IDM</company> </note> It works fine. But my problem is, if you set the note attribute as typ it displays the result in the web

How to generate XSD using XSLT manually

馋奶兔 提交于 2019-12-11 02:54:52
问题 I am struggling with this question. Could I, using XSLT, generate an XSD based on an XML file input ? I know there are many software that I can use to do that automatically, but I need it by writing code. Could you help me with how to start in this and support me with useful resources? This is a sample XML file: I need to generate XSD using XSLT and validate it: <test> <a> <b> </b> </a> <d> </d> </test> 回答1: As Marcus observed in the comments, there are many degrees of freedom, but here's a

How to validate metadata.xml against .dtd in gentoo?

喜你入骨 提交于 2019-12-11 01:33:21
问题 I am trying to validate metadata.xml against www.gentoo.org/dtd/metadata.dtd with xmllint from =dev-libs/libxml2-2.9.3 ebuild. I tried the commands (some from here): $ xmllint --noout --valid metadata.xml error : Unknown IO error metadata.xml:2: warning: failed to load external entity "http://www.gentoo.org/dtd/metadata.dtd" the same for xmllint metadata.xml --dtdvalid metadata.dtd and xmllint --loaddtd http://www.gentoo.org/dtd/metadata.dtd $ xmllint --valid metadata.xml --schema metadata

XML validation against DTD

跟風遠走 提交于 2019-12-11 00:34:08
问题 I have this XML along with an embedded DTD: <?xml version="1.0" ?> <!DOCTYPE customers [ <!ELEMENT customers (name,age,roll,sex)> <!ELEMENT name (#CDATA)> <!ELEMENT age (#CDATA)> <!ELEMENT roll (#CDATA)> <!ELEMENT sex (#CDATA)> ]> <customers> <name>XYZ</name> <age>19</age> <roll>23</roll> <sex>M</sex> </customers> When i try to validate the XML, its showing me an error. But if i change the #CDATA to #PCDATA then the validation is successful. Question 1) I don't have a proper explanation why

DTD. Element Type Declaration. Different between 'contentspec' and 'content model'

痞子三分冷 提交于 2019-12-10 23:03:42
问题 I read Extensible Markup Language (XML) 1.0 (Fifth Edition) W3C Recommendation 26 November 2008 3.2 Element Type Declarations has: An element type declaration takes the form: Element Type Declaration elementdecl ::= <!ELEMENT Name contentspec > contentspec ::= 'EMPTY' | 'ANY' | Mixed | children And in 3.2.1 Element Content has: Element-content Models children ::= (choice | seq) ('?' | '*' | '+')? cp ::= (Name | choice | seq) ('?' | '*' | '+')? choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')' seq

Can an XML document follow both a DTD and an XML Schema?

爱⌒轻易说出口 提交于 2019-12-10 19:57:13
问题 Is it legal for an XML document to specify that it follows both a DTD and a Schema? Won't the two conflict with one another? 回答1: Technically I think you would have problems with the DTD not recognizing the attributes for referencing the schema (the namespace declaration and the schema location). However I think it depends on how you're validating your XML and whether or not you can ignore the DTD for validation if a schema is specified. Also, for your assignment are you sure you have to