dtd

Using DTD can I specify an exact number of element occurrences?

Deadly 提交于 2020-04-30 09:24:29
问题 I am trying to do this exercise in XML and I am stuck at this particular point. I am being asked to create a DTD that will satisfy a list of requirements and I cannot find a way to achieve the following: The seasonal_prices' list can have none, one, two or three occurrences of the 'season_price' element Is there a way to achieve this using only a DTD? 回答1: Is there a way to achieve this using only a DTD? Nope. You can only do: season_price (exactly one) season_price? (zero or one) season

W3C breaks XHTML 1.1 parsing by removing modules from web site

戏子无情 提交于 2020-04-17 22:12:52
问题 The W3C recommended list of doctype declarations indicates the following doctype for XHTML 1.1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> This is the same system ID recommended by A List Apart, the Wiley Dummies site, among many others. It was one of the standard system ID for the modular XHTML 1.1 DTD. Unfortunately this modular DTD refers to other XML entities, some of which the W3C has removed from its site, completely breaking

W3C breaks XHTML 1.1 parsing by removing modules from web site

坚强是说给别人听的谎言 提交于 2020-04-17 22:12:15
问题 The W3C recommended list of doctype declarations indicates the following doctype for XHTML 1.1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> This is the same system ID recommended by A List Apart, the Wiley Dummies site, among many others. It was one of the standard system ID for the modular XHTML 1.1 DTD. Unfortunately this modular DTD refers to other XML entities, some of which the W3C has removed from its site, completely breaking

How to force removal of attributes with implied default values from DTD in Java XML DOM

瘦欲@ 提交于 2020-03-25 18:24:58
问题 As I reported elsewhere on Stack Overflow, I'm parsing a legacy modular XHTML 1.1 document and the DTD is adding all sorts of default attributes such as version="-//W3C//DTD XHTML 1.1//EN" . Some of these are even inappropriate, such as xml:space="preserve" . I'm writing a utility to clean up the DOM after parsing, but I forgot that the DOM will automatically add back default attributes from the DTD if I remove them. So if I call Element.removeAttributeNS(null, "version") on the document

How to force removal of attributes with implied default values from DTD in Java XML DOM

佐手、 提交于 2020-03-25 18:24:13
问题 As I reported elsewhere on Stack Overflow, I'm parsing a legacy modular XHTML 1.1 document and the DTD is adding all sorts of default attributes such as version="-//W3C//DTD XHTML 1.1//EN" . Some of these are even inappropriate, such as xml:space="preserve" . I'm writing a utility to clean up the DOM after parsing, but I forgot that the DOM will automatically add back default attributes from the DTD if I remove them. So if I call Element.removeAttributeNS(null, "version") on the document

Java XML parser adding unnecessary xmlns and xml:space attributes

给你一囗甜甜゛ 提交于 2020-03-19 06:17:11
问题 This bounty has ended . Answers to this question are eligible for a +50 reputation bounty. Bounty grace period ends in 17 hours . Garret Wilson wants to draw more attention to this question: Surely there must be something going wrong here, especially with the inappropriate xml:space . But what? I'm using Java 11 (AdoptOpenJDK 11.0.5 2019-10-15) on Windows 10. I'm parsing some legacy XHTML 1.1 files, which take the following general form: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html

XML实验---设计一个唱片(利用DTD)

江枫思渺然 提交于 2020-02-28 20:03:05
xml 实验报告 一 . 书上题目 Ø 345题: 代码: <?xml version="1.0" encoding="UTF-8"?> <项目组 xmlns="http://schemas.microsoft.com/" xmlns:duty="http://schemas.microsoft.com/ado/"> <项目组角色> <职位> <duty:名称>项目经理</duty:名称> <工作年限>五年以上</工作年限> <技能要求>精通J2EE,掌握管理技能</技能要求> <职责>控制项目进度、品质、任务分配</职责> </职位> <![CDATA[ <职位> <duty:名称>架构设计师</duty:名称> <工作年限>五年以上</工作年限> <技能要求>精通J2EE架构设计、有项目开发经验</技能要求> <职责>设计项目架构,并在项目组中实施</职责> </职位> ]]> <职位> <duty:名称>需求分析师</duty:名称> <工作年限>3年以上</工作年限> <技能要求>熟悉财务系统,有开发经验</技能要求> <职责>收集客户需求,编写需求规格书</职责> </职位> <职位> <duty:名称>高级程序员</duty:名称> <工作年限>3年以上</工作年限> <技能要求>精通structs+Hibernate+MS SQL</技能要求> <职责>编写详细设计书

XML的DTD和Schema约束

前提是你 提交于 2020-02-28 19:59:49
为什么要使用约束? XML是自定义的标签,有时候标签太多,记不住,所以就需要有约束来告诉我能写哪些标签,哪些标签写错了不能识别 XML中有哪几种约束? 有很多约束,其中DTD和Schema约束最为常见。 约束本质上是什么? 约束本质上也是一种xml文件。 DTD约束和Schema约束的区别 特点的区别: DTD约束较为古老,简单,一些老框架使用DTD作为约束:Struts2和Hibernate都使用DTD作为其XML配置文件的约束 Schema约束功能更为强大,用的更为广泛,Tomcat和Spring都使用Schema作为其xml配置文件的约束。 文件的区别: DTD约束是已.dtd为后缀命名 Schema约束已.xsd为后缀命名 语法上的区别: DTD约束的基本语法: 定义元素:<!ELEMENT 元素名称 使用规则> 定义属性:<!ATTLIST 元素名称 属性名称 属性值类型 设置说明> Schema约束的基本语法: 书写规范跟一个XML文件一样是包含关系 根节点是:<xs:schema xmlns:xs="名称空间"> 后面的属性节点和元素节点以及文本节点根据使用的需要进行嵌套,也就是说实际使用的时候怎么嵌套在写Schema文件的时候就怎么嵌套 元素节点:<xs:element name="名称"></xs:element> 属性节点:<xs:attribute name=

XmlReader throws multiple DTDs error

无人久伴 提交于 2020-02-06 03:22:43
问题 Let's say we want to load an xml (cXML) and validate it against a DTD that we have stored locally. Here's the code for this: XmlPreloadedResolver resolver = new XmlPreloadedResolver(XmlKnownDtds.None); resolver.Add(new Uri(DocTypeSystemId), File.ReadAllText(@"C:\cXml.dtd")); XmlReaderSettings settings = new XmlReaderSettings { ValidationType = ValidationType.DTD, DtdProcessing = DtdProcessing.Parse }; settings.ValidationEventHandler += Settings_ValidationEventHandler; XmlParserContext context

Is there a way to scope ID and IDREF to specific attributes?

北慕城南 提交于 2020-02-05 02:50:21
问题 I'm trying to specify a DTD for an XML file. But in it, I have two IDs used for different things. I'd like to keep these IDs separate so that one tag's attribute that uses a IDREF must match the ID for a particular tag's attribute and another tag that uses a attribute IDREF must match the ID for another particular tag's attribute Is this possible? 回答1: No, ID/IDREF/IDREFS have document scope. If you can use XSD instead of DTD, you can get more control over id scoping via xsd:key and xsd