x3d import and export nodes from inline url - import

I need to get access to nodes from an inline x3d file in a parent x3d file. For example, say we have a room model as an x3d file. We populate this room with several chairs. We use the inline url to populate room.x3d with several chair.x3d files. We've got something like this inside the room.x3d file to place chairs:
<Transform DEF = 'Chair'
translation = '0 0 0'
scale = '1 1 1'
rotation='-0.600546 0.600546 90 0'>
<Inline DEF ='chr' url = 'Chair.x3d' />
</Transform>
Now, I need to get access to a few nodes within Chair.x3d to manipulate the scene. I have read about IMPORT and EXPORT and how they are used to get nodes from an inline url, however I have not found a good working example yet. I've looked at this:
http://www.web3d.org/x3d/content/examples/Basic/development/_pages/page27.html
But it does not seem to work.
I've also read this:
http://www.web3d.org/files/specifications/19775-1/V3.2/Part01/components/networking.html
But the syntax is VRML as opposed to x3d.
If anyone could give me a quick example of how to use IMPORT and EXPORT and how to route the nodes from the inline url so I can send it events, etc. it would be greatly appreciated. Let me know if I'm not being clear enough.

This works for me:
Source FILE of X3D object ( a brown cylinder):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" .stuff..>
<X3D profile='Interchange' version='3.0'
xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' ..stuff..>
<Scene>
<Transform DEF='XFER_OBJECT'>
<Shape>
<Cylinder radius='1' height='1'/>
<Appearance>
<Material diffuseColor='.9 .3 .3'/>
</Appearance>
</Shape>
</Transform>
<Export localDEF='XFER_OBJECT' as='Cyl'/>
</Scene>
</X3D>
and the url/import code in my xhtml file:
<Transform translation='2 0 0' >
<Inline DEF='objectBrnCyl' url='"test33.x3d"' />
</Transform>
<IMPORT InlineDEF='objectBrnCyl' exportDEF='Cyl' as='brnCyl'/>
Haven't finished case testing the commands yet -- the documentation is a little spooky.

Related

RDF/XML Representing address with blank nodes

I am new to RDF/XML notation and I am having trouble with addresses. I tried to google for examples but I can't find any; all I find are graphical notations, which isn't in the format I need.
This is an example of what I want to achieve.
This is what I currently have:
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:net="http://purl.org/net/VideoGameOntology" xmlns:sc="http://www.schema.org/">
<sc:Property sc:about="https://schema.org/VideoGame">
<sc:publisher>
<sc:Property sc:about="https://schema.org/person">
<sc:name xml:lang="en"><![CDATA[Kinetic Games]]></sc:name>
<sc:address>
<sc:streetAddress sc:about="https://schema.org/address"><![CDATA[Stag Gates House, 63/64 The Avenue]]></sc:streetAddress>
<sc:addressLocality sc:about="https://schema.org/address"><![CDATA[Southampton]]></sc:addressLocality>
<sc:addressRegion sc:about="https://schema.org/address"><![CDATA[Hampshire]]></sc:addressRegion>
<sc:addressCountry sc:about="https://schema.org/address"><![CDATA[United Kingdom]]></sc:addressCountry>
<sc:postalCode sc:about="https://schema.org/address"><![CDATA[SO17 1XS]]></sc:postalCode>
</sc:address>
</sc:Property>
</sc:publisher>
</sc:Property>
</rdf:RDF>
This is the kind of error I got:
Error: {E202} Expecting XML start or end element(s). String data "Stag Gates House, 63/64 The Avenue" not allowed. Maybe there should be an rdf:parseType='Literal' for embedding mixed XML content in RDF. Maybe a striping error.[Line = 11, Column = 102]
Error: {E201} Multiple children of property element[Line = 12, Column = 59]
I finally managed to find this reference for blank nodes RDF/XML rotation, and this is the final validated code. Hope this helps someone else.
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:net="http://purl.org/net/VideoGameOntology" xmlns:sc="http://www.schema.org/" xmlns:vgo="http://purl.org/net/videogameontology#">
<sc:Property sc:about="https://schema.org/VideoGame">
<sc:publisher sc:resource="https://kineticgames.co.uk/" sc:nodeID="KIGames" />
</sc:Property>
<sc:Property sc:nodeID="KIGames">
<sc:name xml:lang="en"><![CDATA[Kinetic Games]]></sc:name>
<!--Blank Node Kinetic Games address-->
<sc:address sc:nodeID="KIGamesAdd" />
</sc:Property>
<!--Blank Node Kinetic Games address-->
<sc:Property sc:nodeID="KIGamesAdd">
<sc:streetAddress><![CDATA[Stag Gates House, 63/64 The Avenue]]></sc:streetAddress>
<sc:addressLocality><![CDATA[Southampton]]></sc:addressLocality>
<sc:addressRegion><![CDATA[Hampshire]]></sc:addressRegion>
<sc:addressCountry><![CDATA[United Kingdom]]></sc:addressCountry>
<sc:postalCode><![CDATA[SO17 1XS]]></sc:postalCode>
</sc:Property>
</rdf:RDF>

