|
One more thing. You should navigate to between
the START and END tokens of the element to which you wish to add the attribute
when you call insertAttributeWithValue(). More detail on this can be found at http://xmlbeans.apache.org/docs/2.0.0/guide/conNavigatingXMLwithCursors.html.
Cheers, From: Lawrence Jones Hi Yixing You can use the XmlCursor to insert
attributes. Use the cursor to navigate to the element on which you wish to add
the attributes. After that do something like the following:
QName attQN = new QName("http://www.w3.org/2001/XMLSchema-instance",
"noNamespaceSchemaLocation",
"xsi");
c.insertAttributeWithValue(attQN,
"C:\\Documents and Settings\\User\\Desktop\\r&r.xsd"); To get an XmlCursor simply call
newCursor() on any XmlObject. I tried this in a test program and both
the attribute and namespace declaration were automatically put in as you wish. Cheers, From: Yixing Ma
[mailto:[EMAIL PROTECTED] Hi, I just switched to XMLBeans from JAXB. Now I have a question about writing to a file from XMLBeans. <?xml version="1.0"
encoding="UTF-8"?> I want to include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="C:\Documents and
Settings\User\Desktop\r&r.xsd" information into the newly created XML file. But don't know
how. Anyone can help? Regards, YODA909 |
- newbie need help Yixing Ma
- RE: newbie need help Lawrence Jones
- RE: newbie need help Lawrence Jones

