Structured documents written in a document structure definition language
may be inconsistent with a predetermined document structure definition
when they are encrypted partly or electronically signed. The document
structure inspection method according to the present invention applies a
document structure alteration rule to a document structure definition
expressing the structure of such structured documents and effects
conversion to generate a second document structure definition. The second
document structure definition is then checked to determine whether it is
consistent with a corresponding, predetermined document structure
definition. The document structure alteration rule includes, for
instance, a replacement rule for replacing an element contained in a
document structure definition by another element, and an addition rule
for adding an element to a location after the target document structure
definition element.