我有几十个 X3D 文件,我的目标是使用 XML 解析器将它们放入 Java 应用程序中。但是,我知道这听起来可能很傻,但是我将如何将.x3d
文件转换为.xml
文件?这些.x3d
文件是由一位朋友提供给我的,目的是制作一个 3D 模型查看器。我做了一些研究,但我不知道以下代码在将 X3D 加载到 XML 中是否正确。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN"
"http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile="IMMERSIVE"
xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d- 3.0.xsd">
<head>
<meta name='filename' content='RedSphereBlueBox.x3d'/>
</head>
<Scene>
<Transform>
<NavigationInfo headlight='false'
avatarSize='0.25 1.6 0.75' type='EXAMINE'/>
<DirectionalLight/>
<Transform translation='3.0 0.0 1.0'>
<Shape>
<Sphere radius='2.3'/>
<Appearance>
<Material diffuseColor='1.0 0.0 0.0'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='-2.4 0.2 1.0' rotation='0.0 0.707 0.707 0.9'>
<Shape>
<Box/>
<Appearance>
<Material diffuseColor='0.0 0.0 1.0'/>
</Appearance>
</Shape>
</Transform>
</Transform>
</Scene>
</X3D>