I was able to achieve a prefix-less namespace attribute by passing an empty 
string for the prefix argument.



E.g.  cursor.insertNamespace("", namespaceUri);



From: Friessen, Michelle [mailto:michelle.fries...@pearson.com]
Sent: Tuesday, July 15, 2014 4:38 PM
To: user@xmlbeans.apache.org
Subject: Namespaces



We have 3 namespaces that need to be added when generating XML:



xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1";

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 
http://www.imsglobal.org/question/qtiv2p1pd2/xsd/imsqti_v2p1.xsd";



Using XmlCursor, we were able to get the last 2 added using:



cursor.insertAttributeWithValue("schemaLocation", 
"http://www.w3.org/2001/XMLSchema-instance";, 
"http://www.imsglobal.org/xsd/imsqti_v2p1 
http://www.imsglobal.org/question/qtiv2p1pd2/xsd/imsqti_v2p1.xsd";);



However, we cannot successfully get the first one to print out.  We've tried 
variations of insertNamespace, insertAttribute and insertAttributeWithValue. 
Does anyone have any suggestions on how to add a namespace without a prefix?



Thanks.




Michelle Friessen

Systems Product Support Analyst
Assessment & Instruction
Pearson

(319) 354-9200 x214687

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to