[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-user
Subject: Re: XmlCursor
From: Christian Schweers <cschweers () web ! de>
Date: 2005-11-15 9:46:32
Message-ID: 851585363 () web ! de
[Download RAW message or body]
Thanks for help but it doesn't solve my problem.
I limited my XmlObject to this content and call newCursor():
<ParameterRefEntry parameterRef="MyPara02">
<LocationInContainerInBits referenceLocation="containerStart">
<FixedValue>311</FixedValue>
</LocationInContainerInBits>
</ParameterRefEntry>
How can i move the cursor to the "FixedValue" to change the 311 in xxx? The content \
of the XmlObject is not always the same and the "FixedValue" is not always on the \
same position. How do i find out, how many times i have to move the cursor?
Thanks.
Christian
Yana Kadiyska schrieb:
> You can call newCursor() on your XmlObject, and then, using the cursor,
> move it by calls to toFirstChild() and toNextSibling(), etc until you
> get to the desired location.
>
> Your approach has 2 pitfalls: 1. It is not the correct query if you're
> starting from the root of the document (i.e. it doesn't return the node
> you want) 2. execQuery returns a copy, rather than a pointer to the
> original object
>
> You can look at the tutorial on the website for examples on cursor
> navigation:
> http://xmlbeans.apache.org/documentation/tutorial_getstarted.html (in
> particular, see the section on the cursor)
>
> --Yana
> -----Original Message-----
> From: cschweers@web.de [mailto:cschweers@web.de]
> Sent: Monday, November 14, 2005 5:06 AM
> To: user@xmlbeans.apache.org
> Subject: XmlCursor
>
> Hello there,
>
> i have a XmlObject (myXml) with this content:
>
> <SequenceContainer name="MyContainer"
> shortDescription="Blablabla">
> <EntryList>
> <ParameterRefEntry parameterRef="MyPara01">
> <LocationInContainerInBits
> referenceLocation="containerStart">
> <FixedValue>319</FixedValue>
> </LocationInContainerInBits>
> </ParameterRefEntry>
> <ParameterRefEntry parameterRef="MyPara02">
> <LocationInContainerInBits
> referenceLocation="containerStart">
> <FixedValue>311</FixedValue>
> </LocationInContainerInBits>
> </ParameterRefEntry>
> </EntryList>
> </SequenceContainer>
>
> Now, i will change the "Fixed Value" of "MyPara02". How can i do this?
>
> I've tried something like that but it doesn't work :(
>
> XmlCursor cursor =
> myXml.newCursor().execQuery("ParameterRefEntry[parameterRef="MyPara02"]"
> );
> QName test = new QName("FixedValue");
> cursor.setAttributeText(test, "123");
>
> Hope for help.
>
> Thanks.
>
> Christian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic