 	
 	
 	// MARK: - Miscellaneous
+	
+	/// The FCPXML document as a properly formatted string.
+	public var fcpxmlString: String {
+		let xmlDocument = XMLDocument(rootElement: self.copy() as! XMLElement)
+		let formattedData = xmlDocument.xmlData(withOptions: 131076)
+		let formattedString = NSString(data: formattedData, encoding: String.Encoding.utf8.rawValue)
+		
+		guard formattedString != nil else {
+			return ""
+		}
+		
+		return formattedString! as String
+	}
 	
 	
 	/**

	
	
	
	// MARK: - XMLElement helper properties and functions
	public func getElementAttribute(_ name: String) -> String? {
		
		if let elementAttribute = self.attribute(forName: name) {

		}
	}
	
	/// If this is a compound clip or compound resource element, this returns its resource's sequence element. Returns nil if there is no sequence element or if this is not a compound clip or resource element.
	public var fcpxCompoundResourceSequence: XMLElement? {
		let resource: XMLElement
		
		switch self.fcpxType {
		case .compoundClip:  // If this is a compound clip in a project timeline
			guard self.fcpxResource != nil else {
				return nil
			}
			resource = self.fcpxResource!
			
		case .compoundResource:  // If this is the resource of a compound clip
			resource = self
			
		default:
			return nil
		}
		
		let sequenceElements = resource.elements(forName: "sequence")
		
		guard sequenceElements.count > 0 else {
			return nil
		}
		
		return sequenceElements[0]
	}
	
	/// If this is a compound clip or compound resource element, this returns the spine of the primary storyline. Returns nil if there is no spine or if this is not a compound clip or resource element.
	public var fcpxCompoundResourceSpine: XMLElement? {
		let resource: XMLElement
		
		switch self.fcpxType {
		case .compoundClip:  // If this is a compound clip in a project timeline
			guard self.fcpxResource != nil else {
				return nil
			}
			resource = self.fcpxResource!
			
		case .compoundResource:  // If this is the resource of a compound clip
			resource = self
			
		default:
			return nil
		}
		
		let sequenceElements = resource.elements(forName: "sequence")
		
		guard sequenceElements.count > 0 else {
			return nil
		}
		
		let spineElements = sequenceElements[0].elements(forName: "spine")
		
		guard spineElements.count > 0 else {
			return nil
		}
		
		return spineElements[0]
	}
	
	
	/// If this is a compound clip or compound resource element, this returns the clips contained within the compound clip's primary storyline. Returns an empty array if there are no clips or if this is not a valid compound clip or resource element.
	public var fcpxCompoundClips: [XMLElement] {
		get {
			
			guard let spine = self.fcpxCompoundResourceSpine else {
				return []
			}
			
			guard let children = spine.children else {
				return []
			}
			
			var clips: [XMLElement] = []
			for child in children {
				if child.kind == XMLNode.Kind.element {
					clips.append(child as! XMLElement)
				}
			}
			return clips
			
		}
	}
	
	/// If this is an event item, the event that contains it. Returns nil if it is not an event item.
	public var fcpxParentEvent: XMLElement? {
