[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-user
Subject: Re: insert xml string? (substitution group)
From: "jim smith" <jetbrains () gmail ! com>
Date: 2006-05-16 8:27:38
Message-ID: f3aea2870605160127s4fa80ad6i91a2b2edaf1be899 () mail ! gmail ! com
[Download RAW message or body]
Use xmlcursor like below code
XmlCursor cursor =m_definitions.newCursor();
// cursor.toFirstChild();
// cursor.toFirstChild();
cursor.toEndDoc();
// System.out.println("Token type: " + cursor.currentTokenType() + "
=/ "
// + cursor.xmlText());
cursor.insertNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
On 5/16/06, Jan Torben Heuer <jtnews@mail2003.dnsalias.org> wrote:
>
> Hi,
>
> I'm not much experienced with xml beans, yet... I want to insert an xml
> string into my document. It should replace an abstract element
> (substitution group).
>
> //parent
> OfferingType so = xmlbeansdoc.addNewOffering();
>
> //abstract
> PropertyType op = so.addNewProperty();
>
> //the old way, creating the elements (may be wrong)
> QName sub_elem = new QName("namespace","CountProperty");
> CountProperty cp = (CountProperty)
> op.substitute(sub_elem,CountProperty.type);
>
> //I'd like to do something like:
> op.substituteWithString("<foo bar='300' />");
>
> Is that possible?
>
>
> Thanks,
>
> Jan Torben
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
[Attachment #3 (text/html)]
<div>Use xmlcursor like below code</div>
<div>
<p> XmlCursor cursor =m_definitions.newCursor();<br> \
// cursor.toFirstChild();<br> \
// \
cursor.toFirstChild();<br> \
cursor.toEndDoc();</p> <p> \
<br> <br> \
// System.out.println("Token type: " + \
cursor.currentTokenType() + " =/ "<br> \
// + \
cursor.xmlText());</p> <p> \
cursor.insertNamespace("xsd", "<a \
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>");<br> \
</p><br><br> </div> <div><span class="gmail_quote">On 5/16/06, <b \
class="gmail_sendername">Jan Torben Heuer</b> <<a \
href="mailto:jtnews@mail2003.dnsalias.org">jtnews@mail2003.dnsalias.org</a>> \
wrote:</span> <blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px \
0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br><br>I'm not much experienced with \
xml beans, yet... I want to insert an xml<br>string into my document. It should \
replace an abstract element <br>(substitution group).<br><br>//parent<br>OfferingType \
so = xmlbeansdoc.addNewOffering();<br><br>//abstract<br>PropertyType op = \
so.addNewProperty();<br><br>//the old way, creating the elements (may be \
wrong)<br>QName sub_elem = new \
QName("namespace","CountProperty"); <br>CountProperty cp = \
(CountProperty)<br>op.substitute(sub_elem,CountProperty.type);<br><br>//I'd like to \
do something like:<br>op.substituteWithString("<foo bar='300' \
/>");<br><br>Is that possible?<br><br> <br>Thanks,<br><br>Jan \
Torben<br><br><br>---------------------------------------------------------------------<br>To \
unsubscribe, e-mail: <a \
href="mailto:user-unsubscribe@xmlbeans.apache.org">user-unsubscribe@xmlbeans.apache.org
</a><br>For additional commands, e-mail: <a \
href="mailto:user-help@xmlbeans.apache.org">user-help@xmlbeans.apache.org</a><br><br></blockquote></div><br>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic