Click here to Skip to main content
15,904,822 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear all !

Pls, help me design code to get all element and attribute of xml file below.

XML
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.w3.org/2004/12/ws-chor/cdl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2004/12/ws-chor/cdl
C:\Comp_Sci\Project\jaxb\xml\wscdl.xsd" name="libraryChoreography" targetNamespace="http://www.ecs.soton.ac.uk/akd202£">

<!-- Information Types -->
<informationType name="bookProfileType" type="bookProfileMsg"/>
<informationType name="bookAvailableType" type="bookAvailableMsg"/>

<!-- Tokens -->
<token informationType="uriType" name="centralLibraryRef"/>

<!-- TokenLocator -->
<!-- Null -->

<!-- Role Types -->
<roleType name="LibraryRole">
	<behavior name="serviceRequester"/>
	<behavior name="serviceProvider" interface="libraryServiceProviderWSDL"/>
</roleType>
<roleType name="CentralLibraryRole">
	<behavior name="serviceProvider" interface="centralLibraryServiceProvider"/>
</roleType>

<!-- Relationship Types -->
<relationshipType name="Library_CentralLibrary">
	<role type="LibraryRole" behavior="serviceRequester"/>
	<role type="CentralLibraryRole" behavior="serviceProvider"/>
</relationshipType>

<!-- Channel Types -->
<channelType name="CentralLibraryChannel">
	<role type="CentralLibraryRole"/>
	<reference>
		<token name="centralLibraryRef"/>
	</reference>
</channelType>

<!-- Choreographies -->
<choreography name="GetBookAvailability" root="true">
	<relationship type="Library_CentralLibrary"/>
	<variableDefinitions>
		<variable name="bookProfile" informationType="bookProfileType" mutable="false"/>
		<variable name="bookAvailability" informationType="bookAvailableType" mutable="false"/>
		<variable name="centralLibrary" channelType="CentralLibraryChannel"/>
	</variableDefinitions>
	<sequence>
		<interaction channelVariable="centralLibrary" name="getBookAvailability" operation="queryBookAvailabilty" initiate="true">
			<participate toRole="CentralLibraryRole" relationshipType="Library_CentralLibrary" fromRole="LibraryRole"/>
			<exchange action="request" name="bookProfileExchange" informationType="bookProfileType">
				<send variable="cdl:getVariable(bookProfile,LibraryRole)"/>
				<receive variable="cdl:getVariable(bookProfile,CentralLibraryRole)"/>
			</exchange>
			<exchange action="respond" name="bookAvailabilityExchange" informationType="bookAvailableType">
				<send variable="cdl:getVariable(bookAvailability,CentralLibraryRole)"/>
				<receive variable="cdl:getVariable(bookAvailability,LibraryRole)"/>
			</exchange>
		</interaction>
	</sequence>
</choreography>
</package>
Posted
Comments
Sergey Alexandrovich Kryukov 2-Apr-12 22:16pm    
What is that language, "Eclipse"? :-)
--SA
Alexander Alekseyevich Fedoseev 2-Apr-12 22:32pm    
lol, more like a compiler

For .NET, here are the options you have:

  1. Use System.Xml.XmlDocument class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^].
  2. Use the class System.Xml.XmlTextReader; this is the fastest way of reading, especially is you need to skip some data.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx[^].
  3. Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^], http://msdn.microsoft.com/en-us/library/bb387063.aspx[^].


For Java, you can use javax.xml.parsers. Please see:
http://docs.oracle.com/javase/1.5.0/docs/api/javax/xml/parsers/package-summary.html[^].

As to Eclipse, I suspect you mixed up the notion of language (I don't know a language with such name, neither does Wikipedia) with the open-source development platform, primarily the multi-language/multi-platform IDE framework. This thing is irrelevant to this question. Please see:
http://en.wikipedia.org/wiki/Eclipse_%28software%29[^],
http://www.eclipse.org/[^].

—SA
 
Share this answer
 
with a option can you give example may be??
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 6-Jul-14 13:08pm    
Not an answer. Such posts are considered as abuse. Instead, use comments and/or "Improve question".
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900