return;
}
switch(tree.getType()) {
case JSONLexer.PAIR: {
Tree valueTree = tree.getChild(1);
if(valueTree.getType() == JSONLexer.ARRAY) {
parse(valueTree);
} else {
Tree stringTree = tree.getChild(0);
String qualifiedName = stringTree.getText().substring(1, stringTree.getText().length() - 1);
String localName = qualifiedName;
if(attributePrefix != null && qualifiedName.startsWith(attributePrefix)){
break;
}
String uri = Constants.EMPTY_STRING;
if(namespaceAware && namespaces != null){
if(localName.length() > 2){
int nsIndex = localName.indexOf(namespaceSeparator, 1);
String prefix = Constants.EMPTY_STRING;
if(nsIndex > -1){
prefix = localName.substring(0, nsIndex);
}
uri = namespaces.resolveNamespacePrefix(prefix);
if(uri == null){
uri = namespaces.getDefaultNamespaceURI();
}else{
localName = localName.substring(nsIndex + 1);
}
if(localName.equals(Constants.SCHEMA_TYPE_ATTRIBUTE) && uri != null && uri.equals(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI)){
break;
}
}else{
uri = namespaces.getDefaultNamespaceURI();
}
}
if(contentHandler instanceof XMLRootRecord || contentHandler instanceof DeferredContentHandler){
//if its not namespaceAware don't report the "type" child as it is will be read by the xsi:type lookup
if(!namespaceAware && localName.equals(Constants.SCHEMA_TYPE_ATTRIBUTE)){
break;
}
if(textWrapper != null && textWrapper.equals(localName)){
parse(valueTree);
break;
}
}else if(contentHandler instanceof UnmarshalRecord && ((UnmarshalRecord)contentHandler).getXPathNode() != null){
if(!namespaceAware && localName.equals(Constants.SCHEMA_TYPE_ATTRIBUTE) && !((UnmarshalRecord)contentHandler).getXPathNode().hasTypeChild()){
break;
}
boolean isTextValue = isTextValue(localName);
if(isTextValue){
parse(valueTree);
break;
}
NodeValue nv = ((UnmarshalRecord)contentHandler).getAttributeChildNodeValue(uri, localName);
if(attributePrefix == null && nv !=null ){
break;
}
}
if (valueTree.getType() == JSONLexer.NULL) {
contentHandler.setNil(true);
}
contentHandler.startElement(uri, localName, localName, attributes.setTree(valueTree, attributePrefix, namespaces, namespaceSeparator, namespaceAware));
parse(valueTree);
contentHandler.endElement(uri, localName, localName);
}
break;
}
case JSONLexer.STRING: {
String string = string(tree.getChild(0).getText());
contentHandler.characters(string);
break;
}
case JSONLexer.NUMBER: {
contentHandler.characters(tree.getChild(0).getText());
break;
}
case JSONLexer.TRUE: {
contentHandler.characters(TRUE);
break;
}
case JSONLexer.FALSE: {
contentHandler.characters(FALSE);
break;
}
case JSONLexer.NULL: {
break;
}
case JSONLexer.ARRAY: {
Tree parentStringTree = tree.getParent().getChild(0);
String parentLocalName = parentStringTree.getText().substring(1, parentStringTree.getText().length() - 1);
if(attributePrefix != null && parentLocalName.startsWith(attributePrefix)){
break;
}