Qlikview REST connector pagination namespaced XML

We have a XML file that is on somewebsite and looks in a way like this (confidential parts stripped)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://somewebsite.com/crm/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Accounts</title>
<id></id>
<updated>2016-02-04T08:36:56Z</updated>
<link rel="self" title="Accounts" href="Accounts" />
<entry>
<title type="text"></title>
<updated>2016-02-04T08:36:56Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:Type>A</d:Type>
<d:UniqueTaxpayerReference m:null="true" />
<d:VATLiability m:null="true" />
<d:VATNumber m:null="true" />
<d:Website m:null="true" />
</m:properties>
</content>
</entry>
<link rel="next" href="https://somewebsite.com/Accounts?$skiptoken=guid'ee6bc390-a8ac-4bbd-8a4d-0a1f04ab9bd3'" />
</feed>
We use the new Rest connector to get the data out of this XML file.
The XML has pagination and every 60 entries you can load the next 60 with the link at the bottom of this xml file.
The problem i have is when, in the REST connector, we want to enable pagination with these setting:
Pagination Type: Next URL
Next URL field path:
/*[name()="feed"]/*[name()="link"][contains(#rel,"next")]/#href
It doesn't seem to work...
side note: the XML file has namespaces so i need to target the elements this way instead of /feed/link/...
I'm using Xpath syntax to target the link href, but maybe this is not the way to go? Or maybe the REST connector isn't using Xpath syntax?
Really hope someone can help me!
Actually it turns out that this seems to be due to a "bug" in the "Qlik REST Connector 1.0" so the pagination doesn't work.
But there is a fix for it:
1) Make sure that the Qlik REST Connector 1.0 connect dialog box has the NextUrl set to:
feed/link/attr:href
2) When the SQL has been generated after using the SELECT-button and going through the wizard you have to modify the sub-SELECT that reads like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href" AS href,
"__FK_link"
FROM "link" FK "__FK_link"),
.....
On line 05 you will have to remove the text AS href.
So it should look like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href",
"__FK_link"
FROM "link" FK "__FK_link"),
....
3) Find the LOAD statement that loads from this sub-select with a RESIDENT [MasterREST further down in the load script and make sure that the reference to href is changed to [attr:href] - or else you will get an error message while loading.
Should look like this after the change:
[link]:
LOAD [rel],
[title],
[attr:href],
[__FK_link] AS [__KEY_feed]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_link]);
This worked for me:
/*[name()='feed']/*[name()='link'][#rel='next']/#href
Yours should also work actually, maybe whatever you are using does not agree with double quotes instead of single quotes.

In Filemaker, is it possible to import into Container fields from XML?

The XML FMPXMLRESULT grammar documentation states:
XML export does not support exporting container field data.
which seems to imply that it's possible to import (it does also specify that you can denote a field as type "CONTAINER" in the XML). However, I have found zero documentation as to how this might be done.
Is it possible? I get that there are ways of getting e.g. an image file into Filemaker after the fact, but can I just specify it in the XML beforehand, negating the need to have additional scripts or post-processing the import (not to mention something that works in Filemaker 11 or below)?
You can import file references, but not binary data. (And you'll have to specify the field as TEXT type in the XML file.) For example:
<?xml version="1.0" encoding="UTF-8"?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="01-25-2011" NAME="FileMaker"
VERSION="ProAdvanced 11.0v3" />
<DATABASE DATEFORMAT="M/d/yyyy" TIMEFORMAT="h:mm:ss a"
LAYOUT="" NAME="" RECORDS="" />
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" TYPE="TEXT" NAME="Path" />
</METADATA>
<RESULTSET FOUND="">
<ROW>
<COL>
<DATA>image:test.jpg</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
The path must be in FileMaker format; here I used a relative path to test.jpg in the same directory as the file (will only work for local files), but it can also be an absolute path, e.g.:
imagewin:/C:/Some/Path/test.jpg
Your best option is probably to import Base64-encoded data, then use the Base64Decode function to decode it.
importing images, preferably from http
I am not sure what exactly that means. If your XML contains a link to an image, then the only thing you can do with it is import the link as text. If you are using version 12 or higher, you can follow this with the Insert From URL script step (for each imported record).

xpath xml files within matlab

Is it possible to read,compare and look for a specefic strings in xml files using xpath from Matlab ?
I don't find any documentation.
could someone give me an example ?
<?xml version="1.0" encoding="UTF-8"?>
<address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation='test.xsd'>
<lists name="myState">
<description name="-temp">-20</description>
<description name="localization">north</description>
<description name="-state">false</description>
</lists>
</address>
<language language="english" name="">
<description name="population">5000</description>
</language>
here to access to description name="localization"> , I did :
docNode = xmlread(myXMLFILE);
factory = XPathFactory.newInstance;
xpath = factory.newXPath;
% compile and evaluate the XPath Expression
expression = xpath.compile(adress/lists/description')
description = expression.evaluate(docNode, XPathConstants.NODE);
descriptionValue = phoneNumberNode.getTextContent % this gives me -20
how can I get the value of ?
thanks
Have you tried Google? One of the first link gave me a good example of using XPath on FileExchange:
Using XPath from MATLAB
An XPath package started shipping as part of Java 5, so we can use it
from MATLAB. This is a simple example.
The Java XPath API tutorial on ibm.com is a good introduction to XPath
in Java.
% Import the XPath classes
import javax.xml.xpath.*
% Construct the DOM.
doc = xmlread(which('demos/demos.xml'));
% Create an XPath expression.
factory = XPathFactory.newInstance;
xpath = factory.newXPath;
expression = xpath.compile('//demosection/label');
% Apply the expression to the DOM.
nodeList = expression.evaluate(doc,XPathConstants.NODESET);
% Iterate through the nodes that are returned.
for i = 1:nodeList.getLength
node = nodeList.item(i-1);
disp(char(node.getFirstChild.getNodeValue))
end
Another good article is in Mike's blog - XML and MATLAB: Navigating a Tree. It has a part specifically on using XPath.

How to add a colorized HTML code snippet in Sandcastle documentation?

I am using the Sandcastle Help File Builder and would like to include colorized HTML code snippets in the "Conceptual Content". Is this possible and if so, how?
I have tried <code>, <codeExample>, and <sampleCode language="HTML" />.
The best result so far is to HTML-encode the sample HTML and place it in a .snippets file like so.
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="HTML">
<span>My Html</span>
</sampleCode>
</item>
</examples>
Then reference it in the .aml file.
<codeReference>htmlSnippet</codeReference>
I would prefer to have it colorized, but I can't figure out a way to add the formatting.
According to the MAML Guide, the proper way of doing this is to use a <code> tag with a CDATA section:
<code language="xml" title="Example Configuration">
<![CDATA[
<span>My Html</span>]]>
</code>
The contents of the CDATA section will be treated as a literal string, and indentation will be preserved.
I know this is old, but Sandcastle supports html as xml. I figured I should comment in case anyone else comes across this post as I did.
This should work:
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="xml"><!CDATA[[
<span>My Html</span>
]]>
</sampleCode>
</item>
</examples>
If you're using Sandcastle Help File Builder, you may create your own syntax parser as described here and here, although xml is available by default... using the XAML filter's generator, which is defined here if you want to look at the config:
<generator type="Microsoft.Ddue.Tools.XamlUsageSyntaxGenerator"
assembly="{#SandcastlePath}ProductionTools\SyntaxComponents.dll">
<filter files="{#SandcastlePath}Presentation\Shared\configuration\xamlSyntax.config" />
</generator>
According to the SHFB documentation for the Code Block Component, you should be able to just use the <code>.
I got it to work without a problem; here's what I did:
test.html
<html>
<head>Something!</head>
<body>
<h1>Heading</h1>
<!-- #region myhtml -->
<p>Paragraph</p>
<div>Div for <strong>Good</strong> <em>measure</em>.</div>
<!-- #endregion -->
</body>
</html>
SomethingorOther.aml
<code language="html" source="../Examples/test.html" region="myhtml" />
Result:
Please note that in the preview, your sample will appear as unhighlighted XML, but when you build the documentation, everything should like just fine.