- was deprecated by XMLStreamReader from STaX - jsr173 API.
Method from org.apache.xmlbeans.impl.validator.ValidatingXMLInputStream Detail: |
public Location getLocation() {
try
{
final org.apache.xmlbeans.xml.stream.Location xeLoc = _source.peek().getLocation();
if (xeLoc==null)
return null;
javax.xml.stream.Location loc = new javax.xml.stream.Location()
{
public int getLineNumber()
{ return xeLoc.getLineNumber(); }
public int getColumnNumber()
{ return xeLoc.getColumnNumber(); }
public int getCharacterOffset()
{ return -1;}
public String getPublicId()
{ return xeLoc.getPublicId(); }
public String getSystemId()
{ return xeLoc.getSystemId(); }
};
return loc;
}
catch (XMLStreamException e)
{
return null;
}
} Deprecated! |
public XmlCursor getLocationAsCursor() {
return null;
} Deprecated! |
public QName getName() {
return XMLNameHelper.getQName( _name );
} Deprecated! |
public String getNamespaceForPrefix(String prefix) {
if (_startElement == null)
return null;
Map map = _startElement.getNamespaceMap();
if (map == null)
return null;
return (String) map.get( prefix );
} Deprecated! |
public String getText() {
return _text.toString();
} Deprecated! |
public String getText(int wsr) {
return XmlWhitespace.collapse( _text.toString(), wsr );
} Deprecated! |
public String getXsiLoc() {
return _xsiLoc;
} Deprecated! |
public String getXsiNil() {
return _xsiNil;
} Deprecated! |
public String getXsiNoLoc() {
return _xsiNoLoc;
} Deprecated! |
public String getXsiType() {
return _xsiType;
} Deprecated! |
protected XMLEvent nextEvent() throws XMLStreamException {
XMLEvent e = _source.next();
if (e == null)
{
if (!_finished)
{
flushText();
nextEvent( ValidatorListener.END );
_finished = true;
}
}
else
{
switch ( e.getType() )
{
case XMLEvent.CHARACTER_DATA :
case XMLEvent.SPACE :
{
CharacterData cd = (CharacterData) e;
if (cd.hasContent())
_text.append( cd.getContent() );
break;
}
case XMLEvent.START_ELEMENT :
{
StartElement se = (StartElement) e;
flushText();
// Used for prefix to namespace mapping
_startElement = se;
// Prepare the xsi:* values
AttributeIterator attrs = se.getAttributes();
while ( attrs.hasNext() )
{
Attribute attr = attrs.next();
XMLName attrName = attr.getName();
if ("http://www.w3.org/2001/XMLSchema-instance".equals(
attrName.getNamespaceUri() ))
{
String local = attrName.getLocalName();
if (local.equals( "type" ))
_xsiType = attr.getValue();
else if (local.equals( "nil" ))
_xsiNil = attr.getValue();
else if (local.equals( "schemaLocation" ))
_xsiLoc = attr.getValue();
else if (local.equals( "noNamespaceSchemaLocation" ))
_xsiNoLoc = attr.getValue();
}
}
// Emit the START
// TODO - should delay the aquisition of the name
_name = e.getName();
nextEvent( ValidatorListener.BEGIN );
// Emit the attrs
attrs = se.getAttributes();
while ( attrs.hasNext() )
{
Attribute attr = attrs.next();
XMLName attrName = attr.getName();
if ("http://www.w3.org/2001/XMLSchema-instance".equals(
attrName.getNamespaceUri() ))
{
String local = attrName.getLocalName();
if (local.equals( "type" ))
continue;
else if (local.equals( "nil" ))
continue;
else if (local.equals( "schemaLocation" ))
continue;
else if (local.equals( "noNamespaceSchemaLocation" ))
continue;
}
// TODO - God, this is lame :-)
_text.append( attr.getValue() );
_name = attr.getName();
nextEvent( ValidatorListener.ATTR );
}
clearText();
_startElement = null;
break;
}
case XMLEvent.END_ELEMENT :
{
flushText();
nextEvent( ValidatorListener.END );
break;
}
}
}
return e;
} Deprecated! |
public boolean textIsWhitespace() {
for ( int i = 0 ; i < _text.length() ; i++ )
{
switch ( _text.charAt( i ) )
{
case ' ':
case '\n':
case '\r':
case '\t':
break;
default :
return false;
}
}
return true;
} Deprecated! |