[
https://issues.apache.org/jira/browse/XMLBEANS-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557358#action_12557358
]
Jacob Danner commented on XMLBEANS-359:
---------------------------------------
Okay, took a peek a little bit further.
The reason you are seeing this issue is because CTSst is a type and not a the
Element you want to refer to.
The class you should be using is
org.openxmlformats.schemas.spreadsheetml.x2006.main.SstDocument;
rather than
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSst;
You'll want to change your unit test to:
public void testXMLBeansUnmarshalling_Document() throws Exception {
SstDocument sst = SstDocument.Factory.parse(xmlBeansTestFile);
ArrayList err = new ArrayList();
XmlOptions xo = new XmlOptions().setErrorListener(err);
if (!sst.validate(xo)) {
System.out.println("Failed validation");
for (int i = 0; i < err.size(); i++) {
System.out.println("[" + i + "]-" + err.get(i));
}
} else {
System.out.println("Passed Validation");
}
assertNotNull(sst);
assertEquals(11, sst.getSst().getCount());
}
Another way to verify is to build your xml instance using the getters and
setters. The difference will appear when you do a xmlText() or println on the
content.
> While parsing an XML the domain model generated by XMLBeans claims to be
> empty even if the toString print out the loaded XML
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: XMLBEANS-359
> URL: https://issues.apache.org/jira/browse/XMLBEANS-359
> Project: XMLBeans
> Issue Type: Bug
> Affects Versions: Version 2.3
> Environment: MacOSX / jdk1.5
> Reporter: Gian Carlo Pace
> Priority: Minor
> Fix For: Version 2.3
>
> Attachments: bugTestCase.tar.gz, ValidationXSD.tgz
>
>
> Using XMLBeans I have created a domain of classes from the XSD (provided with
> the testcase) obtaining a JAR file.
> Than I tried to parse the XML expecting to have a a domain model loaded in
> memory with the XML values but as you can see looking at the test I wrote I
> expect to obtain a count attribute with value 11 but I always has a 0
> reposnse.
> This is the oupute of my test
> There was 1 failure:
> 1)
> testXMLBeansUnmarshalling(TestXMLBeansStuffs)junit.framework.AssertionFailedError:
> expected:<11> but was:<0>
> at
> TestXMLBeansStuffs.testXMLBeansUnmarshalling(TestXMLBeansStuffs.java:21)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> FAILURES!!!
> Tests run: 1, Failures: 1, Errors: 0
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]