On Tuesday, April 16, 2013 at 4:01 PM, JC wrote:
Hi,Im kind of a newb here, and its likely that my question will make that very clear...I feel that I've done due diligence scouring the internet for details... but I'm empty handed.I've even tried a few work arounds...Any help is hugely appreciated!Thank You!I am working with an openoffice draw document.Everything was going well until I ran into an issue related to:I am trying to move a snippet of XML to be the LAST child under its parent. It seems this native xml ordering how open office arranges items in the z plane.So here the operations seem to be:-Get the xml you want to move-Remove the xml you want to move (from its old position)-Append the xml you want to move (in its new position)$imageXML=$image->xml(); //grab the xml
$image->remove()->parent(); <----FAIL HERE
$image->append($imageXML);
I get a giant loop of stuff like this:PHP Notice: Trying to get property of non-object in /Users/jc/Dropbox/xxx/Design Tool DV/External Tools/QueryPath-2.1.2-minimal/QueryPath.php on line 1159So it appear that I can't get back to the parent to do the append?Also,
I tried to just append the xml to the parent, and I get this error:PHP Fatal error: Uncaught exception 'QueryPathParseException' with message 'DOMDocumentFragment::appendXML(): namespace error : Namespace prefix draw for name on frame is not defined (/Users/jc/Dropbox/xxx/Design Tool DV/External Tools/QueryPath-2.1.2-minimal/QueryPath.php: 974)' in /Users/jc/Dropbox/xxx/Design Tool DV/External Tools/QueryPath-2.1.2-minimal/QueryPath.php:2348Stack trace:#0 [internal function]: QueryPathParseException::initializeFromError(2, 'DOMDocumentFrag...', '/Users/jc/Dropb...', 974, Array)#1 /Users/jc/Dropbox/xxx/Design Tool DV/External Tools/QueryPath-2.1.2-minimal/QueryPath.php(974): DOMDocumentFragment->appendXML('<draw:frame dra...')#2 /Users/jc/Dropbox/xxx/Design Tool DV/External Tools/QueryPath-2.1.2-minimal/QueryPath.php(691): QueryPath->prepareInsert('<draw:frame dra...')#3 /Users/jc/Dropbox/xxx/Design Tool DV/Scripts/class.arrayImageRescaler.php(96): QueryPath->append('<draw:frame dra...')#4 /Users/jc/Dropbox/xxx/Users/jc/Dropbox/xxxDesign Tool DV/External Tools/QueryPath-2.1.2-minimal/QueryPath.php on line 2348which seems to be crazy, because I'm taking a copy of open office xml from a known good open office document and trying to reinsert it elsewhere....This is the snipped I want to move:<draw:frame draw:name="ArrayImage" draw:style-name="gr13" draw:text-style-name="P1" draw:layer="layout" svg:width="20.294cm" svg:height="12.647cm" draw:transform="rotate (3.5003633238604) translate (29.763cm 4.471cm)"><draw:image xlink:href="Pictures/1000000000000114000000AC89274823.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"><text:p/></draw:image><svg:desc>ScaleDenominator=<150></svg:desc></draw:frame>--
You received this message because you are subscribed to the Google Groups "support-querypath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to support-queryp...@googlegroups.com.
To post to this group, send email to support-...@googlegroups.com.
Visit this group at http://groups.google.com/group/support-querypath?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
$image->find('svg|desc')->text('ScaleDenominator=<'.$this->ScaleDenominator.'>')->parent();
$image->remove(); <-------- remove is now on its own
$image->parent()->find('draw|custom-shape[draw|name="Azimuth"]');