public static XMLStreamReader newXmlStreamReader(Cur c,
XmlOptions options) {
options = XmlOptions.maskNull( options );
boolean inner =
options.hasOption( XmlOptions.SAVE_INNER ) &&
!options.hasOption( XmlOptions.SAVE_OUTER );
XMLStreamReaderBase xs;
int k = c.kind();
if (k == Cur.TEXT || k < 0)
{
xs = new XMLStreamReaderForString( c, c.getChars( -1 ), c._offSrc, c._cchSrc );
}
else if (inner)
{
if (!c.hasAttrs() && !c.hasChildren())
xs = new XMLStreamReaderForString( c, c.getFirstChars(), c._offSrc, c._cchSrc );
else
{
assert c.isContainer();
xs = new XMLStreamReaderForNode( c, true );
}
}
else
xs = new XMLStreamReaderForNode( c, false );
if (c._locale.noSync())
return new UnsyncedJsr173( c._locale, xs );
else
return new SyncedJsr173( c._locale, xs );
}
|