Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-249

Validation of an xml file (whose root node is unknown) says file is invalid eventhough file is valid

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: Version 2
    • Fix Version/s: Version 2
    • Component/s: Validator
    • Labels:
      None
    • Environment:
      Windows XP

      Description

      I am trying to validate an xml file whose root node is unknown. So I am using the following code to parse and validate but validation fails.

      XMLObject xmlObject = XmlObject.Factory.parse(new FileReader(file));
      boolean isValid = xmlObject.validate(); //isValid becomes false eventhough file is valid

      When I looked at closely, I notice xmlObject is not pointing to the root document object (In my case ReturnDataDocument since ReturnData is the root node of xml) but pointing to XmlAnyTypeImpl.

      When I use the specific object , it works.
      ReturnDataDocument xmlObject = ReturnDataDocument .Factory.parse(new FileReader(file));
      boolean isValid = xmlObject.validate(); //isValid is true

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rafiq400 rafiq ahmad
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: