Phill Pafford
12-15-2008, 05:40 PM
Hi I have this XSD
<?xml version="1.0" encoding="utf-16"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<element name="navigationElement" type="xs:linkElement"/>
<complexType name="linkElement" mixed="true">
<sequence>
<element name="displayName" type="xs:string"/>
<element name="displayType" type="xs:string"/>
<element name="id" type="xs:string"/>
<element name="link" type="xs:string"/>
<element name="parentId" type="xs:string"/>
<element name="permission" type="xs:string" minOccurs="0" maxOccurs="10"/>
<element name="displayDirection" type="xs:string" minOccurs="0"/>
</sequence>
</complexType>
</schema>
wanted to know if I could have java parse this out to display the menu elements based on the id parentId.
so id="home" would be a menu in the navbar
and id"link1" parentId="home" would be a sub-link of the home menu.
The XML elements are not in order but they do have an id and a parentId for which each link sub-nav should go under.
Some example XML
<!-- ********************* HOME ********************* -->
<navigationElement xmlns="http://www.w3schools.com" xmlns:xsi="http://www.w3schools.com" xsi:schemaLocation="http://www.w3schools.com navbar.xsd">
<linkElement>
<displayName>Home</displayName>
<displayType>menu</displayType>
<id>home</id>
<link>/home.html</link>
<parentId>
</parentId>
<permission>
</permission>
<displayDirection>
</displayDirection>
</linkElement>
<!-- ********************* MESSAGES ********************* -->
<linkElement>
<displayName>page 1</displayName>
<displayType>menu</displayType>
<id>page1</id>
<link>#</link>
<parentId>
</parentId>
<permission>yes</permission>
<displayDirection>
</displayDirection>
</linkElement>
<linkElement>
<displayName>page 1 link 1</displayName>
<displayType>link</displayType>
<id>link1</id>
<link>page1.html</link>
<parentId>page1</parentId>
<permission>yes</permission>
<displayDirection>
</displayDirection>
</linkElement>
</navigationElement>
<?xml version="1.0" encoding="utf-16"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<element name="navigationElement" type="xs:linkElement"/>
<complexType name="linkElement" mixed="true">
<sequence>
<element name="displayName" type="xs:string"/>
<element name="displayType" type="xs:string"/>
<element name="id" type="xs:string"/>
<element name="link" type="xs:string"/>
<element name="parentId" type="xs:string"/>
<element name="permission" type="xs:string" minOccurs="0" maxOccurs="10"/>
<element name="displayDirection" type="xs:string" minOccurs="0"/>
</sequence>
</complexType>
</schema>
wanted to know if I could have java parse this out to display the menu elements based on the id parentId.
so id="home" would be a menu in the navbar
and id"link1" parentId="home" would be a sub-link of the home menu.
The XML elements are not in order but they do have an id and a parentId for which each link sub-nav should go under.
Some example XML
<!-- ********************* HOME ********************* -->
<navigationElement xmlns="http://www.w3schools.com" xmlns:xsi="http://www.w3schools.com" xsi:schemaLocation="http://www.w3schools.com navbar.xsd">
<linkElement>
<displayName>Home</displayName>
<displayType>menu</displayType>
<id>home</id>
<link>/home.html</link>
<parentId>
</parentId>
<permission>
</permission>
<displayDirection>
</displayDirection>
</linkElement>
<!-- ********************* MESSAGES ********************* -->
<linkElement>
<displayName>page 1</displayName>
<displayType>menu</displayType>
<id>page1</id>
<link>#</link>
<parentId>
</parentId>
<permission>yes</permission>
<displayDirection>
</displayDirection>
</linkElement>
<linkElement>
<displayName>page 1 link 1</displayName>
<displayType>link</displayType>
<id>link1</id>
<link>page1.html</link>
<parentId>page1</parentId>
<permission>yes</permission>
<displayDirection>
</displayDirection>
</linkElement>
</navigationElement>