You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-user@xml.apache.org by "Murphy, Eric" <er...@pfc.cfs.nrcan.gc.ca> on 2003/11/29 01:01:02 UTC
Discover errors for missing attributes and elements
I am trying to get the name of attributes and elements that are missing when
validating an xml tree. If an attribute has a bad value this is easily done
from the XmlError object:
// the cursor is positioned where the error occured and the attribute name
is returned
cursor = error.getCursorLocation();
attributeName = cursor.getName();
If the attribute is required but simply not there it is easy to get the name
embedded in an error message:
error.getMessage() prints out - Expected attribute: file_name
I would rather not count on parsing the error message to get the name of the
missing attribute value - file_name. If the fromat fo the error message
changes the code will break. Any suggestions?
Eric Murphy
Software Developer (NFIS)
erimurph@pfc.forestry.ca
tel/tél: 250-363-6038
fax / télécopieur 250-363-6004
Natural Resources Canada
Pacific Forestry Centre
506 West Burnside Road
Victoria BC V8Z 1M5
Ressources naturelles Canada
Centre de foresterie du Pacifique
506 rue Burnside ouest
Victoria, Colombie-Britanique V8Z 1M5
- ---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/