void Document::HandleJsonReferences(void) { Document::Iterator i = this->Begin(); while (i != this->End()) { // Looking for an object with a string member named // $ref. This special combination signifies a JSON // reference. If this is found, we create a JSON reference // element to replace the object. Element& element = i.GetElement(); if ( (element.GetType() == ELEMENT_TYPE_OBJECT) && (element.HasElement("$ref")) && (element.GetElement("$ref").GetType() == ELEMENT_TYPE_STRING) ) { ElementReference* referenceElement = new ElementReference( element.GetElement("$ref").GetValueAsString(), this); if (element.parentElement != nullptr) { element.parentElement->ReplaceElement(element, *referenceElement); } } i++; } }
bool_t Document::ValidateAgainstSchema(bool_t raiseException) { bool_t returnValue = true; Document::Iterator i = this->Begin(); while ((i != this->End()) && (returnValue)) { returnValue = i.GetElement().ValidateAgainstSchema( raiseException); i++; } return returnValue; }