*/
private XMLList matchChildren(XmlCursor.TokenType tokenType, XMLName name)
{
XMLList result = new XMLList(lib);
XmlCursor curs = newCursor();
TokenType tt = curs.currentTokenType();
javax.xml.namespace.QName qname = new javax.xml.namespace.QName(name.uri(), name.localName());
javax.xml.namespace.QName targetProperty = qname;
if (tt.isStartdoc())
{
tt = curs.toFirstContentToken();
}
if (tt.isContainer())
{
tt = curs.toFirstContentToken();
while (!tt.isEnd())
{
if (tt == tokenType)
{
// Only try to match names for elements or processing instructions.
if (!tt.isStart() && !tt.isProcinst())
{
// Not an element or no name specified.
result.addToList(findAnnotation(curs));
// Reset target property to null in this case
targetProperty = null;
}
else
{
// Match names as well
if (qnameMatches(name, curs.getName()))
{
// Add it to the list
result.addToList(findAnnotation(curs));
// Set target property if target name is "*",
// Otherwise if target property does not match current, then
// set to null
if (targetProperty != null)
{
if (targetProperty.getLocalPart().equals("*"))
{
targetProperty = curs.getName();
}
else if (!targetProperty.getLocalPart().equals(curs.getName().getLocalPart()))
{
// Not a match, unset target property
targetProperty = null;
}
}
}
}
}
// Skip over child elements
if (tt.isStart())
{
tt = curs.toEndToken();
}
tt = curs.toNextToken();