[x3d-public] More Object Model Work: indicating nodes and statementsforeachprofile within object model and X3DJSAIL
John Carlson
yottzumm at gmail.com
Sun Sep 3 21:34:11 PDT 2017
>From the link:
TransformerFactory transFact = TransformerFactory.newInstance();
StreamSource xsltSource = new StreamSource(xsl);
// XXX for 'xsl:import' to load other xsls from class path
transFact.setURIResolver(new ClasspathResourceURIResolver());
Templates cachedXSLT = transFact.newTemplates(xsltSource);
Transformer transformer = cachedXSLT.newTransformer();
class ClasspathResourceURIResolver implements URIResolver {
@Override
public Source resolve(String href, String base) throws TransformerException {
return new StreamSource(XXX.getClassLoader().getResourceAsStream(href));
}
}
Not sure if this works in both Saxon and Java XSLT. You’ll have to experiment. You’ll also have to replace XXX.
John
Sent from Mail for Windows 10
From: John Carlson
Sent: Monday, September 4, 2017 12:24 AM
To: Don Brutzman
Subject: RE: More Object Model Work: indicating nodes and statementsforeachprofile within object model and X3DJSAIL
Here’s the link again. I think this will truly help if you look at some of the answers.
https://stackoverflow.com/questions/3699860/resolving-relative-paths-when-loading-xslt-files
But I’m not certain. If you can’t get there, I will try.
John
Sent from Mail for Windows 10
From: Don Brutzman
Sent: Sunday, September 3, 2017 11:43 PM
To: John Carlson
Subject: Re: More Object Model Work: indicating nodes and statements foreachprofile within object model and X3DJSAIL
On 9/3/2017 7:00 PM, John Carlson wrote:
> Again, you need to diagnose the imports in the stylesheet. See links previously provided to stack overflow (not in this message, I think).
understood, thanks.
i refactored out a common method to perform a stylesheet invocation using jar .xslt as source that simplified most conversions. most are now working. added a primitive debug mode also.
the problems with import is that the X3dToHtml documentation stylesheet also imports/invokes the SVG Extrusion crossSection stylesheet, which can't be found from inside the jar.
unable to turn off that import via a passed-parameter switch. so i am considering refactoring and splitting that stylesheet, will invoke each separately where needed, this affects multiple other places that use the stylesheet.
> You need a way to resolve imports in the stylesheet in Java, probably with a URI resolver. There may be different ways to do it for saxon and java xslt.
>
> If you can’t solve it quick, let me know, and I will start looking at it.
still in motion...
> John
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>
> *From: *Don Brutzman <mailto:brutzman at nps.edu>
> *Sent: *Sunday, September 3, 2017 8:06 PM
> *To: *John Carlson <mailto:yottzumm at gmail.com>
> *Subject: *Re: More Object Model Work: indicating nodes and statements for eachprofile within object model and X3DJSAIL
>
> lotta work but slowly yielding... hopefully tonight.
>
> On 8/31/2017 10:48 AM, John Carlson wrote:
>
> > Hmm. Do you have the path in the jar in the java, or is there no path?
>
> >
>
> > On Aug 31, 2017 1:42 PM, "Don Brutzman" <brutzman at nps.edu
>
> > <mailto:brutzman at nps.edu>> wrote:
>
> >
>
> > yes i've done that but think that it is not being referenced properly...
>
> > jar issue, TODO diagnose/fix.
>
> >
>
> > On 8/31/2017 9:33 AM, John Carlson wrote:
>
> >
>
> > Well depending on where you run the main
>
> > Java file from, it will either find or not find the stylesheets. My
>
> > suggestion was to put the stylesheet in the jar and access it through
>
> > the class loader through a class, probably x3dobject.
>
> >
>
> > John
>
> >
>
> > On Aug 31, 2017 10:53 AM, "Don Brutzman" <brutzman at nps.edu
>
> > <mailto:brutzman at nps.edu> <mailto:brutzman at nps.edu
>
> > <mailto:brutzman at nps.edu>>> wrote:
>
> >
>
> > Right, that's good. "Common sense" check is helpful to make sure
>
> > that things are understandable. Thanks John.
>
> >
>
> > Am finally ready to re-look at the .jar problem you had a few
>
> > weeks ago, please help recenter me. I didn't understand properly before.
>
> >
>
> > p.s. still having some intermittent trouble accessing stylesheets
>
> > within the classpath .jar as well. Am shifting to a new computer so
>
> > that reveals both issues and occasionally new mysteries.
>
> >
>
> >
>
> > On 8/31/2017 12:50 AM, John Carlson wrote:
>
> >
>
> > I didn't check anything but the syntax, content I didn't check.
>
> >
>
> > John
>
> >
>
> >
>
> > On Aug 31, 2017 3:48 AM, "Don Brutzman" <brutzman at nps.edu
>
> > <mailto:brutzman at nps.edu> <mailto:brutzman at nps.edu
>
> > <mailto:brutzman at nps.edu>> <mailto:brutzman at nps.edu
>
> > <mailto:brutzman at nps.edu> <mailto:brutzman at nps.edu
>
> > <mailto:brutzman at nps.edu>>>> wrote:
>
> >
>
> > On 8/30/2017 10:23 AM, John Carlson wrote:
>
> >
>
> > Looks okay to me.
>
> >
>
> >
>
> > Thanks for double checks.
>
> >
>
> > On Aug 30, 2017 12:47 PM, "Don Brutzman"
>
> > <brutzman at nps.edu <mailto:brutzman at nps.edu> <mailto:brutzman at nps.edu
>
> > <mailto:brutzman at nps.edu>>
>
> > <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>
>
> > <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>>>
>
> > <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>
>
> > <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>>
>
> > <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>
>
> > <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>>>>> wrote:
>
> >
>
> > OK, have amended X3D XML Schema to include
>
> > allowed nodes under
>
> > each profile. Also added allowed X3D statements
>
> > under Core profile.
>
> >
>
> > Documentation at
>
> > http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC>
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC>>
>
> >
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC>
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC>>>
>
> >
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC>
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC>>
>
> >
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC>
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC
>
> > <http://www.web3d.org/specifications/X3dSchemaDocumentation3.3/x3d-3.3_profileNames.html#LinkDC>>>>
>
> >
>
> >
>
> >
>
> > Next: have extracted these node and statement
>
> > lists for inclusion
>
> > in the X3D Unified Object Model profile information.
>
> >
>
> > Result excerpt follows. Please look at syntax,
>
> > hope it looks OK.
>
> > As this gets integrated, will next apply by generating
>
> > profile-validation tests in source code for
>
> > X3DJSAIL.[...]
>
> >
>
> >
>
> > OK have taken the next step: added validation of profile
>
> > and component
>
> > information for each node in the respective validate()
>
> > methods.
>
> >
>
> > Example excerpt from AnchorObject follows, where
>
> > Anchor-specific values
>
> > for profiles/component/level get plugged in from entries in
>
> > X3DObjectModel-3.3.xml:
>
> >
>
> > // profile validation test, if connected to full scene
>
> > if (findAncestorX3DObject() != null)
>
> > {
>
> > String modelProfile =
>
> > findAncestorX3DObject().getProfile();
>
> > headObject modelHead =
>
> > findAncestorX3DObject().getHead();
>
> > ArrayList<componentObject> sceneComponentsList =
>
> > new ArrayList<>();
>
> > if (modelHead != null)
>
> > sceneComponentsList =
>
> > modelHead.getComponentList();
>
> > boolean hasSatisfactoryComponent = false;
>
> > for (componentObject nextComponent :
>
> > sceneComponentsList)
>
> > {
>
> > if (
>
> > nextComponent.getName().equals("Networking") &&
>
> > (nextComponent.getLevel() >= 2))
>
> > hasSatisfactoryComponent = true;
>
> > }
>
> > if (!hasSatisfactoryComponent &&
>
> > !modelProfile.equals("CADInterchange") &&
>
> > !modelProfile.equals("Interactive") &&
>
> > !modelProfile.equals("Immersive") &&
>
> > !modelProfile.equals("MedicalInterchange") &&
>
> > !modelProfile.equals("MPEG4Interactive") &&
>
> > !modelProfile.equals("Full"))
>
> > {
>
> > String errorNotice =
>
> > ConfigurationProperties.ERROR_ILLEGAL_VALUE +
>
> > ": invalid X3D profile='" +
>
> > getContainerFieldOverride() +
>
> > "' for parent X3D model, add element
>
> > <componentInfo name='Networking' level='2'/> or
>
> > assignment " +
>
> > "'
>
> >
>
> > findAncestorX3DObject().getHead().addComponentInfo(\"Networking\").setLevel(2);";
>
> > validationResult.append(errorNotice).append("\n");
>
> > throw new
>
> > InvalidFieldException(errorNotice); // report error
>
> > }
>
> > }
>
> >
>
> > Tested satisfactorily on HelloWorldProgram.java which indeed
>
> > self-diagnosed itself to reveal a missing component entry
>
> > for Layering
>
> > level 1.
>
> >
>
> > Test program runs satisfactorily, a few other quirks
>
> > appear to be
>
> > adjusted/fixed. Now running recently released Java JDK
>
> > version "1.8.0_141".
>
> >
>
> > Updates now uploading, autogeneration stylesheet changes
>
> > and smoke tests
>
> > checked in, this new release should be available in about
>
> > an hour.
>
> >
>
> > http://www.web3d.org/specifications/java/X3DJSAIL.html
>
> > <http://www.web3d.org/specifications/java/X3DJSAIL.html>
>
> > <http://www.web3d.org/specifications/java/X3DJSAIL.html
>
> > <http://www.web3d.org/specifications/java/X3DJSAIL.html>>
>
> > <http://www.web3d.org/specifications/java/X3DJSAIL.html
>
> > <http://www.web3d.org/specifications/java/X3DJSAIL.html>
>
> > <http://www.web3d.org/specifications/java/X3DJSAIL.html
>
> > <http://www.web3d.org/specifications/java/X3DJSAIL.html>>>
>
> >
>
> > Looking things over, will probably add class constants
>
> > for minimum
>
> > COMPONENT and LEVEL later to simplify programmer access.
>
> >
>
> >
>
> > all the best, Don
>
> > -- Don Brutzman Naval Postgraduate School, Code
>
> > USW/Br brutzman at nps.edu <mailto:brutzman at nps.edu>
>
> > <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>>
>
> > <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>
>
> > <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>>>
>
> > Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA
>
> > +1.831.656.2149 <tel:%2B1.831.656.2149> <tel:%2B1.831.656.2149>
>
> > <tel:%2B1.831.656.2149>
>
> > X3D graphics, virtual worlds, navy robotics
>
> > http://faculty.nps.edu/brutzman <http://faculty.nps.edu/brutzman>
>
> > <http://faculty.nps.edu/brutzman <http://faculty.nps.edu/brutzman>>
>
> > <http://faculty.nps.edu/brutzman <http://faculty.nps.edu/brutzman>
>
> > <http://faculty.nps.edu/brutzman <http://faculty.nps.edu/brutzman>>>
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > all the best, Don
>
> > --
>
> > Don Brutzman Naval Postgraduate School, Code USW/Br brutzman at nps.edu
>
> > <mailto:brutzman at nps.edu>
>
> > Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149
>
> > <tel:%2B1.831.656.2149>
>
> > X3D graphics, virtual worlds, navy robotics
>
> > http://faculty.nps.edu/brutzman <http://faculty.nps.edu/brutzman>
>
> >
>
all the best, Don
--
Don Brutzman Naval Postgraduate School, Code USW/Br brutzman at nps.edu
Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170904/697e453b/attachment-0001.html>
More information about the x3d-public
mailing list