Last active
June 14, 2018 20:43
-
-
Save kenwebb/0e20a6744ef36f285cf9eb1a1837d39c to your computer and use it in GitHub Desktop.
XML and XPath Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Thu Jun 14 2018 16:43:03 GMT-0400 (Eastern Daylight Time)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: XML and XPath Tests | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: 0e20a6744ef36f285cf9eb1a1837d39c | |
Keywords: | |
My Notes | |
-------- | |
June 14, 2018 | |
Test some stuff in XPath, including things that don't currently work. | |
XPathService > Special > Show Path from root | |
-------------------------------------------- | |
- the result depends on which of the 4 children of Testing is currently selected: One Two Three One Four One One One One One | |
Chameleon/PhysicalSystem/Testing/One[1] | |
Chameleon/PhysicalSystem/Testing/Two | |
Chameleon/PhysicalSystem/Testing/Three | |
Chameleon/PhysicalSystem/Testing/One[2] | |
Chameleon/PhysicalSystem/Testing/Four | |
Chameleon/PhysicalSystem/Testing/One[3] | |
Chameleon/PhysicalSystem/Testing/One[4] | |
Chameleon/PhysicalSystem/Testing/One[5] | |
Chameleon/PhysicalSystem/Testing/One[6] | |
Chameleon/PhysicalSystem/Testing/One[7] | |
Currently, Testingbehavior incorrectly prints: | |
--------------------------------------------- | |
one_47 | |
two_48 | |
three_49 | |
null | |
four_51 | |
null | |
null | |
null | |
null | |
null | |
so | |
-- | |
protected IXholon searchForNthNamedSibling(String siblingName, int n, String attrPredicate, IXholon xhNode) {} | |
does not work | |
public String getExpression(IXholon descendant, IXholon ancestor, boolean shouldEscape) {} | |
does work | |
References | |
---------- | |
(1) https://en.wikipedia.org/wiki/XPath | |
(2) https://github.com/ilinsky/xpath.js | |
JavaScript implementation of XPath 2.0 | |
(3) https://github.com/FontoXML/fontoxpath | |
JavaScript implementation of XPath 3.1 | |
]]></Notes> | |
<_-.XholonClass> | |
<PhysicalSystem/> | |
<Testing/> | |
<One/> | |
<Two/> | |
<Three/> | |
<Four/> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
</xholonClassDetails> | |
<PhysicalSystem> | |
<Testing> | |
<One/> | |
<Two/> | |
<Three/> | |
<One/> | |
<Four/> | |
<One multiplicity="5"/> | |
</Testing> | |
</PhysicalSystem> | |
<Testingbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var me, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
//var root = $wnd.xh.root(); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/One[1]")); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/Two")); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/Three")); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/One[2]")); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/Four")); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/One[3]")); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/One[4]")); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/One[5]")); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/One[6]")); | |
me.println(me.xpath("ancestor::Chameleon/PhysicalSystem/Testing/One[7]")); | |
} | |
} | |
//# sourceURL=Testingbehavior.js | |
]]></Testingbehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg"> | |
<g> | |
<title>Testing</title> | |
<rect id="PhysicalSystem/Testing" fill="#98FB98" height="50" width="50" x="25" y="0"/> | |
<g> | |
<title>Testing One</title> | |
<rect id="PhysicalSystem/Testing/One[1]" fill="#6AB06A" height="50" width="10" x="80" y="0"/> | |
</g> | |
</g> | |
</svg> | |
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient> | |
</XholonWorkbook> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment