Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 29th, 2012, 11:47 AM
Authorized User
Join Date: Sep 2012
Posts: 35
Thanks: 18
Thanked 0 Times in 0 Posts
Question Create an XML document using JAXP and XML fragments.

Hi all.

I hope this is the correct place to ask this question, but if not then a pointer in the right direction would be good.

Does anyone have a link to a resource that will show me how to create an XML document using JAXP? In my ideal world I want to create the 'master' document from various fragments of XML. The element and attribute values for these fragments will be taken from input entered by the User via the Application's UI.

So, for a document with say four sections I would have as resources four empty templates that I populate with the User's input then using these four populated templates create an new complete XML document and include the schema and other references as needed.


Old October 29th, 2012, 01:11 PM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

JAXP is an umbrella term for the Java APIs for a large number of XML technologies. Which did you have in mind? XSLT?
Michael Kay
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Old October 29th, 2012, 03:44 PM
Authorized User
Join Date: Sep 2012
Posts: 35
Thanks: 18
Thanked 0 Times in 0 Posts

Originally Posted by mhkay View Post
Which did you have in mind? XSLT?
Ah well there's the rub, I don't know as I don't know what the best approach is. All I want to do after the User has completed the input form is to load a fragment of XML :
<foo attrA="" attrB="" attrC="" ...>
    <bar attrA="" attrB="" />
via an appropriate method, set the foo element's attributes then the bar element and keep it as an XdmNode(?) for inclusion in the 'master' document. After the user has completed all of the input forms and I've extracted all of the various sections' inputs from the user I create my 'master' XML document my adding the XdmNodes to a single document.

Does this make any more sense?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Split xml file with result document and javax.xml.transform.Transformer. nisargmca XSLT 3 January 12th, 2010 06:26 AM
create xml document by xpath in java zhebincong XML 1 October 6th, 2009 04:07 AM
create 2-columns table from an XML document frosty1575 XSLT 2 May 16th, 2006 04:17 AM
XML validation with Schema/DTD using JAXP Hendrik XML 0 December 28th, 2004 06:58 AM
Access XML fragments embedded in Word 2003 debsoft General .NET 2 May 7th, 2004 07:55 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.