smitthy
smitthy

Reputation: 289

X3D to XML conversion

I have dozens of X3D files and I'm aiming to use an XML parser to get them into a Java application. However, I know it might sound silly, but how would I convert the .x3d files into .xml files? The .x3d files were supplied to me from a friend in aim to make a 3D model viewer. I've done some research but I don't know if the following code is correct in loading X3D into 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>

Upvotes: 1

Views: 511

Answers (2)

Don Brutzman
Don Brutzman

Reputation: 151

You can also rename a .x3d file to .xml if that helps a native-XML tool deal with it.

The X3D Example Archives also provide copies of every scene in Canonical XML form, which supports application of XML Security tools for XML Digital Signature (authentication) and XML Encryption (privacy). More on these topics at

Upvotes: 2

wero
wero

Reputation: 33010

X3D is a file format based on XML, so yes: you will be able to load X3D files with a (Java) XML parser.

Upvotes: 0

Related Questions