[xml] Retrieving default values from DTD
- From: "D.J. van der Laan" <d j vanderlaan student tnw tudelft nl>
- To: xml gnome org
- Subject: [xml] Retrieving default values from DTD
- Date: Sat, 17 May 2003 13:04:08 +0200
I have a question about retrieving default values for attributes from a
DTD. I expected that the function xmlGetprop would give me the default
value if one was specified in the DTD (the tutorial and the documentation
mention this), but for some reason this does not work. (For the code I
used, look below.)
So here is my question. How do I retrieve default values for attributes
from a DTD, if no value is specified in the XML file? Do I have to take
some actions to enable the use of a DTD?
Dingeman
------------------------------------------
Suppose my DTD (mydtd.dtd) looks like this
<!ELEMENT root (something)*>
<!ELEMENT something (EMPTY)*>
<!ATTLIST something name CDATA #REQUIRED>
<!ATTLIST something property ("0"|"1") "0">
and my XML file looks like:
<?xml version="1.0"?>
<!DOCTYPE root SYSTEM "mydtd.dtd">
<root>
<something name="naam" />
</root>
I expected that the next line (cur is pointing to <element ...) would give
the value "0", but it did not give a value at all (NULL).
property = xmlGetProp(cur, "property");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]