You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Jacob Danner (JIRA)" <xm...@xml.apache.org> on 2004/11/19 01:02:30 UTC

[jira] Resolved: (XMLBEANS-48) Bug with Root.fetch ( Splay parent, QName name, QNameSet set, int n )

     [ http://nagoya.apache.org/jira/browse/XMLBEANS-48?page=history ]
     
Jacob Danner resolved XMLBEANS-48:
----------------------------------

     Assign To:     (was: Eric Vasilik)
    Resolution: Invalid

This might be an issue with the XML you are trying to pass in. The method you are calling is returning correctly. The XML in your repro has an extra ResourceState element. This seems to be causing your problem. Remove it and the state value will not be null. Try the following code sample to see what I mean


String re = "<sch:ResourceState xmlns:sch=\"http://docs.oasis-open.org/wsdm/2004/04/muws-0.5/schema\">" +
                //"<sch:ResourceState>" +
                "<sch:State>http://docs.oasis-open.org/wsdm/2004/04/muws/state/available</sch:State>" +
                "<sch:TimeEntered>2004-08-11T15:50:23.064-04:00</sch:TimeEntered>" +
                //"</sch:ResourceState>" +
                "</sch:ResourceState>";
        ResourceStateDocument resState = (ResourceStateDocument) XmlObject.Factory.parse(re);
        StateInformation resourceState = resState.getResourceState();
        String state = resourceState.getState();
        System.out.println("State: " + state);

        ResourceStateDocument resState2 = ResourceStateDocument.Factory.newInstance();
        StateInformation stateInfo = StateInformation.Factory.newInstance();
        stateInfo.setState("http://docs.oasis-open.org/wsdm/2004/04/muws/state/available");
        stateInfo.setTimeEntered(Calendar.getInstance());
        resState2.setResourceState(stateInfo);
        System.out.println("ResState XML = \n"+resState2.xmlText(xmOpts.setSavePrettyPrint()));

> Bug with Root.fetch ( Splay parent, QName name, QNameSet set, int n )
> ---------------------------------------------------------------------
>
>          Key: XMLBEANS-48
>          URL: http://nagoya.apache.org/jira/browse/XMLBEANS-48
>      Project: XMLBeans
>         Type: Bug
>     Reporter: Sal Campana
>  Attachments: MUWS.wsdl, MUWS.xsd, SplayTest.java, xmltypes-muws.jar
>
> I've attached a simple example of an issue I am seeing.  This is in the v1 codebase...Have not check v2 (assuming the same)
>  
> Basically I cannot get the value of a child element via the generated getter:
>  
>  
>         StateInformation resourceState = resState.getResourceState();
>         //should return a string...
>         String state = resourceState.getState();
>         System.out.println("State: " + state);//null!
>  
> What I see in the debugger is:
>  
> Root.fetch ( ...)
> ...
>  (line 3314)case BEGIN :
>                if (nameHit( name, set, s.getName() ))
>                {
>                        _child = s;
>                        _n = 0;
>                        break loop;
>                 }
>                 //This is the issue in this context...In this case it should continue in the loop, not set to "finish"
>                 s = s.getFinishSplay();
>                  break;
> ...
>  
> So when we get the BEGIN case, the s.getName() is ResourceState and "name" is "State".  The name I am looking for is State (child of ResourceState).  Since the names do not match the call to "s = s.getFinishSplay()" sets the Splay to the end of the element.  Then the loop moves on past that element....Maybe it thinks it's the child element and not the root??
>  
> Had "s = s.getFinishSplay()" not been called, then the next time through the loop (Splay s = parent.nextSplay()) would get the Splay named "State" and the names would match and everything would be happy.....
>  
> The example code and generated types can be used to produce the problem....

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org