dtd

Element that can only have one of two text values?

泄露秘密 提交于 2019-11-27 09:42:09
I'm constructing a DTD which has a fuel_system element. I want to restrict the text between <fuel_system> tag. It must be only carbureted or fuel-injected . How can I do this? I don't mention something like this = > attribute type (carbureted, fuel-injected), because I want to force this rule in <fuel_system> tags, not the attribute of fuel_system . when defining an element in a DTD, there is no way to restrict the text inside the element. you can only tell what other element (child elements) it might contain and their order, or you can tell that the element contains text, or a mixture of the

how to disable dtd at runtime in java's xpath?

旧巷老猫 提交于 2019-11-27 08:54:55
I got dtd in file and I cant remove it. When i try to parse it in Java I get "Caused by: java.net.SocketException: Network is unreachable: connect", because its remote dtd. can I disable somehow dtd checking? toolkit You should be able to specify your own EntityResolver, or use specific features of your parser? See here for some approaches. A more complete example: <?xml version="1.0"?> <!DOCTYPE foo PUBLIC "//FOO//" "foo.dtd"> <foo> <bar>Value</bar> </foo> And xpath usage: import java.io.File; import java.io.IOException; import java.io.StringReader; import javax.xml.parsers.DocumentBuilder;

How do I define HTML entity references inside a valid XML document?

流过昼夜 提交于 2019-11-27 04:38:16
I need to be able to reference named HTML entities like • instead of the Unicode alternative • in an XML document. I have control over some parts of the XML document, such as defining the DOCTYPE , but doing a find-and-replace in the actual XML is not an option. I can get some elements like   and & by including the XHTML transitional DOCTYPE, but I need to define more manually. How do I do this? -- EDIT -- Thanks to Jim's answer, here's what I ended up with. This is great because I can utilize the XHTML transitional entities, and also add my own: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0

Trying to use <!ENTITY in ANDROID resources with error: “The entity was referenced, but not declared.”

依然范特西╮ 提交于 2019-11-27 02:35:30
问题 I'm following this solution to use enetities in my string resource file: Is it possible to do string substitution in Android resource XML files directly? I'm using an external file in the resource tree: /res/raw/entities.dtd , its content: <!ENTITY ent_devicename "MyDeviceName"> In the string.xml resource file: <!DOCTYPE resources [ <!ENTITY % ent_devicename SYSTEM "../raw/entities.dtd"> %ent_devicename; ]> <resources> <string name="name">The name is &ent_devicename;</string> </resources> but

Free DTD to XSD conversion utility? [closed]

∥☆過路亽.° 提交于 2019-11-27 00:54:48
I have a DTD that I need to convert to an XSD (XML schema) file. Is there a free utility or simple way to accomplish this? The W3C offers one . There are also online converters . If you happen to have Visual Studio, open the DTD file an you should have a button to "Create Schema" out of it. I haven't checked if it was available on Express edition, though. Try xmlpad from http://www.wmhelp.com to convert DTD to XSD. Really nice tool. http://www.thaiopensource.com/relaxng/trang.html Trang converts between different schema languages for XML. It supports the following languages: RELAX NG (XML

Difference between PCDATA and CDATA in DTD

空扰寡人 提交于 2019-11-26 23:54:11
问题 What is the difference between #PCDATA and #CDATA in DTD ? 回答1: PCDATA - Parsed Character Data XML parsers normally parse all the text in an XML document. CDATA - (Unparsed) Character Data The term CDATA is used about text data that should not be parsed by the XML parser. Characters like "<" and "&" are illegal in XML elements. 回答2: PCDATA is text that will be parsed by a parser. Tags inside the text will be treated as markup and entities will be expanded. CDATA is text that will not be

XML, DTD: how to make the order not important

谁说胖子不能爱 提交于 2019-11-26 23:13:59
问题 I started off using an XML file and a parser as a convenient way to store my data I want to use DTD to check the structure of the xml files when they arrive. Here is my DTD file < ?xml version="1.0" encoding="UTF-8"?> < !ELEMENT document (level*)> < !ELEMENT level (file,filelName?,fileNumber?)> < !ELEMENT file (#PCDATA)> < !ELEMENT filelName (#PCDATA)> < !ELEMENT fileNumber (#PCDATA)> (note that fileName and fileNumber are actually purely optional) and <document> <level> <file>group1file01<

Validate an XML file against local DTD file with Java

蹲街弑〆低调 提交于 2019-11-26 22:08:50
How can I validate an XML file against a DTD that is stored locally as a file? The XML file does not have any DOCTYPE declaration (or may have one that should then be overridden). I had a look at this thread but besides the fact they are using .NET I doubt that this is a good solution. Any input appreciated! In an ideal world, you'd be able to validate using a Validator . Something like this: SchemaFactory schemaFactory = SchemaFactory .newInstance(XMLConstants.XML_DTD_NS_URI); Schema schema = schemaFactory.newSchema(new File( "xmlValidate.dtd")); Validator validator = schema.newValidator();

No grammar constraints (DTD or XML schema) detected for the document

倖福魔咒の 提交于 2019-11-26 19:30:01
I have this dtd : http://fast-code.sourceforge.net/template.dtd But when I include in an xml I get the warning : No grammar constraints (DTD or XML schema) detected for the document. The xml is : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE templates PUBLIC "//UNKNOWN/" "http://fast-code.sourceforge.net/template.dtd"> <templates> <template type="INSTANCE_OF_CLASS"> <description>Used to Create instance of class</description> <variation>asasa</variation> <variation-field>asasa</variation-field> <class-pattern>asasa</class-pattern> <getter-setter>setter</getter-setter> <allowed-file

External referenced DTD in XML

江枫思渺然 提交于 2019-11-26 19:05:54
test.xml: <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE email SYSTEM "test.dtd"> <email> <von>test@test.com</von> <zu>xxx@example.com</zu> <titel>Hello</titel> <text>Dear John....;-).</text> <prior type="schnell"/> </email> test.dtd: <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE email [ <!ELEMENT email (von,zu,titel,text,prior)> <!ELEMENT von (#PCDATA)> <!ELEMENT zu (#PCDATA)> <!ELEMENT titel (#PCDATA)> <!ELEMENT text (#PCDATA)> <!ATTLIST prior type CDATA #REQUIRED > ]> Error Code in test.dtd The markup declarations contained or pointed to by the document type declaration must be well