XSD TO XML Conversion - xsd

I want to write a java program, Input - XSD File I need to retreive all the element name from the xsd and need to create an xml file as an output with the retreived element name. If anyone of you have the sample code, please share it.
Thanks

You are not rephrasing your question,but still i found some suggestions for you.See if its useful for you.Please check the following link...
http://www.narendranaidu.com/2010/04/xsd-to-xml-and-vice-versa.html

Alright use JAXME or XSOM to parse your schema and use DOM or JDOM to write the element names to new xml

if you want to create a sample XML from schema ..you can use XMLspear tool to do that.
http://www.donkeydevelopment.com/

Related

Parsing a XML file and handling missing tags

I'm trying to parse a XML file in order to retrieve the data in a list.
I need to extract the TITRE_N, the AUTEURS_N and the RESUME_N. I know how to do it but my problem is that for some reference, I don't have any data for AUTEURS_N. there is no tag and the result as you can think it that all the data after are shift! Do you know how I can parse this doc and handle the fact that sometimes I'm missing one tag that I usefully use?
thx a lot!

Is there any way to remove or not to include certain xml elements while creating from mpxj library?

currently when working with mpxj library, generated task xml will have following attributes
<Task>
<UID>0</UID>
<ID>0</ID>
<Name>Naruto Uzumaki</Name>
<Active>1</Active>
<Manual>0</Manual>
......
......
</Task>
I do not want Active and Manual tags present in the generated xml, is there any way to achieve this? Kindly help.
Thanks in Advance.
I'm not sure of MS Project's behaviour if these values are removed entirely... if it would give you the defaults you are expecting when it reads the file. On that basis it is not something you can change in MPXJ itself.
However, one simple way to achieve what you want would be to apply an XSL transformation to the generated XML to remove the elements you don't want. The answer to this StackOverflow question provides an example of how this could be done.
Assuming you are using Java and you are writing to a stream you can probably use one of the mechanisms highlighted in this StackOverflow question to take the output directly from MPXJ and pass it through an XSL transformation.

Include the file name of the xsd schema I am processing with xslt

Hello
I am generating Objective-C class files with Saxon via XSLT and in a comment header would like to include information as to which xsd was used for their creation. Is there any way I can access the current filename during an xslt transformation?
Would be great if anyone had an idea...thanks!
Assuming XSLT/XPath 2.0 or later you can use document-uri(/) http://www.w3.org/TR/xpath-functions/#func-document-uri to find the URI of the input document and if you only want the file name then you could use tokenize(document-uri(/), '/')[last()].

Load XML file into object. Best method?

We are receiving an XML file from our client. I want to load the data from this file into a class, but am unsure about which way to go about it.
I have an XSD to defining what is expected in the XML file, so therefore i can easily validate the XML file.
Can i use the XSD file to load the data into a POCO, using some sort of serialization?
The other way i was thinking was to load the xml into a XMLDocument and use XPath to populate each property in my class.
Cheers for any advice
Depending on how complex the XSD is, you have a couple of options:
Use xsd.exe to generate C# classes which can be used in conjunction with the XmlSerializer.
Use svcutil.exe with the /dconly argument to generate DataContract-attributed types appropriate for use with the DataContractSerializer.

Does anyone know where to get the XSD file describing the junitReport.xml file format expected by Hudson?

I need the XSD of junitReport.xml recognized by Hudson.
Does anyone know where can it be found?
Thanks.
At this link, someone has already tried to analyse the JUnit code to check for any references for it's XML schema. But an XSD is no requirement to create XML and apparently, it doesn't use one.
I've create a junit.xsd for Ant's junit task. It was created by examining the relevant Java code in Ant 1.8.2

Resources