On Oct 4, 2006, at 8:43 AM, Sachin Patel wrote: I must be overlooking something but I'm having trouble using XMLBeans to get to the EnvironmentType for a given deployment plan. EnvironmentType environmentType = gerConnector.getEnvironment(); Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment); However you may find it easier to do something more generic like QNameSet ENV_QNAMESET = EnvironementDocument.type.getDocumentElementQName(); .... XmlObject untypedEnv = plan.selectChildren(ENV_QNAMESET); EnvironmentType env = (EnvironmentType)untypedEnv.changeType(EnvironmentType.type); Sometimes it's hard to convince xmlbeans to change the type correctly, you get null out of changeType. In that case I use env = (EnvironemntType)untypedEnv.copy().changeTYpe(EnvironmentTYpe.type); but then changes you make to env won't be reflected in the original XmlObject or written back into the xml if you save. It's possible to get around this.... but if changeType works without copying do that. thanks david jencks
|
