dtd

How to declare doctype ,xml version and encoding in XML file using DOM parser in java?

时间秒杀一切 提交于 2019-12-12 02:26:23
问题 For sorry, I don't know how to attempt to do such thing. public void writeXML(String tableName) { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); // root elements Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement(tableName); doc.appendChild(rootElement); for(Map m: rows){ Element parent = doc.createElement((String) m.get("ownerNode")); rootElement.appendChild(parent);

Preserving single or double quotes around attributes in browser

╄→尐↘猪︶ㄣ 提交于 2019-12-11 22:28:11
问题 I want to preserve single or double quotes around html attributes, specifically for innerHTML within the content editable div. I know this is weird requirement, but I am looking for possibilities. So lets say I put html in content editable div from server : <div class="editable"> PRESS MENU BUTTON<img src='BUTTON_BACK.png' vspace='-16' width='32' height="32"> </div> This should be preserved. But currently in firefox, as I inspect the DOM it just converts all single quotes to double quotes

Xhtml Invalid Characters?

六月ゝ 毕业季﹏ 提交于 2019-12-11 13:39:01
问题 I have made custom xhtml valdidator in .NET(validating through dtd + some extra rules) and I have noticed a discrepancy between my validation and w3c validation. In my validator I get the following error when there is colon in the id (let's say : id="mustang:horse") (Error) The 'id' attribute has an invalid value according to its data type. But I do not get any errors on w3c for this pattern. I tried to find a list of invalid characters for an attribute in xml/xhtml but couldn't find it?

Validate xml with dtd

冷暖自知 提交于 2019-12-11 13:18:16
问题 I just want to see if xml is valid with dtd and to print error message if it is not. I wrote this validator. The problem it that it prints always that document is valid, even it is not valid. Thanks for help. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; using System.Xml.Schema; namespace XMLValidator { class Program { static void Main() { var messages = new StringBuilder(); var settings = new

IE cannot find the W3C XHTML DTD (Error 2146697204)

北战南征 提交于 2019-12-11 12:28:50
问题 I have a template that starts every page like this: <?xml version="1.0" encoding="utf-8"?> <!-- blah blah--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <html xmlns="http://www.w3.org/1999/xhtml"> ... </html> that produces the error: The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. The server did not understand

Parsing dtd file with lxml library (python)

帅比萌擦擦* 提交于 2019-12-11 12:17:12
问题 I need your help. I use lxml library to parsing dtd file. How can i get c subexpression in this example? dtd = etree.DTD(StringIO('<!ELEMENT a (b,c,d)>')) I try this content = dtd.elements()[0].content left, right = content.left, content.right but it left of right subexpression. http://lxml.de/validation.html#id1 回答1: I'm completely guessing (I've never touched this before) but: from io import StringIO from lxml import etree dtd.elements()[0].content.right.left #>>> <lxml.etree.

XML DTD Specify a cdata/text pattern for attribute

纵饮孤独 提交于 2019-12-11 09:35:01
问题 Is there a way, in a DTD, to specify a "pattern" for a given attribute. Example: I want to have an attribute called " position " which is a string of the form "X,Y" . I would like to have something in my DTD similar to: <!ATTLIST MyElement myattribute "*,*" > (I know, for this example two attributes X and Y would certainly be better, but that's just to highlight what I want to do) Thanks 回答1: You can't specify a pattern using DTD. You could do it using a schema though: <xs:element name=

how to add DTD element if I dont know the child elements

可紊 提交于 2019-12-11 07:28:47
问题 I need to validate xml files against a DTD. Sometimes the child elements can be more and I dont know what child elements will come up next time, I tried the following: <!ELEMENT Story (StoryPara+ , ANY+)+> but this didn't work, how to validate for any child elements using DTD? 回答1: You can't mix "ANY" with anything else in your content model. (You would use it just like you would use "EMPTY".) What your current element declaration is saying is: at least one occurrence of: one or more

Groovy XMLSlurper issue

浪子不回头ぞ 提交于 2019-12-11 07:00:06
问题 I want to parse with XmlSlurper a HTML document which I read using HTTPBuilder. Initialy I tried to do it this way: def response = http.get(path: "index.php", contentType: TEXT) def slurper = new XmlSlurper() def xml = slurper.parse(response) But it produces an exception: java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd I found a workaround to provide cached DTD files. I found a simple implementation of class which

Is there some equivalent in Java to Ruby's Nokogiri::XML::EntityDecl?

微笑、不失礼 提交于 2019-12-11 06:37:14
问题 I have an issue where I need to prepend a DTD containing ENTITYs bracketed in the definition to an existing XML document. For example, working from the specification for MathML in DAISY at http://www.daisy.org/projects/mathml/mathml-in-daisy-spec.html, say I am given this XML by an outside source: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE dtbook PUBLIC "-//NISO//DTD dtbook 2005-2//EN" "http://www.daisy.org/z3986/2005/dtbook-2005-2.dtd"> <dtbook xmlns="http://www.daisy.org/z3986/2005