[xml] Default Values for Attributes



Using the Tree API is there a way to get at the default value listed in the XML Schema for an optional attribute that was not included in the xml document? Reading through the libxml2 website it seems this can be done with the xmlreader API (and even then maybe only for DTDs, it is unclear)

example: schema
<xs:element name = "root_element">
   <xs:attribute  name = "prop1" use="optional" default="5">
</xs:element>
=====================
Xml document
<root_element>

xmlNode* node = magic_code_to_get_that_root_node();

xmlChar *myAttribute = xmlGetProp(node, "prop1") <= this wont work, is it possible some other way?

Thank you,

--
David Grohmann
Senior Student Associate
ARL:ESL - S206





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]