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

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • Version 2
    • Version 2
    • Validator
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: