I used XmlCursor.dump() to examine the XmlObject representing my instance
document.
XmlCursor cursor = xml.newCursor();
cursor.dump();
displays:
ROOT (USER) *:R:<cur>[0] <mark>[0] (DocumentXobj)
ELEM config-servercon...@http://lett.com/ns/netconf/server/config/1.0
(USER) <line:1>[0] (ElementXobj)
ATTR xm...@http://www.w3.org/2000/xmlns/ Value(
"http://lett.com/ns/netconf/server/co..." ) (AttrXobj)
ATTR xmlns:x...@http://www.w3.org/2000/xmlns/ Value(
"http://www.w3.org/2001/XMLSchema-ins..." ) (AttrXobj)
ATTR xsi:schemalocat...@http://www.w3.org/2001/XMLSchema-instance Value(
"http://lett.com/ns/netconf/server/co..." ) (AttrXobj)
ELEM daemoncon...@http://lett.com/ns/netconf/server/config/1.0
<line:2>[0] (ElementXobj)
...
So it seems that the XmlObject is a document type (DocumentXobj) , so why is
it's Java type not a document type?
- Andy
On Wed, 04 Mar 2009 18:29:36 -0600 Andy Putnins wrote:
> When I parse an instance doc with the SchemaTypeSystem.parse() method,
> I end up with an object of class
> "org.apache.xmlbeans.impl.values.XmlComplexContentImpl"
>
> instead of the expected "ConfigServerConfigDocument". The STS is the union
> of the built-in (and scomp-compiled, I assume) types and the subject schema.
>
> It looks to me like it's not recognizing the root element, even though
> the instance object succesfully passes validation - what am I doing wrong?
>
> - Andy
>
> XmlObject schemaObject = schemaDocAsXmlObject.selectChildren(new
> QName("http://www.w3.org/2001/XMLSchema", "schema"))[0];
> SchemaTypeSystem sts = XmlBeans.compileXsd(new XmlObject[] { schemaObject },
> XmlBeans.getBuiltinTypeSystem(), compileOptions);
> XmlObject xml = configSchema.sts.parse((String)doc,
> configSchema.docSchemaType, options);
>
> Schema has:
> <xml-fragment targetNamespace="http://lett.com/ns/netconf/server/config/1.0"
> ... >
> <xs:element name="config-serverConfig"
> type="ncsc:configServerConfigType"/>
> ...
> </xml-fragment>
>
> instance doc has:
> <config-serverConfig xmlns="http://lett.com/ns/netconf/server/config/1.0">
> <daemonConfig/>
> ...
> </config-serverConfig>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]