Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional documentation or help creating one unmarshalling single node element #166

Open
andreaswarnaar opened this issue Jan 20, 2020 · 0 comments

Comments

@andreaswarnaar
Copy link

Hi,
I'm new to this project i just study the SDK code.

I'm looking for a way to unmarshal a single \DomElement to validate small pices of xml. But while trying I encounter some Exceptions.

This is what i try to accomplish:

$sdkMarshaller = new Qti211MarshallerFactory();
$cradle = new DOMDocument('1.0', 'UTF-8');
$xml    = new \DOMElement('hottextInteraction', '<p>Sponsors of the Olympic Games <hottext identifier="A">who bought</hottext>
				advertising time on United States television <hottext identifier="B">includes</hottext>
				<hottext identifier="C">at least</hottext> a dozen international firms <hottext
					identifier="D">whose</hottext> names are familiar to American consumers.
					<hottext identifier="E">No error.</hottext>
			</p>');
 $cradle->appendChild($xml);
 $xml->setAttribute('maxChoices', 1);
 $xml->setAttribute('responseIdentifier', 'RESPONSE');
 $hottextMarshaller = $sdkMarshaller->createMarshaller($cradle->firstChild);
 $hottextMarshaller->unmarshall($cradle->firstChild);

I receive the exception :
The value 'RESPONSE' for the attribute 'responseIdentifier' for element 'hottextInteraction' is not a valid QTI identifier.

But the original exception message is :
A HottextInteraction object must be composed of at least one BlockStatic object, none given.

I think its starts here : \qtism\data\storage\xml\marshalling\responseIdentifier:47

The QtiComponentCollection is empty, and I can't find the correct way to provide a working instance of this to the marshaller

I hope someone can point me to the right direction

Kind regards,
Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant